Open fsmunoz opened 9 months ago
This would be nice, I would like to use the lsp server in neovim.
Thank you for reporting. Your minimal change will only make en locale work. How about passing the locale to start the server?
VSCODE_NLS_CONFIG='{"locale":"en"}' node ./server/dist/node/server.js --stdio
Hi @scnwwu , thank you for your feedback!
I think that my change would work the same as it does currently: it would set the "en" the locale whenever there wasn't a VSCODE_NLS_CONFIG
env variable, AND then if there wasn't a navigator.language
defined - otherwise it would pick the former than the latter.
That said, your suggestion works perfectly for me and doesn't require any change, so it's perfectly fine. It will break by default (instead of defaulting to "en") but since there is a way to go around it's ok.
I think that a very small update to the README
to mention this possibility (and the necessity of setting the env variable) could be useful to make others aware, this is a great feature.
Is your feature request related to a problem? Please describe.
One of the goals of LSP was to separate the tooling around language support from the editor. Currently, the SAS LSP server included in the extension doesn't work due to a minimal detail around the behaviour of the
?
operator when the variable doesn't exist.Describe the solution you'd like
Compiling the vscode extension should result in an LSP command that can be used outside of vscode.
Describe alternatives you've considered
N/A
Additional context
Everything important already works, since the
stdio
option is there, and the build process (npm run compile
) produces a usable LSP server inserver/dist/node/server.js
that can be run withnode server/dist/node/server.js --stdio
. The only nit is that currently thenavigator
variable is referenced as part of the locale detection code in a way that doesn't avoid aReferenceError
(which is correct as per the ECMAscript spec, although unexpected to me):I've made this minimal change in my fork that uses the ternary operator to go around the fact that
?
doesn't avoid the ReferenceError. I can open a PR with it, but there is probably a more idiomatic way of doing it in TypeScript.With that change, using the
-stdio
option makes the LSP server work for other editors, specifically here Emacs usingemacs-lsp
associated withSAS-mode
:The benefits are however not limited to this example, since I see no reason why it wouldn't work in vim/neovim/etc and thus be of help to a wider community without incurring any additional complexity.
Environment