Ensure special files are also indexed #261
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR ensures that special files (those that are relevant for a language, but not written in that language, such as
tsconfig.json
) are always indexed.Previously, the language loader only returned the primary language of a file (i.e., the language the file is written in). These changes return the primary, as well as any secondary languages (i.e., languages for which the file is special). The indexer makes sure that all languages get their change to generate stack graph for the file.
I have wondered (again) whether there should be a difference between primary and secondary languages at all. I think that still makes sense for the following reasons:
The contributions of a secondary language are typically not relevant when navigating the file. They are only useful for the effect they have on navigating the files of that secondary language.
When processed as a special file, more information is provided to the file analyzer, such as the list of paths in the project. This makes the results inherently less context-free. I kind of like to make this an explicit choice in the API (even though it could be left to convention).