sleepymalc / VSCode-LaTeX-Inkscape

✍️ A way to integrate LaTeX, VS Code, and Inkscape in macOS
https://pbb.wtf/posts/VSCode-LaTeX-Inkscape/
MIT License
364 stars 24 forks source link

Snippets could be triggered in non-math environment #24

Closed resort09 closed 1 year ago

resort09 commented 1 year ago

After coding Latex for a while, snippets will be triggered in non-math environment. I need to re-start VS code once for a while. For example, in text environment, when type to, it becomes \to; when type (some random text)+bf, \mathbf{} will be triggered instead of \textbf{}.

VS Code: Version: 1.82.2 (user setup) Commit: abd2f3db4bdb28f9e95536dfa84d8479f1eb312d Date: 2023-09-14T05:55:25.390Z Electron: 25.8.1 ElectronBuildId: 23779380 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Windows_NT x64 10.0.22621

Latex distribution: 2023 TexLive.

Attached are vscode settings.json and latex.hsnips settings_and_latex.code.snippet.zip

I'd really appreciate if you could kindly help me check this question out, thank you!

sleepymalc commented 1 year ago

A quick potential fix: reload the scope of the tab by shift+cmd(ctrl)+p and select HyperScopes: Reload Scopes For Current Document. Let me know if this doesn't work.

resort09 commented 1 year ago

A quick potential fix: reload the scope of the tab by shift+cmd(ctrl)+p and select HyperScopes: Reload Scopes For Current Document. Let me know if this doesn't work.

Thanks! This is helpful. The whole night I've coding Latex and the problem haven't showed yet.

sleepymalc commented 1 year ago

This is mainly a Hypersnips bug (or a VSCode one, it's complicated). Although the author of Hypersnips claimed that this was already fixed, I consistently face the same problem. Whenever I met it, I reloaded the scopes and moved on. Binding this action on a keybinding might be a good idea, though whenever I'm typesetting LaTeX, this is the only action I'll use so it's always on the top (maybe except the first time). So it's really just shift+cmd+p and Enter, problem solved.