elixir-tools / elixir-tools.nvim

Neovim plugin for Elixir
MIT License
403 stars 30 forks source link

bug(credo-language-server): doesn't work if you open neovim outside of the directory that contains mix.lock #70

Closed mhanberg closed 1 year ago

mhanberg commented 1 year ago
          I see the same error message when opening an umbrella project.

I have credo in mix.exs under project/services/mix.exs. As I'm an nvim newbie, please advise if there's any additional information needed or if I should open another issue.

nvim 0.9.0
elixir-tools `43c2288`
LazyVim 2.11.0

:LspLog

[START][2023-04-24 10:09:22] LSP logging initiated
[ERROR][2023-04-24 10:09:22] .../vim/lsp/rpc.lua:734    "rpc"   "/home/yuri/.local/share/nvim/lazy/elixir-tools.nvim/lua/elixir/../../bin/credo-language-server"    "stderr"    "** (Code.LoadError) could not load /home/yuri/project/mix.lock. Reason: enoent\n    (elixir 1.14.4) lib/code.ex:1826: Code.find_file!/2\n    (elixir 1.14.4) lib/code.ex:1199: Code.eval_file/2\n    /home/yuri/.local/share/nvim/lazy/elixir-tools.nvim/bin/credo-language-server:5: (file)\n"
[WARN][2023-04-24 10:09:25] ...lsp/handlers.lua:537 'warning: Phoenix now requires you to explicitly list which engine to use\nfor Phoenix JSON encoding. We recommend everyone to upgrade to\nJason by setting in your config/config.exs:\n\n    config :phoenix, :json_library, Jason\n\nAnd then adding {:jason, "~> 1.0"} as a dependency.\n\nIf instead you would rather continue using Poison, then add to\nyour config/config.exs:\n\n    config :phoenix, :json_library, Poison\n\n  (phoenix 1.6.16) lib/phoenix.ex:56: Phoenix.start/2\n  (kernel 8.5.4) application_master.erl:293: :application_master.start_it_old/4\n'

Originally posted by @yuriploc in https://github.com/elixir-tools/elixir-tools.nvim/issues/67#issuecomment-1520148400

mhanberg commented 1 year ago

@yuriploc is this actually an umbrella project did you just open neovim in a parent directory?

yuriploc commented 1 year ago

@mhanberg I have a mono repo (.) with an umbrella app in services and another elixir app in web, my project directory looks like this:

.
├── doc
├── Makefile
├── OVERVIEW.md
├── package-lock.json
├── README.md
├── scripts
├── services          
│   ├── apps       
│   ├── assets       
│   ├── _build   
│   ├── config
│   ├── deps            
│   ├── docker-compose.yml                                                                                                                                                                                                                   
│   ├── log
│   ├── Makefile
│   ├── mix.exs
│   ├── mix.lock
│   ├── package-lock.json
│   ├── priv
│   ├── README.md
│   └── rel    
└── web

credo is in project/services/mix.exs.

mhanberg commented 1 year ago

I see, I think I know the change I'd need to make to get this to work.

Thanks for the report