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
Implement LSP Text Document Synchronization #10941
Implement LSP Text Document Synchronization #10941
Conversation
@fdncred, improve completions are working now better. 😉 |
whoa! that looks great! looks like clippy is objecting to something, as usual :) and i love all the tests! keep up the great work! |
ca21211
to
cb76c41
Compare
Hmmm, it's not really working in vscode either. goto-definition isn't working, nor is hover.
|
cb76c41
to
5989ccc
Compare
@fdncred, are these errors popping up with this PR or are they are also popping up on main? |
@schrieveslaach They're specifically with this PR. |
5989ccc
to
93011b8
Compare
@fdncred, could you give it another try? |
I'm still getting this on the latest version. I wish I knew how to better support you.
|
fe9a15b
to
590f2f5
Compare
That was a good hint and made me look into the spec:
So, in case that there is no result, param_handler(engine_state, ¶ms)
.and_then(|response| serde_json::to_value(response).ok())
.unwrap_or(serde_json::Value::Null), |
The duplication issue makes me think if you have two LSPs running in the background… I can't reproduce it in Neovim. Do you have the same issue in Helix? |
ugh, i take it back. my language server is not set to nu --lsp |
ok, i updated my languages.toml to support |
590f2f5
to
ef018b7
Compare
Strange. I'll try to test the LSP in Helix later. Maybe @jokeyrhyme could test this PR too in Vscode. Meanwhile, I implemented diagnostics: |
That's so cool!!!! |
strangely enough, goto-definition on macos with helix is working, as well as hover, but not completions. |
Are you testing on Windows where it is not working? |
Tried running it on Linux (nixOS) with helix. Currently no luck. [[language]]
name = "nix"
rulers = [100]
[language.formatter]
command = "/nix/store/iqxdvd5gyckvs6k9al85rgdgqxc6sx0m-nixpkgs-fmt-1.3.0/bin/nixpkgs-fmt"
[[language]]
language-servers = ["nuls"]
name = "nu"
[language-server.nuls]
args = ["--lsp"]
command = "/nix/store/ib059h1skbr272kbn80sig1yk26466za-nu-0.86.1/bin/nu" When I do lsp-restart I get "Language server exited" and
in log. |
ef018b7
to
d66daa4
Compare
I raised a PR against the LSP server crate to make sure that CTRL + C can be handled properly (see rust-lang/rust-analyzer#15894) and updated this PR. |
We usually have a pause to landing PRs a few days before a release and a few days after a release. I'd like to land this as soon as we resume landing again. |
@fdncred Thanks for the quick iteration on this @schrieveslaach |
Let's go! |
Thanks for merging it. 😍 |
We're happy to keep chipping away at this thing. Keep up the good work! |
The one thing that concerns me about this PR is that we have a git dependency. I'm just hoping the rust-analyzer folks will land that PR soon, because if it doesn't land by our next release (Dec 12th), we will have to revert this PR. |
That was specifically for reacting to Ctrl+C, which I'd suggest probably isn't super critical and could be selectively reverted/removed |
…ykril Cancelable Initialization This commit provides additional initialization methods to Connection in order to support CTRL + C sigterm handling. In the process of adding LSP to Nushell (see nushell/nushell#10941) this gap has been identified.
…ykril Cancelable Initialization This commit provides additional initialization methods to Connection in order to support CTRL + C sigterm handling. In the process of adding LSP to Nushell (see nushell/nushell#10941) this gap has been identified.
@jokeyrhyme, @fdncred, rust-lang/rust-analyzer#15894 has been merged. Do you want me to update the main branch pointing to the merged version? No release yet on lsp-server. |
We should probably wait for a release. I'm not sure moving from one git dependency to another git dependency is worth it right now. Once there is a crate we can rely on, then we can report to that published crate, but I'm happy they landed the PR so there's hope that they'll make a release. |
@schrieveslaach what's the latest on this git dependency? has there been a release that includes it? if so, can we get it in? |
@schrieveslaach Thanks. Our next release is schedule for Dec 12. So we may have to land that PR. I appreciate you creating it. |
For anyone listening #11252 upgrades to the latest release of lsp-server including the ctrl-c support |
Just landed it. Yay! |
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description Hi! I was playing around and I fixed the formatting in the LSP hover. I _only tested in VS Code using Windows_, if anyone is capable, can you test it on nvim or linux if it works properly? I think markdown shouldn't have any problem The link of the LSP meta issue just for reference #10941 <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> # User-Facing Changes Now the LSP hovers markdown properly ![image](https://github.com/nushell/nushell/assets/30557287/7e824331-d9b1-40dd-957f-da77a21e97a2) <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use std testing; testing run-tests --path crates/nu-std"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. -->
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description Hi! I was playing around and I fixed the formatting in the LSP hover. I _only tested in VS Code using Windows_, if anyone is capable, can you test it on nvim or linux if it works properly? I think markdown shouldn't have any problem The link of the LSP meta issue just for reference nushell#10941 <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> # User-Facing Changes Now the LSP hovers markdown properly ![image](https://github.com/nushell/nushell/assets/30557287/7e824331-d9b1-40dd-957f-da77a21e97a2) <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use std testing; testing run-tests --path crates/nu-std"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. -->
<!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description Hi! I was playing around and I fixed the formatting in the LSP hover. I _only tested in VS Code using Windows_, if anyone is capable, can you test it on nvim or linux if it works properly? I think markdown shouldn't have any problem The link of the LSP meta issue just for reference nushell#10941 <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> # User-Facing Changes Now the LSP hovers markdown properly ![image](https://github.com/nushell/nushell/assets/30557287/7e824331-d9b1-40dd-957f-da77a21e97a2) <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use std testing; testing run-tests --path crates/nu-std"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. -->
Description
This commit provides the initial implementation of text document synchronization of the language server protocol: textDocument/didOpen, textDocument/didChange and textDocument/didClose (see #10794)
User-Facing Changes
Completions work better then before (see comment here). The demo show that Nushell opens the line buffer editor, that starts Neovim with Nushell as configured language server which has completions working.
Tests + Formatting
After Submitting