You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Default extensions overriding language configuration from user installed extensions #114684
However, I think it is wrong that the default extension sometimes overrides an installed extension here. Then that API can't be trusted at all. I worry about what more configuration is now sometimes being overridden.
VSCode Version: 1.52.1
OS Version: N/A
Steps to Reproduce:
Install Calva
Open a *.clj file
Issue the command Toggle Line Comment on an uncommented line
Expected: It gets commented with ;;
Actual: It gets commented with ;
Please let me know how I can assist in fixing this issue.
Does this issue occur when all extensions are disabled?: Not applicable
Reacted by Janne Sauvala, Stefan van den Oord, Arne Brasseur, Brandon Ringe and Lee Read
Language configuration file handling is implemented by waiting for the language to be first used (like embedded in another language like a markdown fence or a file using the language is opened) and then reading async the language configuration file and applying it. This is done here. Whenever the language configuration file finishes reading, it will go and configure the LanguageConfigurationRegistryhere in pretty much the exact same way an extension calling setLanguageConfiguration configures it here.
So deep down there is no difference between those two calls and basically those two calls are racing themselves and it is lucky that until now the call reading the descriptive file was always faster than the imperative call from your extension.
If you want to be sure to overwrite the builtin language configuration, you can define your own language configuration file using:
But I also see how you would expect that the imperative call would "win" over the descriptive way, so maybe we can do something on our side to give a higher priority to the imperative call way of configuring languages.
FYI: since a few days, onEnterRules can also be specified in JSON, so using the imperative way of configuring languages is no longer really necessary.
Activity
alexdima commentedon Jan 22, 2021
I am surprised that this ever worked reliably, it must have been some amazing timing luck.
vscode-clojuredefines a language configuration at https://github.com/microsoft/vscode-clojure/blob/d09c57202222618740e49f3e5b055f6ff16b3355/package.json#L30 .Language configuration file handling is implemented by waiting for the language to be first used (like embedded in another language like a markdown fence or a file using the language is opened) and then reading async the language configuration file and applying it. This is done here. Whenever the language configuration file finishes reading, it will go and configure the
LanguageConfigurationRegistryhere in pretty much the exact same way an extension callingsetLanguageConfigurationconfigures it here.So deep down there is no difference between those two calls and basically those two calls are racing themselves and it is lucky that until now the call reading the descriptive file was always faster than the imperative call from your extension.
If you want to be sure to overwrite the builtin language configuration, you can define your own language configuration file using:
But I also see how you would expect that the imperative call would "win" over the descriptive way, so maybe we can do something on our side to give a higher priority to the imperative call way of configuring languages.
PEZ commentedon Jan 22, 2021
Thanks Alexandru Dima (@alexdima) ! This is great information. Calva has been relying on this luck for a very long time. 😄
And yes, I actually choose to do it the imperative way very consciously, assuming it was the way to be sure I could override the defaults.
Bundle our language configuration as a file
Give a higher priority to language configuration set via API call (#1…
Give a higher priority to language configuration set via API call (#1…
Trusted Workspaces Feature Branch Merge (#115961)