Enhance search-based code intel with accurate local navigation.
Created by: olafurpg
Previously, search-based code intel did not support navigating to local
definitions because ctags doesn't index local variables. This commit
adds a new searchBasedLsif()
endpoint to the GraphQL API that
search-based code intel can use to resolve accurate code navigation
for symbols that are definitely local.
- This only works for Go right now but we can add support for more languages in the future. We use tree-sitter to parse the code because it provides a nice API but we can use other parsers too.
- We use the new "LSIF typed" data schema from RFC 519 to index search-based code intel. The benefit of using this schema is that we can reuse testing infrastructure and vocabulary between search-based and precise indexers.
- This commit adds new snapshot testing infrastructure that is similar to how we do snapshot testing in lsif-java. It would be nice to extract this logic into a standalone tool so that it can be consumed by precise indexers in the future.
- The new
searchBasedLsif
endpoint can be extended in the future to implement stencil support for search-based code intel. It's also worth exploring whether we should use the same infrastructure to implement syntax highlighting.