Retrieving typing context and in-scope variables via the TypeScript language server
Develop a general method to retrieve the typing context at a given lexical location, including a complete list of variables in scope, using the TypeScript language server, or specify the necessary protocol extensions to expose this capability robustly for prompt construction.
References
There does not appear to be any direct way of retrieving a typing context given a lexical location, or even a complete list of variables in scope using the TypeScript language server. We experimented with different methods to retrieve relevant headers, including scanning the repository using CodeQL, but were did not find a fully satisfactory general approach.
                — Statically Contextualizing Large Language Models with Typed Holes
                
                (2409.00921 - Blinn et al., 2 Sep 2024) in Subsection “TypeScript Methodology”