-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clash between two extensions using same language alias #2862
Comments
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:
|
@alexandrudima - Thanks for your response. They are the same programming languages. Is the 'language name' you mention always the first element of the 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? |
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. |
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. |
@gjsjohnmurray Would you be willing to create a PR at https://github.com/Microsoft/vscode-docs/blob/master/docs/languages/identifiers.md ? |
Closing as no PR submitted. |
I have a similar/related question. How are the users able to select between two extensions providing the same language? I cant seem to get it to display both and let the user choose while keeping the same It would be great to better describe what |
@pecigonzalo What you desire is currently not possible. |
That is quite unfortunate, what is the current solution for this? To ask
the dev to also split their Lang part and just bundle it?
I understand this is not supported at the moment, but then I believe we
should stop bundling Lang and completion and LSP in a single plugin like
it's done in the official Go and Python ones.
…On Tue, Mar 17, 2020, 10:12 AM Alexandru Dima ***@***.***> wrote:
@pecigonzalo <https://github.com/pecigonzalo> What you desire is
currently not possible.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2862 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACLS7CJEMSABQO3J7X2ZPW3RH45JNANCNFSM4H6LGL7A>
.
|
@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 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? |
@alexdima There is the 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. |
@alexdima any thoughts on this? Could we maybe re open the issue? |
As example: browser Typescript, and Deno. Both use the |
@dionjwa We don't currently have any other setting than @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? |
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 "files.associations": {
"*.S": "asm/some.extension",
"*.asm": "asm/other.ext",
} |
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:
![image](https://user-images.githubusercontent.com/6726799/52194303-2af70200-284b-11e9-94e2-d64a34df061b.png)
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:
![image](https://user-images.githubusercontent.com/6726799/52194434-a953a400-284b-11e9-800c-048683acc4e1.png)
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.
![image](https://user-images.githubusercontent.com/6726799/52194746-fab06300-284c-11e9-8550-6982a4bfa80c.png)
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.The text was updated successfully, but these errors were encountered: