elixir: Check for next-ls and lexical in path first (#11318)

Since it's not longer possible to setup a local elixir LSP, @maxdeviant
proposed to look for `next-ls` and `lexical` in path first, just like
it's already done for `elixir_ls`.

For context take a look at #11297 (starting from [this
comment](https://github.com/zed-industries/zed/issues/11297#issuecomment-2091095537)).

Release Notes:

- N/A
This commit is contained in:
Andrei Zvonimir Crnković 2024-05-03 17:03:25 +02:00 committed by GitHub
parent 55555bb41f
commit b3d969ef3c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View file

@ -20,8 +20,12 @@ impl Lexical {
pub fn language_server_binary_path( pub fn language_server_binary_path(
&mut self, &mut self,
language_server_id: &LanguageServerId, language_server_id: &LanguageServerId,
_worktree: &zed::Worktree, worktree: &zed::Worktree,
) -> Result<String> { ) -> Result<String> {
if let Some(path) = worktree.which("lexical") {
return Ok(path);
}
if let Some(path) = &self.cached_binary_path { if let Some(path) = &self.cached_binary_path {
if fs::metadata(path).map_or(false, |stat| stat.is_file()) { if fs::metadata(path).map_or(false, |stat| stat.is_file()) {
return Ok(path.clone()); return Ok(path.clone());

View file

@ -20,8 +20,12 @@ impl NextLs {
pub fn language_server_binary_path( pub fn language_server_binary_path(
&mut self, &mut self,
language_server_id: &LanguageServerId, language_server_id: &LanguageServerId,
_worktree: &zed::Worktree, worktree: &zed::Worktree,
) -> Result<String> { ) -> Result<String> {
if let Some(path) = worktree.which("next-ls") {
return Ok(path);
}
if let Some(path) = &self.cached_binary_path { if let Some(path) = &self.cached_binary_path {
if fs::metadata(path).map_or(false, |stat| stat.is_file()) { if fs::metadata(path).map_or(false, |stat| stat.is_file()) {
return Ok(path.clone()); return Ok(path.clone());