Skip to content
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

Nu LSP crashes on encountering unicode values #12745

Open
KAAtheWiseGit opened this issue May 3, 2024 · 4 comments
Open

Nu LSP crashes on encountering unicode values #12745

KAAtheWiseGit opened this issue May 3, 2024 · 4 comments
Labels
🐛 bug Something isn't working LSP Language Server Protocol (nu-lsp)

Comments

@KAAtheWiseGit
Copy link
Contributor

Describe the bug

The LSP nu --lsp, used by Neovim, crashes when it encounters non-ASCII Unicode values.

How to reproduce

1. `Ctrl+o` to open a Neovim editor with Nushell LSP enabled.
2. type `path ä<space>`.
3. LSP crashes.

Expected behavior

Not crash.

Screenshots

No response

Configuration

key value
version 0.92.0
branch
commit_hash
build_os linux-x86_64
build_target x86_64-alpine-linux-musl
rust_version rustc 1.77.0 (aedd173a2 2024-03-17) (Alpine Linux 1.77.0-r0)
cargo_version cargo 1.77.0
build_time 2024-04-03 10:33:03 +00:00
build_rust_channel release
allocator mimalloc
features default, sqlite, trash, which
installed_plugins

Additional context

I'm unsure how to properly log the LSP output. If there's a way, I can replicate the bug and submit the logs.

Neovim itself outputs:

Error detected while processing InsertCharPre Autocommands for "*":                                                                                                 
Error executing lua callback: /usr/share/nvim/runtime/lua/vim/lsp.lua:1980: attempt to index local 'client' (a nil value)
stack traceback:
        /usr/share/nvim/runtime/lua/vim/lsp.lua:1980: in function 'cancel_fun'
        ...m/site/pack/deps/start/mini.nvim/lua/mini/completion.lua:805: in function 'cancel_lsp'
        ...m/site/pack/deps/start/mini.nvim/lua/mini/completion.lua:740: in function <...m/site/pack/deps/start/mini.nvim/lua/mini/completion.lua:738>

Which, I presume, means that the LSP client has disconnected.

@KAAtheWiseGit KAAtheWiseGit added the needs-triage An issue that hasn't had any proper look label May 3, 2024
@fdncred fdncred added 🐛 bug Something isn't working LSP Language Server Protocol (nu-lsp) labels May 3, 2024
@fdncred
Copy link
Collaborator

fdncred commented May 3, 2024

@schrieveslaach Would you mind looking into this?

@KAAtheWiseGit I'm not sure about logging either but my first step would be to look at the testing. Seems like Marc had quite a few tests for the lsp.

BTW - I put path ä in a nushell script to try and repro on my mac and can't make it crash. I tried a variety of things. Not sure why I can't reproduce it.

@schrieveslaach
Copy link
Contributor

@KAAtheWiseGit, I couldn't reproduce the issue with the Arch builds or with the latest development version.

key value
version 0.92.2
branch makepkg
commit_hash 2a08a18
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.77.1 (7cf61ebde 2024-03-27) (Arch Linux rust 1:1.77.1-2)
cargo_version cargo 1.77.1
build_time 2024-04-11 08:40:50 +00:00
build_rust_channel release
allocator mimalloc
features dataframe, default, sqlite, trash, which
installed_plugins

I'm wondering if this is a x86_64-unknown-linux-gnu vs x86_64-alpine-linux-musl thing. 🤔 Is there some CI tests with a musl based system?

@fdncred is right, there are tests with utf8.

@KAAtheWiseGit
Copy link
Contributor Author

I thought it might've been a Neovim-specific thing, but I can't replicate it with gopls or Rust analyzer.

@sholderbach
Copy link
Member

Worth keeping in mind that the default encoding for positions specified by the protocol is UTF-16 until the capability negotiation is done.

@sholderbach sholderbach removed the needs-triage An issue that hasn't had any proper look label May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working LSP Language Server Protocol (nu-lsp)
Projects
None yet
Development

No branches or pull requests

4 participants