In the current ObjectScript language server, the definition of symbols appears to be somewhat inconsistent, which may be preventing the use of VS Code’s Automatic Symbol References feature (available since version 1.112). This feature can automatically recognize symbols in code when it is copied and pasted into AI Chat, and provide related information, as shown in the example.
Currently, the LSP only allows class names to be treated as symbols. To explore a possible improvement, I made some adjustments to the symbol-related LSP implementations. The main changes include:
- Refining the structure of DocumentSymbol, which did not seem fully aligned with expectations. Adding support for WorkspaceSymbol, since its absence appeared to prevent “Go To Definition” from working properly
- Registering variable names and many others as symbols
One benefit of this change is that Ctrl+T (Go To Symbol) can now display a more complete set of symbols, including variables and properties. This can be particularly helpful when working with larger files.
The first point seems like a straightforward fix. For the second, I’m not entirely certain whether there are specific design considerations or constraints around how symbols are defined in your implementation. However, it seems that including variables and properties as symbols could be beneficial—for example, it may improve document indexing when using AI Chat and also support features like Ctrl+Click navigation. Based on this, I went ahead and added symbol registration for variable names as well.
I’m currently doing a final review and test of my changes. Before submitting a PR, I wanted to check whether there are any particular requirements or conventions regarding symbol definitions that I should be aware of.
In the current ObjectScript language server, the definition of symbols appears to be somewhat inconsistent, which may be preventing the use of VS Code’s Automatic Symbol References feature (available since version 1.112). This feature can automatically recognize symbols in code when it is copied and pasted into AI Chat, and provide related information, as shown in the example.
Currently, the LSP only allows class names to be treated as symbols. To explore a possible improvement, I made some adjustments to the symbol-related LSP implementations. The main changes include:
One benefit of this change is that Ctrl+T (Go To Symbol) can now display a more complete set of symbols, including variables and properties. This can be particularly helpful when working with larger files.
The first point seems like a straightforward fix. For the second, I’m not entirely certain whether there are specific design considerations or constraints around how symbols are defined in your implementation. However, it seems that including variables and properties as symbols could be beneficial—for example, it may improve document indexing when using AI Chat and also support features like Ctrl+Click navigation. Based on this, I went ahead and added symbol registration for variable names as well.
I’m currently doing a final review and test of my changes. Before submitting a PR, I wanted to check whether there are any particular requirements or conventions regarding symbol definitions that I should be aware of.