James-Yu / LaTeX-Workshop

Boost LaTeX typesetting efficiency with preview, compile, autocomplete, colorize, and more.
MIT License
10.55k stars 522 forks source link

Snippet view In any language? #4162

Closed James-Yu closed 6 months ago

James-Yu commented 6 months ago

Discussed in https://github.com/James-Yu/LaTeX-Workshop/discussions/4160

Originally posted by **nonodev96** February 15, 2024 Hi, is there any way to disable the warning LatexWorkshop gives you when you use the symbols in the snippet view? I would like to use them in markdown or other languages, but I don't want to use markdown_latex_combined. Thanks 👋 Warning: Please select a LaTeX document to insert the symbol.
James-Yu commented 6 months ago

@jlelong What about release the LaTeX langID check at https://github.com/James-Yu/LaTeX-Workshop/blob/bb97ed00a6f3969163e24d8cbd979bd0b1e15268/src/extras/snippet-view.ts#L12-L14

I cannot recall why we limit the snippet insertion to LaTeX-only.

jlelong commented 6 months ago

I cannot think of any reason why we need to limit the snippet to LaTeX only language id editors. Setting state.editor = e should work fine. Yet, the extension is only activated when opening a TeX related language, which is a prerequisite to using the snippet view.