vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Declare some latex related language ids as internal only

Open jlelong opened this issue 10 months ago • 1 comments

The two grammars markdown_latex_combined and cpp_embedded_latex are designed to be used only for embedded blocks in LaTeX files. To warn users against manually using these languages, their names are now prefixed with internal_only_.

This PR is required to make sure further calls to latex/build/update-grammars.js will not break the latex syntax.

Related to https://github.com/jlelong/vscode-latex-basics/pull/101 and https://github.com/James-Yu/LaTeX-Workshop/issues/4533.

jlelong avatar Feb 23 '25 06:02 jlelong

@alexr00 This PR is required to ensure that the LaTeX grammar updated in #242296 works properly.

jlelong avatar Mar 07 '25 07:03 jlelong

Actually, the languages cpp_embedded_latex and markdown_latex_combined are available from VS Code language picker. Some users have reported issues because they tried to use them directly. We hope that added the internal_only prefix will make clearer that these languages must not be used directly.

jlelong avatar Mar 10 '25 11:03 jlelong

I'm still not seeing them in the language picker. Can you share a screen shot?

alexr00 avatar Mar 10 '25 11:03 alexr00

You are right, the languages cpp_embedded_latex and markdown_latex_combined are only visible in the language picker when the LaTeX-Worskhop extension is activated or I launch the vscode-latex-basics extension. This is probably because these languages are listed in the contributes entry of the package.json file.

This makes me come to the real question. Is there a way for an extension to define a language internally and to not contribute it outside of the extension?

Thanks for your help.

jlelong avatar Mar 10 '25 15:03 jlelong

@jlelong, I think it's as simple as not specifying any aliases in the package.json. See here, where we do specify aliases for BibTeX but don't specify any for cpp_embedded_latex.

https://github.com/microsoft/vscode/blob/3c911af4406aec42fab81a502feb8e12d483dbbe/extensions/latex/package.json#L44-L58

alexr00 avatar Mar 10 '25 16:03 alexr00

Specifying "aliases": [] does prevent the corresponding language to show up in the language picker but not specifying any aliases entry does not.

Then, I will reconsider https://github.com/jlelong/vscode-latex-basics/pull/101. I think this PR can be safely closed. @alexr00 Thanks for your help.

jlelong avatar Mar 10 '25 21:03 jlelong