Skip to content

New reference panel: fallback to search-based code intel

Administrator requested to merge mrn/ref-panel-search-based into main

Created by: mrnugget

This fixes the first half of https://github.com/sourcegraph/sourcegraph/issues/30970 by renaming the usePreciseCodeIntel hook to useCodeIntel and doing a fallback to search-based code intel when querying precise-code intel yielded no results. This does not yet mix search-based/precise results.

  • Uses LanguageSpec definitions copy&pasted from code-intel-extensions
  • Determines which Languagespec to use for current document
  • Finds token in current document, using LanguageSpec to determine token boundaries and file extensions
  • Builds search query to query definitions
  • Builds search query to query references
  • Tag results as search-based and display that in UI
  • Handle clicks on definitions in mini code view correctly
  • Filter definitions based on language spec's filterDefinitions

Test plan

  • Tested locally by trying out search-based code intel in repositories without precise
  • Confirmed that filterDefinition is used by printing comparisons between filtered/unfiltered
  • Manually checked graphql queries
  • I really want to look into how to best test this as part of #30970 (closed)

Merge request reports

Loading