pmizio / typescript-tools.nvim

⚡ TypeScript integration NeoVim deserves ⚡
MIT License
1.26k stars 36 forks source link

Custom methods fired for all active language servers #234

Open ehaynes99 opened 4 months ago

ehaynes99 commented 4 months ago

While looking through lsp debug logs, I noticed a large number of errors around 'typescriptTools/diagnostic'. As far as I can tell, this method gets fired on all active language servers, not just typescript-tools. In my case, I have 3 active with TypeScript files (this plus eslint and copilot), so this call always causes 3 outbound requests and 2 error responses.

I'm not too familiar with this custom LSP integrations, but could this be from here? Can it be made to target only the specific language server?

https://github.com/pmizio/typescript-tools.nvim/blob/c43d9580c3ff5999a1eabca849f807ab33787ea7/lua/typescript-tools/api.lua#L153-L155

[DEBUG][2024-02-09 11:46:27] .../lua/vim/lsp.lua:1182   "LSP[typescript-tools]" "client.request"        1       "typescriptTools/diagnostic"    {
  textDocument = {
    uri = "file:///home/erich/op/backend/libs/http/src/applications/create-application.ts"
  }
}       <function 1>    3
[DEBUG][2024-02-09 11:46:27] .../lua/vim/lsp.lua:1182   "LSP[eslint]"   "client.request"        2       "typescriptTools/diagnostic"    {
  textDocument = {
    uri = "file:///home/erich/op/backend/libs/http/src/applications/create-application.ts"
  }
}       <function 1>    3
[DEBUG][2024-02-09 11:46:27] .../vim/lsp/rpc.lua:43     "rpc.send"      {
  id = 6,
  jsonrpc = "2.0",
  method = "typescriptTools/diagnostic",
  params = {
    textDocument = {
      uri = "file:///home/erich/op/backend/libs/http/src/applications/create-application.ts"
    }
  }
}
[DEBUG][2024-02-09 11:46:27] .../lua/vim/lsp.lua:1182   "LSP[copilot]"  "client.request"        4       "typescriptTools/diagnostic"    {
  textDocument = {
    uri = "file:///home/erich/op/backend/libs/http/src/applications/create-application.ts"
  }
}       <function 1>    3
[DEBUG][2024-02-09 11:46:27] .../vim/lsp/rpc.lua:43     "rpc.send"      {
  id = 5,
  jsonrpc = "2.0",
  method = "typescriptTools/diagnostic",
  params = {
    textDocument = {
      uri = "file:///home/erich/op/backend/libs/http/src/applications/create-application.ts"
    }
  }
}
[DEBUG][2024-02-09 11:46:27] .../vim/lsp/rpc.lua:43     "rpc.receive"   {
  error = {
    code = -32601,
    message = "Method not found: typescriptTools/diagnostic"
  },
  id = 5,
  jsonrpc = "2.0"
}
[DEBUG][2024-02-09 11:46:28] .../vim/lsp/rpc.lua:43     "rpc.receive"   {
  error = {
    code = -32601,
    message = "Unhandled method typescriptTools/diagnostic"
  },
  id = 3,
  jsonrpc = "2.0"
}
pavkam commented 4 months ago

Same here, but even stranger those requests are all pending. And there's many of them:

 requests = {
    [370] = {
      bufnr = 529,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [371] = {
      bufnr = 529,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [372] = {
      bufnr = 529,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [373] = {
      bufnr = 529,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [374] = {
      bufnr = 529,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [375] = {
      bufnr = 529,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [376] = {
      bufnr = 529,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [377] = {
      bufnr = 529,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [378] = {
      bufnr = 210,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [379] = {
      bufnr = 210,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [380] = {
      bufnr = 210,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [381] = {
      bufnr = 210,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [382] = {
      bufnr = 210,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [383] = {
      bufnr = 210,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [384] = {
      bufnr = 210,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [385] = {
      bufnr = 933,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [386] = {
      bufnr = 529,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [387] = {
      bufnr = 529,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [388] = {
      bufnr = 529,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [389] = {
      bufnr = 529,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [390] = {
      bufnr = 529,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [391] = {
      bufnr = 529,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [392] = {
      bufnr = 529,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [393] = {
      bufnr = 529,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [394] = {
      bufnr = 529,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [395] = {
      bufnr = 529,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [396] = {
      bufnr = 529,
      method = "textDocument/codeAction",
      type = "pending"
    },
    [397] = {
      bufnr = 529,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },
    [398] = {
      bufnr = 529,
      method = "typescriptTools/diagnostic",
      type = "pending"
    },

   ... way more ...
ehaynes99 commented 3 months ago

@pavkam How did you get that list?

pavkam commented 3 months ago

@pavkam How did you get that list?

vim.inspect(client) where the client is just one of the clients attached to the buffer