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
JavaScript and TypeScript use PROJECT_NAME and FILE_PATH variables, which are supposed to be inferred from package.json or tsconfig.json locations. This inference process is currently implemented in another process, making testing this behavior cumbersome: one has to provide these variables explicitly in the tests, for each file.
Language configurations should be able to provide a custom procedure to determine the value for global variables for source files.
The text was updated successfully, but these errors were encountered:
Similar to FileAnalyzer we define a TreeAnalyzer trait which can be implemented for languages. A tree analyzer takes the source listing and produces a mapping from source files to global variables. These global variables are passed to the file analyzer.
A nice effect of this is that the source file list argument can be removed from the FileAnalyzer trait, at which point a StackGraphLanguage implements FileAnalyzer and everything becomes more uniform.
As part of this, we could/should provide a trie-like datastructure that allows us to set globals on directories as well as files, and returns all globals in effect for a source file. For example, set the PROJECT_NAME variable on the project root, and the FILE_PATH on the file, and when asked for the globals of a file in that directory, return both PROJECT_NAME and FILE_PATH values.
JavaScript and TypeScript use
PROJECT_NAME
andFILE_PATH
variables, which are supposed to be inferred frompackage.json
ortsconfig.json
locations. This inference process is currently implemented in another process, making testing this behavior cumbersome: one has to provide these variables explicitly in the tests, for each file.Language configurations should be able to provide a custom procedure to determine the value for global variables for source files.
The text was updated successfully, but these errors were encountered: