Description
Version: 1.30.2 (user setup)
OS: Windows_NT x64 10.0.16299
(also present in 1.31.0-insider)
I am developing a language extension (not yet published in Marketplace). It contributes three language IDs:

I have also installed a Marketplace extension intended for the same language, which contributes three different language IDs but assigns one of them the same name (ObjectScript) as one of mine:

When both extensions are enabled and I open the 'Select Language Mode' picker there is only one 'ObjectScript' entry despite every list entry also displaying the language ID in parentheses as a suffix, i.e.

Combined, the two extensions offer only five choices rather than six.
The documentation at https://code.visualstudio.com/docs/languages/identifiers didn't help me understand whether what I'm seeing is intentional. Nor does it say how the aliases array is supposed to function.
Activity
alexdima commentedon Feb 11, 2019
Are these really different languages or the same programming language? If they are the same language, may I recommend to use the same language identifier.
Internally, we have maps and the maps will get overwritten/become conflicting. We have a map from file extension to language id (this will be conflicting in this case), another map for language name to language id (this is the one you notice in your screenshot), another map for language id to language name, etc... When picking the same language id, language name, or file extensions, these will be overwritten.
There are two possible solutions:
extensions.allif the other extension is installed and prompt users, explaining that they need to disable one or the other...gjsjohnmurray commentedon Feb 11, 2019
alexandrudima - Thanks for your response. They are the same programming languages.
Is the 'language name' you mention always the first element of the
aliasesarray in a member of thelanguagesarray in an extension'spackage.json?Or do second and third aliases have equal significance with first aliases?
The doc at https://code.visualstudio.com/docs/languages/identifiers#_new-identifier-guidelines advises:
Sounds like we also need to check language names as well as identifiers, right?
alexdima commentedon Feb 11, 2019
Yes, clashes in filename extension, language ids and language names will have funny effects, as you have found.
I recommend that you use the same language id and language names as already established. If you don't like to repeat the same definition, you can add an extension dependency from your extension to the other extension.
gjsjohnmurray commentedon Feb 11, 2019
OK, thanks. Please can that doc section be improved? Either under this issue (which is why I haven't yet closed it), or on a fresh one. Ideally add info about aliases too.
alexdima commentedon Feb 13, 2019
John Murray (@gjsjohnmurray) Would you be willing to create a PR at https://github.com/Microsoft/vscode-docs/blob/master/docs/languages/identifiers.md ?
gregvanl commentedon Oct 14, 2019
Closing as no PR submitted.
pecigonzalo commentedon Mar 12, 2020
I have a similar/related question. How are the users able to select between two extensions providing the same language?
I'm developing one that provides only syntax highlighting and grammar, but I would like to be compatible with the existing one, so I'm using the same language
idbut despite changing the aliases lists and other tricks.I cant seem to get it to display both and let the user choose while keeping the same
languages.id. Ideally, be able to set file associations to my extension so grammar and syntax are pulled from it but completion/etc uses the other extension.It would be great to better describe what
grammars.scopeNameandgrammars.languagedo along withlanaguages.idandlanguages.aliasesRevert id to match known lang id
alexdima commentedon Mar 17, 2020
Gonzalo Peci (@pecigonzalo) What you desire is currently not possible.
pecigonzalo commentedon Mar 17, 2020
alexdima commentedon Mar 17, 2020
Gonzalo Peci (@pecigonzalo) There is no user-facing picker for grammars (in case multiple extensions register multiple grammars for the same language). But extensions are currently processed in alphabetical order. If extension
Bcomes after extensionAalphabetically, then extensionBhas a chance to override certain contributions done by extensionA.That being said, it is unlikely that we will build a user-facing picker for grammars. IMHO, for the wide community, it is far better to contribute a PR to the established grammar than to start a grammar from scratch, so I would like to ask why do you write a new grammar from scratch for Go and Python. Why don't you contribute to the existing ones, to improve them for all of the users of those extensions?
pecigonzalo commentedon Mar 17, 2020
Alexandru Dima (@alexdima) There is the
files.associationssection. Isnt that the picker?It is better in many cases to contribute to centralized grammar, but I might want to submit a different grammar, which some users might prefer and some don't, so I would just create a new grammar extension. Ideally, users should be given the ability to choose, as we do in all software and linters and etc.
IMO It would be a lot better to stop bundling 30 functions in 1 extension, like grammar/syntax with LSP and linter/formatter as they could be safely decoupled.
Just to clarify, I'm not trying to do a Go or Python syntax, but rather a Terraform one. https://github.com/mauve/vscode-terraform the most widely used one, but there is also https://github.com/4ops/vscode-language-terraform and some others. So it would be great to use and support mauve functionality on formatting and integration to LSP but use a different syntax.
pecigonzalo commentedon Apr 16, 2020
Alexandru Dima (@alexdima) any thoughts on this? Could we maybe re open the issue?
dionjwa commentedon Aug 14, 2020
As example: browser Typescript, and Deno. Both use the
.tsextension, but the std lib for each is completely different, and requires a different language mode.alexdima commentedon Sep 2, 2020
Dion (@dionjwa) We don't currently have any other setting than
files.associations. That can be defined at the user level, per-folder or per-workspace.Gonzalo Peci (@pecigonzalo) I am sorry I still don't 100% understand what would you want us to do in VS Code? I mean we definitely detect the fact that there are two definitions for two distinct grammars for the same language. Should we offer a user setting that would be respected in case of clashes?
GitMensch commentedon Nov 8, 2023
Yes, for example a variante to the language identifier as it is done in the SARIF spec, you can even use the extension name for that and this way have