-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
rust-analyzer-unwrapped: 2024-09-02 -> 2024-11-11 #354304
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cbaf11a
rust-analyzer-unwrapped: 2024-09-02 -> 2024-11-04
khaneliman 8991722
rust-analyzer/wrapper: format
khaneliman fe71382
rust-analyzer/test-neovim-lsp: format
khaneliman 17e3fab
rust-analyzer-unwrapped: format
khaneliman 198cd91
rust-analyzer-unwrapped: disable broken test
khaneliman b9074ee
rust-analyzer-unwrapped: 2024-11-04 -> 2024-11-11
khaneliman 2f9cef5
rust-analyzer-unwrapped: apple-sdk refactor
khaneliman 2fa0afb
rust-analyzer-unwrapped: move to by-name
khaneliman 66689ef
rust-analyzer: move to by-name
khaneliman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
pkgs/by-name/ru/rust-analyzer-unwrapped/test-neovim-lsp.nix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| { | ||
| runCommand, | ||
| cargo, | ||
| neovim, | ||
| rust-analyzer, | ||
| rustc, | ||
| }: | ||
| runCommand "test-neovim-rust-analyzer" | ||
| { | ||
| nativeBuildInputs = [ | ||
| cargo | ||
| neovim | ||
| rust-analyzer | ||
| rustc | ||
| ]; | ||
|
|
||
| testRustSrc = '' | ||
| fn main() { | ||
| let mut var = vec![None]; | ||
| var.push(Some("hello".to_owned())); | ||
| } | ||
| ''; | ||
|
|
||
| # NB. Wait for server done type calculations before sending `hover` request, | ||
| # otherwise it would return `{unknown}`. | ||
| # Ref: https://github.com/rust-lang/rust-analyzer/blob/7b11fdeb681c12002861b9804a388efde81c9647/docs/dev/lsp-extensions.md#server-status | ||
| nvimConfig = '' | ||
| local caps = vim.lsp.protocol.make_client_capabilities() | ||
| caps["experimental"] = { serverStatusNotification = true } | ||
| vim.lsp.buf_attach_client(vim.api.nvim_get_current_buf(), vim.lsp.start_client({ | ||
| cmd = { "rust-analyzer" }, | ||
| capabilities = caps, | ||
| handlers = { | ||
| ["experimental/serverStatus"] = function(_, msg, ctx) | ||
| if msg.health == "ok" then | ||
| if msg.quiescent then | ||
| vim.cmd("goto 23") -- let mut |var =... | ||
| vim.lsp.buf.hover() | ||
| end | ||
| else | ||
| print("error: server status is not ok: ") | ||
| vim.cmd("q") | ||
| end | ||
| end, | ||
| ["textDocument/hover"] = function(_, msg, ctx) | ||
| if msg then | ||
| -- Keep newlines. | ||
| io.write(msg.contents.value) | ||
| vim.cmd("q") | ||
| end | ||
| end, | ||
| }, | ||
| on_error = function(code) | ||
| print("error: " .. code) | ||
| vim.cmd("q") | ||
| end | ||
| })) | ||
| ''; | ||
|
|
||
| } | ||
| '' | ||
| # neovim requires a writable HOME. | ||
| export HOME="$(pwd)" | ||
|
|
||
| cargo new --bin test-rust-analyzer | ||
| cd test-rust-analyzer | ||
| cat <<<"$testRustSrc" >src/main.rs | ||
| cat <<<"$nvimConfig" >script.lua | ||
|
|
||
| # `-u` doesn't work | ||
| result="$(nvim --headless +'lua dofile("script.lua")' src/main.rs)" | ||
| echo "$result" | ||
| [[ "$result" == *"var: Vec<Option<String>>"* ]] | ||
| touch $out | ||
| '' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| { | ||
| rustPlatform, | ||
| runCommand, | ||
| makeWrapper, | ||
| rust-analyzer-unwrapped, | ||
| pname ? "rust-analyzer", | ||
| version ? rust-analyzer-unwrapped.version, | ||
| # Use name from `RUST_SRC_PATH` | ||
| rustSrc ? rustPlatform.rustLibSrc, | ||
| }: | ||
| runCommand "${pname}-${version}" | ||
| { | ||
| inherit pname version; | ||
| inherit (rust-analyzer-unwrapped) src meta; | ||
| nativeBuildInputs = [ makeWrapper ]; | ||
| } | ||
| '' | ||
| mkdir -p $out/bin | ||
| makeWrapper ${rust-analyzer-unwrapped}/bin/rust-analyzer $out/bin/rust-analyzer \ | ||
| --set-default RUST_SRC_PATH "${rustSrc}" | ||
| '' |
62 changes: 0 additions & 62 deletions
62
pkgs/development/tools/rust/rust-analyzer/test-neovim-lsp.nix
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.