-
Notifications
You must be signed in to change notification settings - Fork 185
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
Add ability to override language_id per selector #1501
Conversation
Since we lost the ability to override the languageId with the introduction of "selector" this adds ability to override them.
Not for it. Why not override the "json": {
+ "languageId": "jsonc",
"enabled": true,
"command": [...],
"selector": "source.json"
} |
Because it doesn't work like that (anymore). And if you mean "why not implement it like that?" then that wouldn't be right because there can be multiple selectors and we wouldn't necessarily want to assign the same ID to all. |
You can use Line 732 in b9568f3
|
I believe that even that is no longer possible in ST4. The |
For some reason I cannot copy links from Discord, but we've had this discussion before :-) and the conclusion was to send Quoting from Discord:
|
It would also be fine in my book to always send |
I still believe that it would be bad to override lanague_id to I think the proper solution would be to maintain a database of associations and then have something in the plugin API to override that per-file. But that's a separate topic. |
By the way, some schemas do not include "allowComments": true at all, and expect a jsonc language ID. Quoting deathaxe from Discord because I just cannot seem to copy a link:
|
Because The solution to sublimelsp/LSP-json#74 could be to inject EDIT: Actually that wouldn't be that easy because we don't fetch the schema content, the server does... |
And BTW, this is how VSCode knows whether it should use |
OK, I don't think we need this right now at least (maybe some use case will pop up in the feature). I think what we need right now is a plugin API for overriding language ID per-file. Then LSP-json would maintain a database of "filepath => language id" and it would be queried before opening the file. |
I suppose I cannot convince you to send |
No, because then I wouldn't see actual issues caused by trailing commas in plain json files like |
Since we lost the ability to override the languageId with the
introduction of "selector" add the ability to override them.
This is a proof of concept in relation to sublimelsp/LSP-json#74.
I'm not sure we really want it and if we do, whether in that form.
It would be used with a configuration like:
in client config or a plugin.