oxalica / nil

NIx Language server, an incremental analysis assistant for writing in Nix.
Apache License 2.0
1.28k stars 39 forks source link

Crash when creating new files in the workspace #138

Closed joinemm closed 3 months ago

joinemm commented 3 months ago

When I create a new file into the workspace using a file manager plugin like chadtree, the LSP server crashes with this error message:

[ERROR][2024-05-09 14:23:17] .../vim/lsp/rpc.lua:734    "rpc"   "/nix/store/qz7jzxmwsv9xfxqsx03rmbdc4blhrhz2-nil-2023-08-09/bin/nil"    
"stderr"        "2024-05-09T11:23:17.089356Z ERROR nil: Unexpected error: Unhandled notification: workspace/didCreateFiles\n"

Using nixvim with config:

lsp.servers = {
  nil_ls = {
    enable = true;
    settings.formatting.command = ["alejandra"];
  };
};
oxalica commented 3 months ago

"stderr" "2024-05-09T11:23:17.089356Z ERROR nil: Unexpected error: Unhandled notification: workspace/didCreateFiles\n"

According to the LSP 3.17 specification, client sends workspace/didCreateFiles only when the server announced the capability workspace.fileOperations.didCreate. We do not announce that.

I'd blame the LSP client implementation here.