-
Notifications
You must be signed in to change notification settings - Fork 149
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 Pyright langserver spec #587
Conversation
d69025a
to
48a6b3c
Compare
Thanks for the PR!
Good question! It is possible by changing one of the It might be good to think about a better way in the future, but this would be fine for me if you just added it there. |
Thank you for your advice! I added default configuration and set this PR ready for review. |
Thank you! I think that it would be nice to show it in the documentation among other "NodeJS-based Language Servers" but it does not show up currently: https://jupyterlab-lsp--587.org.readthedocs.build/en/587/Language%20Servers.html If I am not mistaken, it should be enough to add it to our devDependencies (in repo, not in the package): But we may need to think about it as I suspect it might be heavy. Thoughts @bollwyvl? Also, feel free to add a changelog entry. |
Ah, adding it may cause the tests to fail if it gets picked up instead of pylsp for tests. We need to introduce the priority system to select which server should be used if multiple server supporting given language are available ASAP to make testing of multiple servers for given language possible on CI. |
yeah, a relatively quick band-aid that wouldn't require much spec rework would be to land it in user settings. Is this a place to start the idea of a regex-based approach for e.g. using different servers for notebooks and python files? {
"language_servers": {
"python-lsp-server": {
"priority": 100,
},
"pyright": {
"priority": 1000,
"serverSettings": {
"python.analysis.useLibraryCodeForTypes": true
},
"_path_overrides": {
"priority": {
"ipynb$": 0
}
}
}
}
} In this case, This would give us a fair amount of flexibility until we figure out how to do multiple simultaneous sources properly, which is really the path forward... |
Looks good. In future we could just include something like: {
"language_servers": {
"spellchecker-server": {
"priority": 0,
"secondaryServer": true
},
"python-lsp-server": {
"priority": 100,
"secondaryServer": true,
"secondaryFeatures": ["textDocument/publishDiagnostics"]
},
"jedi-language-server": {
"priority": 1000,
"serverSettings": {}
}
}
} where |
I'm thinking if we do 2, we might as well do |
Agree. I did not mean to suggest that it is max two servers, I just could not think of a better name than "secondary" that would be obvious in meaning. |
Also updating Node as pyright requires >=12 (10 just reached EOL), but only bumping to 15 as 16 not yet on conda-forge: conda-forge/nodejs-feedstock#189 |
d2ec0b1
to
770a4b8
Compare
770a4b8
to
fa23d8f
Compare
The pyright diagnostics do not seem to be shown on Windows; this appears to be related to path encoding and the issues with #595. Specifically we can see:
So we request:
But pyright returns:
|
It appears that it was not intended behaviour two years ago: microsoft/pyright#124 but in a recent issue: |
d0d9962
to
accad00
Compare
So green 🟢 :) Thank you @yuntan, merging now. |
References
related to #534
Code changes
Added Pyright langserver spec.
User-facing changes
User can use Pyright with JupyterLab.
Backwards-incompatible changes
Nothing.
Chores
I wonder how to add default configuration for language server. In this case, setting
python.analysis.useLibraryCodeForTypes
totrue
by default might helpful for users.