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
50.08k stars 3.07k forks source link

Cmd + Click on function name or path not working anymore #17062

Closed matthprost closed 2 months ago

matthprost commented 2 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Hello!

I'm using Zed for Typescript project. When I do Cmd + Click on a function it used to bring me to the declaration of the function on the view, same for when you do it on paths. Since recent updates it seems that it doesn't work anymore and I can't find why.

I tried to remove my nodes_modules, reinstall Zed, restart multiple times language server and check typescript server logs nothing seems to change.

Environment

Zed: v0.150.4 (Zed) OS: macOS 14.5.0 Memory: 16 GiB Architecture: aarch64

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

settings.json

{
  "assistant": {
    "default_model": {
      "provider": "copilot_chat",
      "model": "gpt-4o"
    },
    "version": "2"
  },
  "theme": "Ayu Dark",
  "ui_font_size": 16,
  "autosave": "on_focus_change",
  "format_on_save": "on",
  "file_scan_exclusions": [
    "**/.svn",
    "**/.hg",
    "**/CVS",
    "**/.DS_Store",
    "**/Thumbs.db",
    "**/.classpath",
    "coverage/",
    "**/storybook-static",
    "**/pnpm-lock.yaml",
    "**/CHANGELOG.md",
    "**/*.snap",
    "**/__snapshots__/",
    "**/fr.ts"
  ],
  "formatter": "language_server",
  "buffer_font_size": 14,
  "terminal": {
    "font_size": 12
  },
  "code_actions_on_format": {
     "source.fixAll": true,
   },
  "lsp": {
    "typescript-language-server": {
      "initialization_options": {
        "maxTsServerMemory": 2048
      }
    }
  },
  "formatter": {
    "external": {
      "command": "./node_modules/@biomejs/biome/bin/biome",
      "arguments": ["format", "--write", "--stdin-file-path", "{buffer_path}"]
    }
  },
  "language_servers": [
    "!prettier",
    "eslint",
    "biome",
    "typescript-language-server",
    "!vtsls",
    "!tailwindcss-language-server",
    "json-language-server"
  ]
}

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

No response

SomeoneToIgnore commented 2 months ago

Can you try and change the order of the language_servers so that typescript-language-server is the first one? Zed determines a "primary" language server it queries for certain actions, and that primary server is the first in the servers list.

matthprost commented 2 months ago

@SomeoneToIgnore Oh wow nice catch! It seems to work now with the following config:

"language_servers": [
    "typescript-language-server",
    "!prettier",
    "eslint",
    "biome",
    "!vtsls",
    "!tailwindcss-language-server",
    "json-language-server"
  ]

Thanks a lot! Strange that it used to work before, but I'm happy to know that the order is quite important.

I will close the issue.

SomeoneToIgnore commented 2 months ago

Good that it fixed your case.

It was changed recently and I think it should be improved further (as there might be many other people with the same issue), but we have what we have for now.