Closed dario-loi closed 6 months ago
Can you double-check if /home/dariol/.config/Code/User/latexUtilsLiveSnippets.json
exisis?
Yes, the json file is under my .config
directory at the correct path, perhaps the if branch is not taken anyway (existSync
returns false)?
I have exactly the same issue : the command LaTeX Utilities: Edit Live Snippets file
do nothing (and I don't have 'Code -OSS' but only 'Code' in the .config directory.
Is there any solution ?
Thanks
The reason is that this line here is executed despite the fact that you do not have an OSS version.
It seems that the extension checks if a Code
directory is present under .config
, if it doesn't, it falls back to using Code - OSS
instead as a .config
folder, without checking if it exists or not, hence it incorrectly assumes that you have the OSS version instead.
A version of the code that doublechecks and errors out could be easily written:
let conf = path.join(process.env.HOME, '.config', codeFolder, 'User', templateName);
if (existsSync(conf)) {
return conf;
} else {
conf = path.join(process.env.HOME, '.config', 'Code - OSS', 'User', templateName);
if (existsSync(conf)) {
return conf;
}
else
{
return "";
}
}
Alternatively, if there is a way to figure out which of the two is being used to run the extension, the .config
directory could be created (its worth nothing that in my case the directory DOES exist)
@obrebant you can try a janky fix by navigating to ~/.vscode/extensions/tecosaur.latex-utilities-0.4.10/
and then by manually modifying the code in /out/main.js
, which is the transpiled and minified version that contains the above lines, you can then substitute 'Code - OSS' with 'Code' in line 372, this solved the problem on my machine.
Hi @dario-loi !
Thanks a lot for your reactivity. I understand the problem. I have modify the 'main.js' file as you suggest, and it works fine for me too. Nice and thank you. However, I suppose, we would make again the changes after the next update...
Thanks @dario-loi! Can you make a PR on this?
Unfortunately I do not know how to set up a development environment for VSCode extensions, and even then I am unable to reproduce the bug on my current system, so I am not sure if the proposed solution would be appropriate.
I think it's better to migrate these settings to vscode settings. This would allow vscode's setting sync to work with custom snippets and better following vscode's guidelines
I'll implement this later
I just noticed that my feature request (microsoft/vscode#180677) has been implemented. Now I'm putting this feature on my TODO list...
Bug Report
Describe the bug
Running the command
LaTeX Utilities: Edit Live Snippets file
does not work whenever the extension is on a Linux machine that is running the extension on a bin installation of Visual Studio Code (not the OSS version).The reason is apparent, the code that generates the json is hardcoded to look in the
Code - OSS
directory under.config
, switching this line toCode
solves the issue on my machine, it is however a solution that would break the extension for every other machine that actually uses the OSS version, therefore, some selection mechanism in the code should be providedTo Reproduce
Steps to reproduce the behaviour:
CTRL + SHIFT + P
)LaTeX Utilities: Edit Live Snippets file
Expected behaviour
The requested snippets .json file should show up.
Logs
Please paste the whole log messages here, not parts of ones. It is very important to identify problems. If you think the logs are unrelated, please say so.
LaTeX Utilities Output
[20:05:57] editLiveSnippetsFile [20:05:57] Error: ENOENT: no such file or directory, open '/home/dariol/.config/Code - OSS/User/latexUtilsLiveSnippets.json' [20:05:57] Error reported.Desktop