You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
I'm encountering multiple issues with typescript-language-server when using its LSP capabilities, particularly with workspace/symbol and other features like hover, signature_help, implementation, and references. Despite correctly sending the rootUri during the initialize request, the server struggles to recognize the project root and provide complete responses unless specific conditions are met, which seem inefficient or inconsistent.
workspace/symbol Issue:
When I call workspace/symbol with a query (e.g., "createApiResponse"), the server fails to find symbols unless I manually send textDocument/didOpen for every .ts file in the project. Even then, it returns only one symbol, despite there being many more in the project.
I provide the rootUri in the initialize request (e.g., file:///path/to/my/project), and the project contains a valid tsconfig.json and multiple .ts files. However, the server behaves as if it doesn’t recognize the rootPath unless all files are explicitly opened.
Inconsistent Responses Without Debugging:
For features like hover, signature_help, implementation, and references, the server returns nothing or minimal information when running tests normally (without debugging). For example, a hover request might return an empty response or a brief description.
If I run the test in debug mode and introduce a slight delay after calling my send_document_sync method (see code below) before making the request, the server returns a full, correct response (e.g., detailed hover information with types and documentation).
-This suggests the server hasn’t finished processing documents when I make the request in non-debug mode, but it works fine with a manual delay in debug mode.
Steps to Reproduce
Setup:
- A TypeScript project with tsconfig.json and multiple .ts files.
- rootUri set to the project directory (e.g., file:///home/user/project) in the initialize request.
- Using typescript-language-server --stdio as the server command.
Test Case:
- Initialize the client with rootUri and call workspace/symbol with a query present in multiple files.
Result: Returns one symbol or none unless didOpen is sent for every file.
- Open a single .ts file with didOpen, then request hover at a symbol without debugging.
Result: Empty or minimal response.
- In debug mode, add a delay (e.g., 1-2 seconds) after send_document_sync and before hover.
Result: Full hover information returned.
Expected Behavior
- workspace/symbol should index the entire project based on the rootUri provided in initialize and return all matching symbols without requiring didOpen for every file.
- Features like hover, signature_help, etc., should return complete responses consistently, regardless of debugging, once the document is synced.
Actual Behavior
- workspace/symbol returns incomplete results (e.g., 1 symbol instead of many) unless all files are opened with didOpen.
- Other features return nothing or partial responses without debugging and a manual delay after send_document_sync.
Environment
typescript-language-server version: 4.3.4
OS: Ubuntu 22.04
Project: TypeScript project with tsconfig.json and ~20 .ts files
Questions
- How can the server reliably recognize the rootPath if it’s not working from the initialize request? Is there a specific configuration or step I’m missing?
- Is there a way to get a notification from the server when it has finished processing documents, so I can call features like hover or workspace/symbol at the right time instead of guessing with delays?
Notes
Manually opening all files with didOpen is not a practical solution for larger projects. The inconsistent behavior between debug and non-debug modes suggests a timing or indexing issue on the server side. I’d appreciate any guidance or fixes to make this work reliably.
The text was updated successfully, but these errors were encountered:
Description
I'm encountering multiple issues with typescript-language-server when using its LSP capabilities, particularly with workspace/symbol and other features like hover, signature_help, implementation, and references. Despite correctly sending the rootUri during the initialize request, the server struggles to recognize the project root and provide complete responses unless specific conditions are met, which seem inefficient or inconsistent.
workspace/symbol Issue:
Inconsistent Responses Without Debugging:
-This suggests the server hasn’t finished processing documents when I make the request in non-debug mode, but it works fine with a manual delay in debug mode.
Steps to Reproduce
Expected Behavior
Actual Behavior
Environment
Questions
Notes
Manually opening all files with didOpen is not a practical solution for larger projects. The inconsistent behavior between debug and non-debug modes suggests a timing or indexing issue on the server side. I’d appreciate any guidance or fixes to make this work reliably.
The text was updated successfully, but these errors were encountered: