-
Notifications
You must be signed in to change notification settings - Fork 184
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
WIP: Remove the syntaxes key from the client configs #825
Conversation
Make the arg optional in LanguageConfig, so as to not disturb LanguageHandlers in the wild. Cache the lookup, because we're loading an entire file and doing a regex search in it.
sublimelsp/LSP#825 Signed-off-by: Jack Cherng <jfcherng@gmail.com>
I encountered noticeable performance problem with this branch today. Installed Packages
The minimal reproducer is only these 3 packages installed. Reproducerhttps://github.com/jfcherng/reproducer-lsp-remove-syntaxes-key-performance To reproduce, use the Video Recording
|
Thanks for trying it out! The problem is, I think, that we're loading a tmLanguage file, not a sublime-syntax file. So:
On every keypress this will keep loading the entire syntax file and doing a regex search in it :) |
It looks like you are right. If I convert the syntax into a |
The implementation assumes only 1 scope can be found, I think you likely want to store the "0 scopes" result and also handle the multiple scopes (embedded languages) case. Which brings us to @rchl 's case, where some language servers don't handle being sent non-javascript documents that happen to have |
So he sets up his configs like this: {
"command": ["vue-ls"],
"languageId": "vue",
"scopes": ["text.html.vue"]
},
{
"command": ["javascript-typescript-langserver", "--stdio"],
"languages": [
{"languageId": "js", "scopes": ["source.js"]},
{"languageId": "jsx", "scopes": ["source.jsx"]}
]
} The base scope of a Vue file is Additionally you can add eslint as a second server for both files (I'm not sure if eslint supports Vue files, but let's pretend that it does for the example): {
"command": ["eslint"]
"languages": [
{"languageId": "js", "scopes": ["source.js"]},
{"languageId": "vue", "scopes": ["text.html.vue"]}
]
} Now he'll run vue-ls+eslint for Vue files, and javascript-typescript-langserver+eslint for JS files. Moreover, it won't matter whether someone is using Babel Sublime Syntax, or Ecmascript Syntax, as all of these syntaxes have Future roadmap if we agree on this scopes approach: Replace the "scopes": ["source.foo", "source.bar"] will give the same selector score as "selector": "source.foo | source.bar" The current state of this PR has some bugs with respect to project switching, please don't suddenly merge. |
Also there seems to be some confusion on what |
Someone on Discord pointed out that there's
We can use that information to extract the base scope like this:
So it looks like this is yet another problem that ST4 will solve more elegantly. |
Why is this closed 🙂 |
I want to make a new one using the ST4 api |
@rwols is there some info out about ST4? I googled around and didn’t find anything concrete |
@james2doyle it's only published in the official discord chatroom for early test purpose at this moment. |
sublimelsp/LSP#825 Signed-off-by: Jack Cherng <jfcherng@gmail.com>
close #823
related #540
Make the arg optional in LanguageConfig,
so as to not disturb LanguageHandlers in the wild.
Cache the lookup, because we're loading an entire file and doing
a regex search in it.
This is a WIP, and I'd like to ask @tomv564 for directions on how to handle the importing of
sublime
in configurations.py now (or wherever), making the pytest tests fail. Perhaps we can move more tests to UnitTesting instead?