polarmutex / beancount-language-server

A Language Server Protocol (LSP) for beancount files
MIT License
145 stars 18 forks source link

nvim-lspconfig and beancount-language-server #356

Closed M1Sports20 closed 1 year ago

M1Sports20 commented 1 year ago

It seems the default options in nvim-lspconfig doesn't work with the latest beancount-lsp.

The latest version of beancount-lsp has argument --stdio The nvim-lspconfig doesn't provide an argument to --stdio resulting in the following error: [ERROR][2023-03-25 15:41:44] .../vim/lsp/rpc.lua:733 "rpc" "beancount-language-server" "stderr" "error: a value is required for '--stdio ' but none was supplied\n\nFor more information, try '--help'.\n"

I of course can also override the default cmd provided by nvim-lspconfig, but I dont' know what is expected as an argument here.

onemoresuza commented 1 year ago

Same error here:

[START][2023-03-29 06:45:57] LSP logging initiated [ERROR][2023-03-29 06:45:57] .../vim/lsp/rpc.lua:734 "rpc" "beancount-language-server" "stderr" "error: a value is required for '--stdio ' but none was supplied\n\nFor more information, try '--help'.\n"

The used configuration is:

require("lspconfig").beancount.setup({
   init_options = {
      journal_file = "/path/to/real/journal/file",
   }
})
polarmutex commented 1 year ago

interesting, I will try to look at it tonight

DId this just happen recently? I did push an update in the last week or so

M1Sports20 commented 1 year ago

Yes it happened when I upgraded to the latest version.

peterhoeg commented 1 year ago

I've seen the same thing with emacs. The workaround is just to pass any garbage argument after --stdio when launching beancount-ls.

kmac commented 1 year ago

Thanks @peterhoeg , I'm working around this with these custom options:

   beancount = {
      cmd = { "beancount-language-server", "--stdio", "asdf" },
      init_options = {
        journal_file = "<path to my beancount file>",
      },
    },
polarmutex commented 1 year ago

should be fixed with v1.3.1 I did yesterday, sorry i missed this one

peterhoeg commented 1 year ago

I can confirm that works.

polarmutex commented 1 year ago

closing, if this is still an issue please reopen issue

duarteocarmo commented 1 year ago

@polarmutex - where's this v1.3.1? I could not find that version. I'm getting this same error for v1.3.0

Solution:

require('lspconfig').beancount.setup {
  cmd = { "beancount-language-server", "--stdio", "something" },
  init_options = {
    journal_file = "/path/to/beancount/file",
  };
};
polarmutex commented 1 year ago

should be able to find it on the releases page or pull from crates.io. i am not sure how you install lsp servers on your machine.

duarteocarmo commented 1 year ago

You mean here? The latest version is v1.3.0

I just do cargo install xxxxxx

peterhoeg commented 1 year ago

https://github.com/polarmutex/beancount-language-server/releases

duarteocarmo commented 1 year ago

Ah ok - you guys install straight from github! Thanks @peterhoeg

peterhoeg commented 1 year ago

you guys install straight from github!

No, my distribution carries it: https://github.com/NixOS/nixpkgs/commit/98d2146331f49640ebb3e852e78cca0aa023e020

I haven’t installed anything directly from GH in years.

duarteocarmo commented 1 year ago

God damnit, I need to get into nix I see 😆 Thanks ahah

polarmutex commented 1 year ago

guess i missed uploading 1.3.1 to crates.io, should be there now