Open jokeyrhyme opened 1 year ago
nuls
and not helix, so I'm going to have to sit down and fix it: https://github.com/jokeyrhyme/nuls/issues/22Let's make this draft while it is still WIP.
ok, I'm seeing a few things:
I figured out that you have to quit out and restart to use a different lsp.
It looks like hover help isn't rendered correctly.
I'm guessing this is some markdown formatting issues with backticks and such. I remember JT fighting this originally.
We also already know that goto-definition doesn't quite work right yet.
It looks like the include-path isn't being sent correctly, at least it looks different in the logging window.
This is how those u{1e}
separators are rendered like using the extension lsp
Hovers seem to be getting the right information.
It's generally a pretty good experience considering where it's at in the development cycle. Good job!
@fdncred I assume those are notes on nuls
and not this PR on the extension? Anything further to be done in this PR?
Yes, those are notes on nuls
when I tried it out in this PR.
I think there should be some type of restart on this PR when the lsp changes.
Okay, I've made "implementation" a live setting
It's working suspiciously well, haha
My test of this produced some errors. Not sure what any of this really means.
Something weird is going on. If I delete the node_modules folders from the root, server, and client folders. Then do a npm install
and start debugging with F5 in vscode. I get all these errors seen above in the vscode where i have the source code and these popups in vscode that was launched with F5.
I will say though, the switching between nuls
and extension
is working well. We just need to narrow down on what's giving these other errors.
The current behaviour tries to stop all the servers and then start the desired one, and maybe those errors are from trying to stop a server that was never running
Just a theory, but I'll play with it and see
Thanks for checking!
I'm handling the Promises from client.start()
and client.stop()
more thoroughly to try to address those error messages
That said, I believe them to be pretty harmless, and you probably won't encounter them at all unless you try to use an implementation that cannot be started, i.e. you don't have nuls
installed, or you don't have the nu --lsp
branch installed
Thanks! I'll give this a try later this afternoon. Just so you know, I had nuls
and (obviously) extension
installed when I got those errors. I did not have the PR with nu --lsp
installed, but I never configured my system to use it. Hopefully we don't see these errors anymore so we can land this PR.
Sorry - Ran out of time today. I hope to look at this tomorrow.
No worries
Not urgent
And I've had less time to work in this area in the last week, too :)
ok, finally got to this. This looks better but I'm not sure we can ship with this. People will be filing issues because they think something isn't working. I wonder if there's a better way to handle this like if whatever the configured lsp is, like extension
, don't try and stop the configured one on startup. Just stop the other ones maybe?
There's also 3 language server log menu items now. Not sure what that's about. They all have similarly formatted information. Looks like they're all coming from the "extension" lsp. And they all update as you mouse over things.
Okay, seeing as there's no real harm in having .stop()
fail, we'll silently log these errors instead of displaying them
And I've given each LanguageClient
its own unique identifier and label, so that the drop-down in the Output pane is less confusing
I like what you did with the errors but it's still showing multiple Nushell Language Servers
on startup for extension
.
Once I switch to nuls
I see two with different names, which is probably ok. Although I'm not sure myself why they couldn't all share the same log window.
If I switch back to extension in the config, i have the same two log windows for (extension) again.
Hmmmm, I don't know why I can't reproduce any of this on my machine
It's been a pretty poor feedback loop so far
I've been able to verify that different implementations are powering IDE features as expected, but not everything else you've experienced
There are 3 separate LanguageClient
instances, which is why there should be at least 3 separate log sections, but it's possible that restarting one creates a fresh entry, which isn't ideal
There might be a way to recycle a single instance between them all
Or perhaps we're in strange territory for Code, perhaps one extension wasn't supposed to connect to multiple language servers like this
I really think the key is to remove your node_modules folders and do a npm install
. once i did that, weirdness was allowed. π
Just to be clear, we'll only have 1 language server in the final build. So, figuring out how to make it work with 3 is not really a super high priority. Eventually we'll just delete all the code and just have one. Having said that, if it's something that can be figured out quickly, it would be nice to be able to continue to switch between all of them while we're still testing. If it's a massive pain, we can just live with it until we reduce to one.
@schrieveslaach Now that we landed your PR https://github.com/nushell/nushell/pull/10723, I've started playing here with it to see how things are going. Good news is that since @jokeyrhyme already programmed this PR to make your lsp avaiable, I can see some things working like this hover.
But command hover's don't quite format right like this one
and this one
hard to show but when i tested it and it seems to be working great so far
I'm not sure how to get completions to work. What I was doing was typing str <ctrl-space>
. Not sure the right voodoo to get them to work here.
All in all, it's a good start.
I can also see the process running, and when I quit vscode, the nu --lsp process is ended.
@fdncred, thanks for the feedback and great to see that it is also working in Vscode (I'm using Neovim).
I'm not sure how to get completions to work. What I was doing was typing str
. Not sure the right voodoo to get them to work here.
I observed similar behavior in my editor of choice and that it seems to work only in certain conditions. Here is an example of my setup. I type something into the command line, start Nushell's open in editor feature, then my Neovim starts and start the LSP automatically, I can use some completions and then I quit the editor:
However, when the document changed completions stop working unless I was the document. And here the textDocument/didChange
implementation is required. I'll start working on it in the next days.
@fdncred, speaking of βto showβ: if you want I could provide some GIF recording of Nushell in Neovim if you want to include it in the release blog post.
@fdncred, speaking of βto showβ: if you want I could provide some GIF recording of Nushell in Neovim if you want to include it in the release blog post.
ya, definitely. Feel free to put them in this PR https://github.com/nushell/nushell.github.io/pull/1114 with a write up like "We've started building a nushell Language Server". What most people are looking for at this point is (1) how to configure it in helix, vim, nvim and (2) which features are currently supported.
@schrieveslaach i know this is not really the place for this, but could you share your Neovim setup? i cannot get the completions to work :confused:
@schrieveslaach i know this is not really the place for this, but could you share your Neovim setup? i cannot get the completions to work π
@amtoine, at the moment it is very simple. I start an LSP for the current buffer when file type nu.
function StartNuLS()
lua << EOF
local id = vim.lsp.start({
name = "Nushell's LSP",
cmd = {
"/pat/to/nushell-repo/target/debug/nu",
"--lsp"
},
on_attach = M.on_attach
})
vim.lsp.buf_attach_client(0, id)
EOF
endfunction
augroup NuSetup
autocmd!
autocmd FileType nu call StartNuLS()
augroup end
I was thinking of providing a PR to lspconfig after Nushell's next release which does it then for you. Maybe I'll also try to add file type nu to Neovim directly.
@schrieveslaach that would be great, i don't know how to plug that snippet into my config, i get errors all over the place :cry:
This PR only needs to support 2 lsps now. nu --lsp
and nu --ide-*
and not nuls
. So, it needs to be refactored to only do those 2. You should also read these threads to see what I mentioned was missing or not working right before. Some of it has to do with logging.
We probably want to determine what the destiny of this PR is
I agree we should remove the nuls
code path
But is it desirable to ship/merge this PR otherwise (assuming other rough areas are polished)?
Or, should we keep this as a PR until nu --lsp
has eclipsed nu --ide-...
, at which point we can delete that code path from the PR, too?
I'd like to have the functionality of switching between the two lsps until nu-lsp overtakes nu --ide- in functionality and stability. This PR isn't far from landing. We just need to work on the things mentioned, logging, making sure to default to nu --ide-, etc.
@fdncred Oh, my bad, sorry if I was disrespectful. I lost something in the translation π
My understanding is that the problems mentioned in this PR are solved in other PRs (either merged, or ready to merge when the moment comes)
help
command 11320and, the remaining issues:
It looks like the include-path isn't being sent correctly, at least it looks different in the logging window.
I don't know how to reproduce the problem, can you give me a little script or sample to follow? π― . That is a note for nuls
, is --lsp
working properly?
red error-sy logs here
I had some of those errors too, but it was something of VS Code playing badly with the extension. I decided to try the extension host with all the extensions disabled and it didn't failure once. Still have that weird bug that sometimes the LSP has more than one instance running
And that's about it. I see nothing else to be missing. That's why I asked before for "what could be done to land this PR?" (in a poor manner) Again, sorry for the rudeness! π
I think input for @AucaCoyan last comment would be also input for me on what I could work next in the LSP area. I'm a bit lost there at the moment because I just using it to edit my Nushell REPL input and don't often work with a lot of scripts.
Looking at this PR, there are a few things that might need to change before landing. I've tried to re-read everything and add a checkbox for it below just to make sure we've covered everything. Some of these items may be done and we can just check them off. Others will need some work prior to landing this PR.
nu --ide-*
and nu --lsp
as the two options for LSPs.Thank you very much for creating a list with everything! ππΌ
I'm wondering on how to tackle the list. I think we should resolve changing servers and debugging + errors first. But since this is a PR, only jokeyrhyme and maintainers of this repo can make changes. Is it ok to you to make PRs into your repo jokeyrhyme/vscode-nushell-lang
jokeyrhyme? Another possible way is to close this pr and make a meta issue.
Both ways are good for me π»
or @AucaCoyan we can close this PR and you can copy the code out of it and make a new PR with you being the owner. i'm not sure if there's a way to give you permissions to change this PR without going through jokeyrhyme's repo.
I've invited everyone here to collaborate on my fork, but have no ill feelings if you wish to fork my fork into another repository :)
Thanks @jokeyrhyme, we appreciate your help!
Thank you jokey! I tested it and updated main of your repo successfully π
We'll be seeing around each other here and in the fork πͺπΌ
nu --lsp
, orlsp
nu --ide-...
implementation embedded in this extensionnu --lsp
will use this implementation (if available): https://github.com/nushell/nushell/pull/10723nuls
will use the implementation in this repository (if available): https://github.com/jokeyrhyme/nuls