artemave / workspace-diagnostics.nvim

Populate diagnostics for _all_ projects files, not just opened ones.

Home Page:https://artem.rocks/posts/workspace_diagnostics_nvim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`notify` does not run on Typescript files

JeremyChuaWX opened this issue · comments

Description

When opening a Typescript project, the workspace files are detected, but their respective textDocument/didOpen notifications were not sent to the LSP client.

Steps to reproduce

  1. Initialise a git repository with 2 Typescript files
  2. Create a syntax error in one of the files
  3. Git add the files
  4. Open neovim on the file with no syntax error

Expected behavior

Expected the syntax error to be listed in LSP diagnostics.

Evaluation

After some testing, it seems that it is a known issue that vim.filetype.match does not work on Typescript files with just a filename (neovim/neovim#27265). Since the filetype is nil, the textDocument/didOpen is not sent to the LSP client.

One potential solution is to manually add the filetype, but it is not an elegant one.

vim.filetype.add({
  extension = {
    ts = "typescript",
  },
})

Environment

  • Neovim version: 0.9.5
  • workspace-diagnostics version: main branch, commit ea9de9c