Skip to content

notebooks: query input for file block

Administrator requested to merge rn/notebook-file-block-query-input into main

Created by: novoselrok

This PR back-ports the symbol block UI to the file block. Instead of 3 inputs for repository name, file path, and revision we now have a single search query to select a file. The line range is now always visible (line range will be updated in the future to directly select a range of lines in the rendered file). I extracted the necessary functionality from the symbol block into a separate component and reused it for the file block.

https://user-images.githubusercontent.com/6417322/158194116-100e4e6a-813c-41ee-b973-8892c2881bb2.mov

The PR currently contains a bug where you can't switch from query input to line range input. This is fixed in a stacked PR: https://github.com/sourcegraph/sourcegraph/pull/32556

Test plan

  • Existing file block integration tests had to be updated to use the new UI
  • Manual testing
    • Create a new code (file) block
    • Enter a search query to find the desired file
    • Click on the suggested file button
    • The file should display below and the header should be updated
    • If you change the line range input, the highlighted lines should be updated

Merge request reports

Loading