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
48.98k stars 2.95k forks source link

ruby solargraph is not starting with asdf installation #18734

Open LeandroRezendeCoutinho opened 3 weeks ago

LeandroRezendeCoutinho commented 3 weeks ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Default configuration.

"languages": {
    "Ruby": {
      "language_servers": ["ruby-lsp", "solargraph", "rubocop", "..."]
    }
  },
  "lsp": {
    "ruby-lsp": {
      "initialization_options": {
        "enabledFeatures": {
          "diagnostics": false
        }
      }
    },
    "solargraph": {
      "initialization_options": {
        "diagnostics": true,
        "formatting": true      
    },
    "rubocop": {
      "initialization_options": {
        "safeAutocorrect": false
      }
    }
  }

Alternative configuration informing solargraph path.

"languages": {
    "Ruby": {
      "language_servers": ["ruby-lsp", "solargraph", "rubocop", "..."]
    }
  },
  "lsp": {
    "ruby-lsp": {
      "initialization_options": {
        "enabledFeatures": {
          "diagnostics": false
        }
      }
    },
    "solargraph": {
      "initialization_options": {
        "diagnostics": true,
        "formatting": true
      },
      "binary": {
        "path": "/home/leandro/.asdf/shims/solargraph"
      }
    },
    "rubocop": {
      "initialization_options": {
        "safeAutocorrect": false
      }
    }
  }

Restart lsp has no effect. Tested in projects with ruby-lps together and projects with only solargraph. Both dont work. ruby-lps in working fine.

Environment

Ubuntu 24.04 Ruby 2.5.9 asdf Ruby 3.3.0 asdf

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

No response

If applicable, attach your Zed.log file to this issue.

Zed.log

2024-10-04T10:12:32.252786436-03:00 [INFO] stopping language server ruby-lsp
2024-10-04T10:12:32.252902854-03:00 [INFO] stopping language server solargraph
2024-10-04T10:12:32.252941311-03:00 [INFO] stopping language server rubocop
2024-10-04T10:31:34.083651598-03:00 [INFO] open paths ["/home/leandro/.config/zed/settings.json"]
2024-10-04T10:31:34.093757092-03:00 [INFO] attempting to start language server "json-language-server", path: "/home/leandro/.config/zed/settings.json", id: 16
2024-10-04T10:31:34.093803779-03:00 [INFO] Initializing default prettier with plugins {}
2024-10-04T10:31:34.094047222-03:00 [INFO] Initializing default prettier with plugins {}
2024-10-04T10:31:34.094069783-03:00 [INFO] Initializing default prettier with plugins {}
2024-10-04T10:31:34.094508458-03:00 [INFO] fetching latest version of language server "json-language-server"
2024-10-04T10:31:34.113053806-03:00 [WARN] request completed with error: failed to connect to the server
2024-10-04T10:31:35.75377288-03:00 [INFO] downloading language server "json-language-server"
2024-10-04T10:31:36.400695803-03:00 [INFO] using project environment for language server "json-language-server", id: 16
2024-10-04T10:31:36.400773412-03:00 [INFO] starting language server process. binary path: "/home/leandro/.asdf/shims/node", working directory: "/home/leandro/.config/zed", args: ["/home/leandro/.local/share/zed/languages/json-language-server/node_modules/vscode-langservers-extracted/bin/vscode-json-language-server", "--stdio"]
vitallium commented 3 weeks ago

Probably changes in this pull requests https://github.com/zed-industries/zed/pull/18318 are related.

The current behaviour is that any manual override of the binary path for a lsp won't be passed to an extension here.

@LeandroRezendeCoutinho the workaround is to specify the arguments for the Solargraph LSP, like this:

"solargraph": {
  "initialization_options": {
    "diagnostics": true,
    "formatting": true
  },
  "binary": {
    "path": "/home/leandro/.asdf/shims/solargraph",
    "arguments: ["stdio"]
  }
}