zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
46.59k stars 2.64k forks source link

Zed ignoring Elixir LSP config #11610

Open LeakyBucket opened 4 months ago

LeakyBucket commented 4 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

After updating to the most recent version (it might have been two releases ago). Zed refuses to use any LSP for Elixir other than elixir-ls.

I have tried several different configurations to no avail:

"elixir": {
  "lsp": "lexical"
}

"elixir": {
  "language_servers": ["lexical", "!elixir-ls"]
}

"elixir": {
  "lsp": {
    "local": {
      "path": "path/to/my/lexical/install",
      "arguments": [""]
    }
  }
}

I've also tried multiple permutations of the above configurations combined. Nothing I do can stop Zed from using elixir-ls :(

Environment

Zed: v0.134.3 (Zed) OS: macOS 14.4.1 Memory: 64 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

2024-05-09T07:05:02-06:00 [INFO] starting language servers for Elixir: elixir-ls 2024-05-09T07:05:02-06:00 [INFO] starting language server "elixir-ls", path: "/Users/leakybucket/code/", id: 4 2024-05-09T07:05:02-06:00 [INFO] starting language servers for Elixir: elixir-ls 2024-05-09T07:05:02-06:00 [INFO] starting language servers for Elixir: elixir-ls 2024-05-09T07:05:02-06:00 [INFO] starting language servers for Elixir: elixir-ls 2024-05-09T07:05:02-06:00 [INFO] Initializing default prettier with plugins {} 2024-05-09T07:05:02-06:00 [INFO] starting language servers for Elixir: elixir-ls 2024-05-09T07:05:02-06:00 [INFO] starting language servers for Elixir: elixir-ls 2024-05-09T07:05:02-06:00 [INFO] starting language servers for Elixir: elixir-ls 2024-05-09T07:05:02-06:00 [INFO] starting language servers for Elixir: elixir-ls 2024-05-09T07:05:02-06:00 [INFO] starting language servers for JavaScript: typescript-language-server, tailwindcss-language-server, eslint 2024-05-09T07:05:02-06:00 [INFO] Initializing default prettier with plugins {} 2024-05-09T07:05:02-06:00 [INFO] starting language servers for Elixir: elixir-ls 2024-05-09T07:05:02-06:00 [INFO] starting language servers for Elixir: elixir-ls 2024-05-09T07:05:02-06:00 [INFO] starting language servers for Elixir: elixir-ls 2024-05-09T07:05:02-06:00 [INFO] starting language servers for Elixir: elixir-ls 2024-05-09T07:05:02-06:00 [INFO] starting language servers for JavaScript: typescript-language-server, tailwindcss-language-server, eslint 2024-05-09T07:05:02-06:00 [INFO] add connection to peer 2024-05-09T07:05:02-06:00 [INFO] add_connection; 2024-05-09T07:05:02-06:00 [INFO] waiting for server hello 2024-05-09T07:05:02-06:00 [INFO] got server hello 2024-05-09T07:05:02-06:00 [INFO] set status to connected (connection id: ConnectionId { owner_id: 0, id: 0 }, peer id: PeerId { owner_id: 402, id: 2778664 }) 2024-05-09T07:05:02-06:00 [INFO] set status on client 60912: Connected { peer_id: PeerId { owner_id: 402, id: 2778664 }, connection_id: ConnectionId { owner_id: 0, id: 0 } } 2024-05-09T07:05:03-06:00 [INFO] starting language server. binary path: "/Users/leakybucket/Library/Application Support/Zed/extensions/work/elixir/elixir-ls-v0.21.1/language_server.sh", working directory: "/Users/leakybucket/code/", args: []

maxdeviant commented 4 months ago

Does this work for you?

{
  "languages": {
    "Elixir": {
      "language_servers": ["lexical", "!elixir-ls", "!next-ls", "..."]
    }
  }
}
LeakyBucket commented 4 months ago
"language_servers": ["lexical", "!elixir-ls", "!next-ls", "..."]

Nope, I still get ElixirLS

Screenshot 2024-05-09 at 9 56 51 AM
maxdeviant commented 4 months ago
"language_servers": ["lexical", "!elixir-ls", "!next-ls", "..."]

Nope, I still get ElixirLS

Screenshot 2024-05-09 at 9 56 51 AM

Would you mind sharing your entire settings file?

LeakyBucket commented 4 months ago

Not at all:

{
  "project_panel": {
    "dock": "right"
  },
  "chat_panel": {
    "button": false
  },
  "terminal": {
    "dock": "left"
  },
  "buffer_font_size": 15,
  "vim_mode": true,
  "git": {
    "git_gutter": "tracked_files"
  },
  "features": { "copilot": false },
  "show_copilot_suggestions": false,
  "elixir": {
    "language_servers": ["lexical", "!elixir-ls", "!next-ls", "..."]
    //"lsp": {
    //  "local": {
    //    "path": "/Users/leakybucket/code/lexical/_build/dev/package/lexical/bin/start_lexical.sh",
    //    "arguments": [""]
    //  }
    //}
  },
  "assistant": {
    "version": "1",
    "button": false
  }
}
LeakyBucket commented 4 months ago

Ah, and now I see it. My old config structure was no longer valid. I must have overlooked that in recent release notes.

maxdeviant commented 4 months ago

@LeakyBucket Yea, the language_servers setting is under languages.Elixir:

{
  "project_panel": {
    "dock": "right"
  },
  "chat_panel": {
    "button": false
  },
  "terminal": {
    "dock": "left"
  },
  "buffer_font_size": 15,
  "vim_mode": true,
  "git": {
    "git_gutter": "tracked_files"
  },
  "features": { "copilot": false },
  "show_copilot_suggestions": false,
+ "languages": {
+   "Elixir": {
+     "language_servers": ["lexical", "!elixir-ls", "!next-ls", "..."]
+   }
+ }
- "elixir": {
-   "language_servers": ["lexical", "!elixir-ls", "!next-ls", "..."]
-   //"lsp": {
-   //  "local": {
-   //    "path": "/Users/leakybucket/code/lexical/_build/dev/package/lexical/bin/start_lexical.sh",
-   //    "arguments": [""]
-   //  }
-   //}
- },
  "assistant": {
    "version": "1",
    "button": false
  }
}
LeakyBucket commented 4 months ago

I don't see anything in the docs about the change either: https://zed.dev/docs/languages/elixir

At any rate, thanks a bunch @maxdeviant for taking the time to struggle bus me through it!

LeakyBucket commented 4 months ago

In the end I just needed to update my settings structure.

zoedsoupe commented 3 months ago

hey, I'm having the same issue where zed stills trying to use elixir-ls, but I'm not being able to find where I'm defining my configuration wrongly. The full config is:

{
  "autosave": "on_focus_change",
  "buffer_font_family": "Dank Mono",
  "buffer_font_features": {
    "calt": true,
    "dlig": true,
    "ss01": true,
    "ss02": true,
    "ss03": true,
    "ss04": true,
    "ss05": true,
    "ss06": true,
    "ss07": true,
    "ss08": true
  },
  "buffer_font_size": 17,
  "copilot": { "disabled_globs": [".env"] },
  "file_types": { "CSS": ["scss", "css"] },
  "language_overrides": {
    "Elixir": {
      "format_on_save": {
        "external": {
          "arguments": ["format", "--stdin-filename", "{buffer_path}", "-"],
          "command": "/nix/store/ssm0332nmacy4vbvkvyp8hqw4fwrckzh-elixir-1.16.0/bin/mix"
        }
      }
    }
  },
  "languages": { "Elixir": { "language_servers": ["lexical", "next-ls"] } },
  "lsp": {
    "lexical": {
      "arguments": [],
      "path": "/nix/store/377hjqxyffsaldm27baaa0081q99idai-lexical-development/bin/lexical"
    },
    "next-ls": {
      "arguments": ["--stdio"],
      "initialization_options": {
        "experimental": { "completions": { "enable": true } },
        "extensions": { "credo": { "enable": false } }
      },
      "path": "/nix/store/b99qvq6lhxq0ci44sqaww7hl8l0spjl4-next-ls-0.21.3/bin/nextls"
    }
  },
  "preview_tabs": {
    "enable_preview_from_code_navigation": true,
    "enable_preview_from_file_finder": true,
    "enabled": true
  },
  "soft_wrap": "editor_width",
  "tab_bar": { "show": false },
  "theme": "One Dark",
  "vim_mode": true
}

I'm also using the latest release

maxdeviant commented 3 months ago

hey, I'm having the same issue where zed stills trying to use elixir-ls, but I'm not being able to find where I'm defining my configuration wrongly. The full config is:

{
  "autosave": "on_focus_change",
  "buffer_font_family": "Dank Mono",
  "buffer_font_features": {
    "calt": true,
    "dlig": true,
    "ss01": true,
    "ss02": true,
    "ss03": true,
    "ss04": true,
    "ss05": true,
    "ss06": true,
    "ss07": true,
    "ss08": true
  },
  "buffer_font_size": 17,
  "copilot": { "disabled_globs": [".env"] },
  "file_types": { "CSS": ["scss", "css"] },
  "language_overrides": {
    "Elixir": {
      "format_on_save": {
        "external": {
          "arguments": ["format", "--stdin-filename", "{buffer_path}", "-"],
          "command": "/nix/store/ssm0332nmacy4vbvkvyp8hqw4fwrckzh-elixir-1.16.0/bin/mix"
        }
      }
    }
  },
  "languages": { "Elixir": { "language_servers": ["lexical", "next-ls"] } },
  "lsp": {
    "lexical": {
      "arguments": [],
      "path": "/nix/store/377hjqxyffsaldm27baaa0081q99idai-lexical-development/bin/lexical"
    },
    "next-ls": {
      "arguments": ["--stdio"],
      "initialization_options": {
        "experimental": { "completions": { "enable": true } },
        "extensions": { "credo": { "enable": false } }
      },
      "path": "/nix/store/b99qvq6lhxq0ci44sqaww7hl8l0spjl4-next-ls-0.21.3/bin/nextls"
    }
  },
  "preview_tabs": {
    "enable_preview_from_code_navigation": true,
    "enable_preview_from_file_finder": true,
    "enabled": true
  },
  "soft_wrap": "editor_width",
  "tab_bar": { "show": false },
  "theme": "One Dark",
  "vim_mode": true
}

I'm also using the latest release

It looks like you have both languages and language_overrides present. language_overrides is an alias for languages, so they can't be used together.

What happens if you merge them both into languages?

zoedsoupe commented 3 months ago

okay, I was sure it was a user-error! yeah, it tries to use lexical, but it seems to be ignoring the lsp.lexical.path config, as it tries to download it.

LeakyBucket commented 3 months ago

I'm actually seeing it again. My config is as follows and I'm getting elixir-ls again...

{
  "project_panel": {
    "dock": "right"
  },
  "chat_panel": {
    "button": false
  },
  "terminal": {
    "dock": "left"
  },
  "buffer_font_size": 15,
  "vim_mode": true,
  "git": {
    "git_gutter": "tracked_files"
  },
  "features": { "copilot": false },
  "show_copilot_suggestions": false,
  "languages": {
    "Elixir": {
      "language_servers": ["lexical", "!elixir-ls", "!next-ls", "..."]
    }
  },
  "assistant": {
    "version": "1",
    "button": false
  }
}
maxdeviant commented 3 months ago

I'm actually seeing it again. My config is as follows and I'm getting elixir-ls again...

{
  "project_panel": {
    "dock": "right"
  },
  "chat_panel": {
    "button": false
  },
  "terminal": {
    "dock": "left"
  },
  "buffer_font_size": 15,
  "vim_mode": true,
  "git": {
    "git_gutter": "tracked_files"
  },
  "features": { "copilot": false },
  "show_copilot_suggestions": false,
  "languages": {
    "Elixir": {
      "language_servers": ["lexical", "!elixir-ls", "!next-ls", "..."]
    }
  },
  "assistant": {
    "version": "1",
    "button": false
  }
}

Are you using any other files that could be recognized as using elixir-ls? Like HEEx files?

LeakyBucket commented 3 months ago

Yes, I do have HEEx files in the project. Do I need a separate languages setting for HEEx?

LeakyBucket commented 3 months ago

Okay adding a languages config for HEEX seems to have stopped the generic ElixirLS stuff for now. Although I am still getting ElixirLS Dialyzer pings.

zoedsoupe commented 3 months ago

Yes, I do have HEEx files in the project. Do I need a separate languages setting for HEEx?

how did you set it up for heex/eex?

LeakyBucket commented 3 months ago

Yes, I do have HEEx files in the project. Do I need a separate languages setting for HEEx?

how did you set it up for heex/eex?

Verbosity 😂

"languages": {
    "Elixir": {
      "language_servers": ["lexical", "!elixir-ls", "!next-ls", "..."]
    },
    "HEEX": {
      "language_servers": ["lexical", "!elixir-ls", "!next-ls", "..."]
    }
  },
LeakyBucket commented 3 months ago

Okay adding a languages config for HEEX seems to have stopped the generic ElixirLS stuff for now. Although I am still getting ElixirLS Dialyzer pings.

Restarting the language server seems to have maybe silenced the Dialyzer stuff for now.