beancount-language-server icon indicating copy to clipboard operation
beancount-language-server copied to clipboard

lsp crashing

Open dustinfarris opened this issue 3 years ago • 4 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

dustinfarris avatar Jul 25 '22 13:07 dustinfarris

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?

polarmutex avatar Jul 25 '22 20:07 polarmutex

  1. start up emacs (i use doom)
  2. open my journal.beancount file
  3. 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

dustinfarris avatar Jul 25 '22 21:07 dustinfarris

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.

dustinfarris avatar Jul 25 '22 21:07 dustinfarris

also, my journal.beancount is over 40k lines in case that matters

dustinfarris avatar Jul 25 '22 23:07 dustinfarris

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"

owodunni avatar Sep 24 '22 07:09 owodunni

Thanks for the report, need to find time to get to the bottom of this report

polarmutex avatar Sep 26 '22 03:09 polarmutex

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

Philogy avatar Nov 17 '22 14:11 Philogy

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"

0ptimista avatar Sep 11 '23 10:09 0ptimista

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.

IanTeda avatar Oct 05 '23 00:10 IanTeda

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?

polarmutex avatar Oct 08 '23 15:10 polarmutex

The new release has resolved the error for me.

Thanks, Polarmutex.

IanTeda avatar Oct 08 '23 22:10 IanTeda

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.

polarmutex avatar Oct 08 '23 23:10 polarmutex

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

IanTeda avatar Oct 09 '23 03:10 IanTeda

think all is resolved, please reopen if there is still an issue

polarmutex avatar Oct 14 '23 04:10 polarmutex