Skip to content

[WIP] Issue 408 - search by file with line number

Created by: maxhallinan

image

This adds support for a file line number to the Search query. The approach is based on @nicksnyder 's suggestion here.

The synthetic line match is given an empty preview and a offset/length pair of [0,-1]. This is a hack. I thought it was worth considering for this reason: The client doesn't use the preview field to show the highlighted code in the search results list. Instead, the client fetches the entire file from the HighlightedFile query and builds the preview itself. I could get the real line length on the server but this would mean fetching and iterating over the file a second time. Since the client already does this, and since it doesn't seem to use the preview field, it seems cheaper to set -1 and modify the client to understand this means highlight the entire line.

Merge request reports

Loading