lsp crashing
Closed this issue · 14 comments
I'm not sure how to interpret this.
Process beancount-ls stderr finished
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Char range out of bounds: char range 2215700..2215700, Rope/RopeSlice char length 2215699', /Users/dustin/.asdf/installs/rust/1.62.1/registry/src/github.com-1ecc6299db9ec823/ropey-1.5.0/src/rope.rs:546:37
Probably something got out of sync with the text file updates
Does it constantly error for you? If it does, can you describe steps to reproduce?
- start up emacs (i use doom)
- open my
journal.beancount
file - start typing a new transaction
this is what i type
2022-01-02 * "something"
ex
As soon as I type "ex" on the second line, the lsp crashes.
emacs log
Found the following clients for /Users/dustin/Documents/accounting/journal.beancount: (server-id beancount-ls, priority 0)
The following clients were selected based on priority: (server-id beancount-ls, priority 0)
Beancount Server initializing
lsp stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Char range out of bounds: char range 2215714..2215714, Rope/RopeSlice char length 2215712', /Users/dustin/.asdf/installs/rust/1.62.1/registry/src/github.com-1ecc6299db9ec823/ropey-1.5.0/src/rope.rs:546:37
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
i should also mention this is the first time i've tried using the rust language server in emacs. was using vscode until now which works fine for me.
also, my journal.beancount
is over 40k lines in case that matters
I hade a similar issue in NeoVim 0.8 when opening my "journal.beancount" I get:
[ERROR][2022-09-24 09:55:21] .../vim/lsp/rpc.lua:734 "rpc" "beancount-language-server" "stderr" "thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error(\"missing field `journal_file`\", line: 0, column: 0)', /home/alexanderp/.cargo/registry/src/github.com-1ecc6299db9ec823/beancount-language-server-1.2.5/src/server.rs:71:42\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n"
Thanks for the report, need to find time to get to the bottom of this report
Can confirm I'm also getting this issue, tried different variations of the journal file option but nothing seems to work, more logs here: https://gist.github.com/Philogy/6253e5a81ae8eb0cef9c9bf6f68a954c. I also get the missing field 'journal_file'
error
Same here. LSP doesn't provide autocomplete
[ERROR][2023-09-11 18:06:48] .../vim/lsp/rpc.lua:734 "rpc" "/Users/op/.local/share/nvim/mason/bin/beancount-language-server" "stderr" "thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ()', "
[ERROR][2023-09-11 18:06:48] .../vim/lsp/rpc.lua:734 "rpc" "/Users/op/.local/share/nvim/mason/bin/beancount-language-server" "stderr" "/Users/op/.cargo/registry/src/index.crates.io-6f17d22bba15001f/beancount-language-server-1.3.1/src/server.rs:122:91\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n"
[ERROR][2023-09-11 18:06:48] .../vim/lsp/rpc.lua:734 "rpc" "/Users/op/.local/share/nvim/mason/bin/beancount-language-server" "stderr" "thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: \"SendError(..)\"', /Users/op/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lsp-server-0.6.0/src/stdio.rs:"
[ERROR][2023-09-11 18:06:48] .../vim/lsp/rpc.lua:734 "rpc" "/Users/op/.local/share/nvim/mason/bin/beancount-language-server" "stderr" "29:37\n"
Same/similar error when using with Neovim
"thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ()', /home/ian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/beancount-language-server-1.3.1/src/server.rs:122:91\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n"
Beancount LSP will load without the init_options = { journal_file = "<insert beancount main.beancount entry file>"}
and highlight beancount errors because I have my accounts in a separate beancount file and included in the main.beancount. Add in the init_options, and it panics.
Neovim config is here: Neovim-Config
I hope the above info helps, and thanks for the LSP.
pushed a new release with some extra debugging (v1.3.3), report back errors
It is erroring when I try to create a path buffer of the journal file passed in through LSP init options.
Could you make sure the path is correct and exists?
The new release has resolved the error for me.
Thanks, Polarmutex.
Sorry, I have been running that release for a bit. Thought I had those changes in main. Let me know any features you might find helpful. Probably going to try improve completion when I get time.
Awesome.
For me, code folding around levels of comments (ie. *, **, ***) would be helpful.
I have it on my list to explore if Treesitter can do it through your Treesitter plugin
think all is resolved, please reopen if there is still an issue