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
47.91k stars 2.81k forks source link

language support for python, shell, ruby #6355

Closed ghost closed 11 months ago

ghost commented 11 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

hallo all, I am new to zed and want to use mainly for these languages and trying to install the language server for the python, shell and ruby. However the autocompletion or the suggestion are not getting enabled. Any idea on how to start the lsp in the zed.

macos Ventura RAM 8GB Hard disk 121.02 GB

Environment

macos Ventura RAM 8GB Hard disk 121.02 GB

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.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

2023-11-01T02:41:32 [INFO] ========== starting zed ========== 2023-11-01T02:41:32 [INFO] Opening main db 2023-11-01T02:41:33 [INFO] Opening main db 2023-11-01T02:41:35 [INFO] set environment variables from shell:/bin/zsh, path:/Users/gauravsablok/.cache/oh-my-zsh/bin:/Users/gauravsablok/.rbenv/shims:/Users/gauravsablok/miniconda3/bin:/Users/gauravsablok/miniconda3/condabin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/gauravsablok/.cargo/bin:/Users/gauravsablok/.local/bin:/Users/gauravsablok/.erg/bin:/Users/gauravsablok/.rvm/bin 2023-11-01T02:41:40 [INFO] Node runtime install_if_needed 2023-11-01T02:42:16 [INFO] 0 unhandled notification LogMessage: { "level": 0, "message": "[DEBUG] [agent] [2023-11-01T02:42:16.411Z] Agent service starting", "metadataStr": "[DEBUG] [agent] [2023-11-01T02:42:16.411Z]", "extra": [ "Agent service starting" ] } 2023-11-01T02:42:16 [INFO] 0 unhandled notification client/registerCapability: { "registrations": [ { "id": "bcdb6896-ed4e-4b63-ac6e-f960f742b9a6", "method": "workspace/didChangeWorkspaceFolders", "registerOptions": {} } ] } 2023-11-01T02:42:16 [INFO] 0 unhandled notification LogMessage: { "level": 0, "message": "[DEBUG] [agent] [2023-11-01T02:42:16.462Z] Telemetry initialized", "metadataStr": "[DEBUG] [agent] [2023-11-01T02:42:16.462Z]", "extra": [ "Telemetry initialized" ] } 2023-11-01T02:42:40 [INFO] Opening main db 2023-11-01T02:42:40 [INFO] starting language server "pyright", path: "/Users/gauravsablok/Desktop/zed.py", id: 1 2023-11-01T02:42:40 [INFO] Node runtime install_if_needed 2023-11-01T02:43:00 [INFO] Node runtime install_if_needed 2023-11-01T02:43:07 [INFO] Node runtime install_if_needed 2023-11-01T02:43:08 [INFO] 1 unhandled notification window/logMessage: { "type": 3, "message": "Pyright language server 1.1.333 starting" } 2023-11-01T02:43:08 [INFO] 1 unhandled notification window/logMessage: { "type": 3, "message": "Server root directory: /Users/gauravsablok/Library/Application Support/Zed/languages/pyright/node_modules/pyright/dist" } 2023-11-01T02:43:08 [INFO] 1 unhandled notification window/logMessage: { "type": 3, "message": "Starting service instance \"\"" } 2023-11-01T02:43:09 [INFO] 1 unhandled notification client/unregisterCapability: { "unregisterations": [ { "id": "51431604-59b6-4e83-852a-123699131a9a", "method": "workspace/didChangeWatchedFiles" } ] } 2023-11-01T02:43:59 [ERROR] oneshot canceled 2023-11-01T02:44:02 [ERROR] oneshot canceled 2023-11-01T02:44:03 [INFO] ========== starting zed ========== 2023-11-01T02:44:03 [INFO] Opening main db 2023-11-01T02:44:04 [INFO] Opening main db 2023-11-01T02:44:05 [INFO] set environment variables from shell:/bin/zsh, path:/Users/gauravsablok/.cache/oh-my-zsh/bin:/Users/gauravsablok/.rbenv/shims:/Users/gauravsablok/miniconda3/bin:/Users/gauravsablok/miniconda3/condabin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/gauravsablok/.cargo/bin:/Users/gauravsablok/.local/bin:/Users/gauravsablok/.erg/bin:/Users/gauravsablok/.rvm/bin 2023-11-01T02:44:13 [INFO] Opening main db 2023-11-01T02:44:13 [INFO] starting language server "pyright", path: "/Users/gauravsablok/Desktop/zed.py", id: 1 2023-11-01T02:44:13 [INFO] Node runtime install_if_needed 2023-11-01T02:44:15 [WARN] request completed with error: request or operation took longer than the configured timeout time 2023-11-01T02:44:15 [ERROR] crates/copilot/src/copilot.rs:958: error fetching latest release

Caused by: 0: request or operation took longer than the configured timeout time 1: [28] Timeout was reached 2023-11-01T02:44:15 [INFO] Node runtime install_if_needed 2023-11-01T02:44:16 [INFO] Node runtime install_if_needed 2023-11-01T02:44:18 [INFO] 1 unhandled notification window/logMessage: { "type": 3, "message": "Pyright language server 1.1.333 starting" } 2023-11-01T02:44:18 [INFO] 1 unhandled notification window/logMessage: { "type": 3, "message": "Server root directory: /Users/gauravsablok/Library/Application Support/Zed/languages/pyright/node_modules/pyright/dist" } 2023-11-01T02:44:18 [INFO] 1 unhandled notification window/logMessage: { "type": 3, "message": "Starting service instance \"\"" } 2023-11-01T02:44:18 [INFO] 0 unhandled notification LogMessage: { "level": 0, "message": "[DEBUG] [agent] [2023-11-01T02:44:18.173Z] Agent service starting", "metadataStr": "[DEBUG] [agent] [2023-11-01T02:44:18.173Z]", "extra": [ "Agent service starting" ] } 2023-11-01T02:44:18 [INFO] 0 unhandled notification client/registerCapability: { "registrations": [ { "id": "623507f9-3200-4e63-9229-d126cb06587c", "method": "workspace/didChangeWorkspaceFolders", "registerOptions": {} } ] } 2023-11-01T02:44:18 [INFO] 0 unhandled notification LogMessage: { "level": 0, "message": "[DEBUG] [agent] [2023-11-01T02:44:18.201Z] Telemetry initialized", "metadataStr": "[DEBUG] [agent] [2023-11-01T02:44:18.201Z]", "extra": [ "Telemetry initialized" ] } 2023-11-01T02:44:18 [INFO] 1 unhandled notification client/unregisterCapability: { "unregisterations": [ { "id": "edbe4010-d6d1-4014-b122-e804fbc5ebc0", "method": "workspace/didChangeWatchedFiles" } ] } 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:46:32 [INFO] completion out of expected range 2023-11-01T02:47:05 [ERROR] oneshot canceled 2023-11-01T02:47:14 [ERROR] crates/semantic_index/src/semantic_index.rs:80: user is not authenticated 2023-11-01T02:52:46 [INFO] open paths ["/Users/gauravsablok/.config/zed/settings.json"] 2023-11-01T02:52:46 [INFO] starting language server "json-language-server", path: "/Users/gauravsablok/.config/zed/settings.json", id: 2 2023-11-01T02:52:46 [INFO] Node runtime install_if_needed 2023-11-01T02:52:46 [INFO] Node runtime install_if_needed 2023-11-01T02:52:55 [INFO] Node runtime install_if_needed 2023-11-01T02:52:55 [INFO] Fetching default prettier and plugins: [("prettier", "3.0.3")] 2023-11-01T02:52:55 [INFO] Node runtime install_if_needed 2023-11-01T02:53:03 [INFO] Found prettier in "/Users/gauravsablok/Library/Application Support/Zed/prettier", starting. 2023-11-01T02:53:03 [INFO] Node runtime install_if_needed 2023-11-01T02:53:04 [INFO] Started prettier in "/Users/gauravsablok/Library/Application Support/Zed/prettier" 2023-11-01T02:53:04 [WARN] failed to deserialize LSP message: {"jsonrpc":"2.0","error":{"code":-32600,"message":"error during message handling: Error: Message id is undefined: {\"jsonrpc\":\"2.0\",\"method\":\"initialized\",\"params\":{}}"}} 2023-11-01T02:53:09 [ERROR] unexpected item event after pane was dropped 2023-11-01T02:53:14 [INFO] open paths ["/Users/gauravsablok/.config/zed/settings.json"] 2023-11-01T02:53:14 [INFO] starting language server "json-language-server", path: "/Users/gauravsablok/.config/zed/settings.json", id: 4 2023-11-01T02:53:14 [INFO] Node runtime install_if_needed 2023-11-01T02:53:20 [ERROR] unexpected item event after pane was dropped 2023-11-01T02:53:23 [INFO] Fetching default prettier and plugins: [("prettier", "3.0.3")] 2023-11-01T02:53:23 [INFO] Node runtime install_if_needed 2023-11-01T02:53:31 [INFO] Found prettier in "/Users/gauravsablok/Library/Application Support/Zed/prettier", starting. 2023-11-01T02:53:31 [INFO] Node runtime install_if_needed 2023-11-01T02:53:31 [INFO] Node runtime install_if_needed 2023-11-01T02:53:32 [INFO] Started prettier in "/Users/gauravsablok/Library/Application Support/Zed/prettier" 2023-11-01T02:53:32 [WARN] failed to deserialize LSP message: {"jsonrpc":"2.0","error":{"code":-32600,"message":"error during message handling: Error: Message id is undefined: {\"jsonrpc\":\"2.0\",\"method\":\"initialized\",\"params\":{}}"}} 2023-11-01T02:53:39 [INFO] Fetching default prettier and plugins: [("prettier", "3.0.3")] 2023-11-01T02:53:39 [INFO] Node runtime install_if_needed 2023-11-01T02:53:46 [INFO] Node runtime install_if_needed 2023-11-01T02:53:56 [ERROR] unexpected item event after pane was dropped 2023-11-01T02:53:59 [ERROR] oneshot canceled 2023-11-01T02:53:59 [ERROR] oneshot canceled 2023-11-01T02:53:59 [ERROR] oneshot canceled 2023-11-01T02:53:59 [ERROR] oneshot canceled 2023-11-01T02:55:33 [ERROR] crates/semantic_index/src/semantic_index.rs:80: user is not authenticated 2023-11-01T02:55:39 [INFO] open paths ["/Users/gauravsablok/.config/zed/settings.json"] 2023-11-01T02:55:39 [INFO] starting language server "json-language-server", path: "/Users/gauravsablok/.config/zed/settings.json", id: 6 2023-11-01T02:55:39 [INFO] Node runtime install_if_needed 2023-11-01T02:55:42 [ERROR] unexpected item event after pane was dropped 2023-11-01T02:55:48 [INFO] Fetching default prettier and plugins: [("prettier", "3.0.3")] 2023-11-01T02:55:48 [INFO] Node runtime install_if_needed 2023-11-01T02:55:56 [INFO] Found prettier in "/Users/gauravsablok/Library/Application Support/Zed/prettier", starting. 2023-11-01T02:55:56 [INFO] Node runtime install_if_needed 2023-11-01T02:55:56 [ERROR] oneshot canceled

JosephTLyons commented 11 months ago

Hey @sablokgaurav, were you able to get completions working within Zed for those given languages?

ghost commented 11 months ago

@JosephTLyons no i was not able to do it. So i uninstalled zed as thought i will not get a reply. If you can tell me how to do it then will install and use zed.

JosephTLyons commented 11 months ago

For shell / bash files, you won't have any sort of language server support, as we don't have any language server built in for it, but you should still have syntax highligthing.


For Python, we are using Pyright, which can be finicky at times. You need to provide it a configuration file to inform it of your .venv. If you are putting your .venv in the root of your project, and opening zed at the project root, you'd need to place a pyrightconfig.json file at the root of your project as well:

{
  "venvPath": ".",
  "venv": ".venv"
}

After adding your config file, the workspace might need to be restarted, so that pyright restarts and picks it up, but it might not (people have had varying experiences here).

The docs here sort of cover it. Setting up Zed to work in Python.

I hope that in the future, we can move away from Pyright and to some other language server (hoping that Astral.sh builds a competitve language server to VS Code's proprietary Pylance, or that Pylyzer matures to the point that we can use it, but at the moment, we are sort of stuck with pyright.


Its hard to tell for Ruby why you might not have had any completions, as I'm not a Ruby dev, but we could probably figure it out.

ghost commented 11 months ago

@JosephTLyons thank you for the support and sending me these detailed instructions. I did try for the python but it didnt worked out and i didnt gave shell and ruby a chance. I will see if i need to work on this but i appreciate the response and will let you know if i can do something.