Changes-tracking doesn't work on SSH remote
Hi,
It seems the changes-tracking function won't work when installed on a SSH remote.
Could you share your config? Does the same config work locally?
D
Happened to me inside a Docker container. My config is:
"psi-header.changes-tracking": {
"enforceHeader": true,
"autoHeader": "autoSave",
"exclude": [
"*"
],
"include": [
"cpp",
"shellscript",
"dockerfile",
"cmake"
]
}
Tried with and without "exclude".
You have not set isActive to true
Could you share your config? Does the same config work locally?
D
Yes, the same configuration work on local machine. I copied the 'user' configuration to the 'remote' page in the extension settings. The settings for changes tracking is
"psi-header.changes-tracking": {
"isActive": true,
"replace": [
"Copyright",
"\\file"
],
"ignoreLines": []
}
Yes, the same configuration work on local machine. I copied the 'user' configuration to the 'remote' page in the extension settings. The settings for changes tracking is
Sorry, but I cannot see anything obviously wrong. I have been through the MS documentation and cannot see anything obvious as to why it would not work. I don't have a remote environment that I can do testing on, but as this is the first time I have had a report of a problem working via remote I have to assume that it might have something to do with your VSCode setup on the remote machine. Are you able to get anything from the remote machine that might indicate the source of a problem?
Regards D
Hi,
I tried it again. Without changing anything, it works now :). Don't know why, and thanks for your help.
Thanks for letting me know and glad it works.
D
Hi,
I'm back again. I find another strange thing. The tacking works well for my '.c' file on SSH Linux remote. But failed with .dts files (Linux device tree file). I suspect that it's the Linux system or other extensions are prevent the tracking functions working. It may be not the problem of psi, but any suggestions? Where can I get the extension log output?
And are there any methods to force it to update the filename and modified time?
Thanks.
Hi, D
Finally I find the reason. My lang-config is as below:
{
"language": "*",
"begin": "/*!",
"prefix": " * ",
"end": " */"
},
You see, there is a ' ' in each line prefix. But my DTS file formatter extension formatted it and removed the ' ' in each line of the header. And it seems he psi extension will check the header format before tracking the changes. In my situation, it missed because the removed ' ' before each line.
May there an option to let changes-tracking function be independent of the header format? Such as give it's own matching rule?
Thanks.
This has come up once before where a formatter extension modified the white space. Unfortunately there isn't a robust solution to this because the changes-tracking needs the language template in order to work out where the placeholders are that can be updated. Keep in mind that the extension does not force the header to be at the top of the file and also compact mode means it doesn't even have a cast iron "this is the start/end of the header". Also, as it currently works, the extension can deal with changes to the header made by the user manually after it was created. But all of this requires the changes tracking logic to know for sure that it is (a) in a header and (b) that it knows how to match lines in the header with the correct line in the template so it can get the placeholders from the template.
IIRC it was previously resolved by configuring the formatter to not alter comment blocks, alternatively, your only option is to not have leading spaces in the prefix setting (which is what your formatter currently wants to enforce).
But really, you are using a formatter that is enforcing a change in your header, so there is no point in trying to configure this extension to do something that is different to what the formatter will enforce.
Regards D