zed icon indicating copy to clipboard operation
zed copied to clipboard

Not all typescript problems are found/visible in the problem panel

Open nym21 opened this issue 1 year ago • 7 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

The problem panel only show a certain amount of problems while the command tsc --noEmit --skipLibCheck will show all the problems found.

Environment

Maybe a way to specify a command for problems but I would expect the editor to automatically run tsc when in a Typescript project.

VSCode has for example a typescript.tsserver.experimental.enableProjectDiagnostics option. (https://github.com/microsoft/vscode/issues/13953)

While one solution would be to just run tsc in a terminal, it's not possible for now to split a terminal panel (in v.0.123.3) vertically and thus isn't practical to have to choose between having the server or the problems visible at any time.

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.

No response

nym21 avatar Feb 23 '24 10:02 nym21

It looks like https://github.com/zed-industries/zed/commit/2727f557723a77e41c3b6be308d8811e1febcaf7 fixed a bug wherein the initialization_options setting was not being respected for vtsls (the default TS language server).

Once that makes it into a release, it will be possible to turn this on in settings like:

"lsp": {
    "vtsls": {
      "initialization_options": {
        "typescript": {
          "tsserver": {
            "experimental": {
              "enableProjectDiagnostics": true
            }
          }
        }
      }
    }
  }

anandthakker avatar Jul 16 '24 12:07 anandthakker

Thanks a lot, can't wait !

nym21 avatar Jul 16 '24 18:07 nym21

This is still not working for me. I'm not sure if this is intended behaviour, but the Zed marketing pages says so ("Project wide diagnostics").

It's easily reproducible by creating a new Typescript project:

mkdir repro && cd repro
npm init -y
npm i --save-dev typescript
npx tsc --init
# Won't type check:
echo "let a: string = 1;" > file.ts
zed .

If I open file.ts, the problems pane shows error. When closed, the problem pane shows "No errors".

Here's the relevant Zed settings.json:

Details
{
    "lsp": {
        "vtsls": {
            "initialization_options": {
                "preferences": {
                    "includeInlayParameterNameHints": "all",
                    "includeInlayParameterNameHintsWhenArgumentMatchesName": true,
                    "includeInlayFunctionParameterTypeHints": true,
                    "includeInlayVariableTypeHints": true,
                    "includeInlayVariableTypeHintsWhenTypeMatchesName": false,
                    "includeInlayPropertyDeclarationTypeHints": true,
                    "includeInlayFunctionLikeReturnTypeHints": true,
                    "includeInlayEnumMemberValueHints": true
                },
                "typescript": {
                    "tsserver": {
                        "experimental": {
                            "enableProjectDiagnostics": true
                        }
                    }
                }
            }
        }
    }
}

brookback avatar Dec 11 '24 18:12 brookback

I'm not sure if any of you still have this problem, but I managed to fix exactly same problem with this config:

"lsp": {
    "vtsls": {
      "settings": {
        "typescript": {
          "tsserver": {
            "experimental": {
              "enableProjectDiagnostics": true
            }
          }
        }
      }
    }
  }

JumppanenTomi avatar Jan 08 '25 19:01 JumppanenTomi

@JumppanenTomi So you can't repro my example above? I can still repro it with that config shape you posted :/ I.e. I won't get project wide diagnostics unless the bad file is opened.

brookback avatar Jan 09 '25 06:01 brookback

Hi there! 👋 We're working to clean up our issue tracker by closing older issues that might not be relevant anymore. If you are able to reproduce this issue in the latest version of Zed, please let us know by commenting on this issue, and we will keep it open. If you can't reproduce it, feel free to close the issue yourself. Otherwise, we'll close it in 7 days. Thanks for your help!

github-actions[bot] avatar May 14 '25 07:05 github-actions[bot]

I can still repro (see https://github.com/zed-industries/zed/issues/8268#issuecomment-2536821704).

brookback avatar May 14 '25 07:05 brookback

@brookback FYI in your repro settings snippet above you have the experimental flag in the initialization_options rather than settings from working example.

By adding @JumppanenTomi snippet to my zed settings I am able to get project wide diagnostics working e.g. I'll get errors even for files that aren't open. Note I've also disabled the typescript-language-server language server because I was running into some weird behaviors when it and vtsls ran at the same time.

Here is my working zed settings. Also note I'm using yarn so there are some extra settings related to that.

.zed/settings.json

{
  "language_servers": ["!typescript-language-server", "..."],
  "node": {
    "npm_path": "yarn"
  },
  "lsp": {
    // https://zed.dev/docs/languages/yarn
    "vtsls": {
      "initialization_options": {
        "typescript.tsdk": ".yarn/sdks/typescript/lib"
      },
      // Enable project wide diagnostics (e.g. run linter even on files that aren't open)
      "settings": {
        "typescript": {
          "tsserver": {
            "experimental": {
              "enableProjectDiagnostics": true
            }
          }
        }
      }
    }
  }
}

michael-gillett avatar Sep 14 '25 18:09 michael-gillett