Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Fuzzy finder: allow line number at the end of a filename#55064

Merged
olafurpg merged 5 commits into
mainfrom
olafurpg/ff-line
Jul 20, 2023
Merged

Fuzzy finder: allow line number at the end of a filename#55064
olafurpg merged 5 commits into
mainfrom
olafurpg/ff-line

Conversation

@olafurpg

Copy link
Copy Markdown
Contributor

Previously, it was not possible to navigate straight to a specific line number with the "Files" tab of the fuzzy finder. This commit adds the ability to specify a line number with a :NUMBER suffix. This feature makes it possible to copy-paste error messages that use the FILE:LINE:COLUMN format and quickly open the location with the fuzzy finder.

Test plan

  • New storybook test
  • New unit tests for query parsing

Previously, it was not possible to navigate straight to a specific line
number with the "Files" tab of the fuzzy finder. This commit adds the
ability to specify a line number with a `:NUMBER` suffix. This feature
makes it possible to copy-paste error messages that use the
`FILE:LINE:COLUMN` format and quickly open the location with the fuzzy
finder.
@cla-bot cla-bot Bot added the cla-signed label Jul 18, 2023
@olafurpg olafurpg requested a review from a team July 18, 2023 11:20
@sourcegraph-bot

sourcegraph-bot commented Jul 18, 2023

Copy link
Copy Markdown
Contributor

📖 Storybook live preview

@vovakulikov vovakulikov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@olafurpg I am still trying to unwrap this, but I think I got your idea about having two transformers for the query and for URL (strip line and column parameters from the actual query but then use it in the URL).

The problem I have is that initially, if you try to type query:line operator in the fuzzy search on the home page, fuzzy search doesn't strip the line operator for actual query for the API call

Screenshot 2023-07-18 at 13 10 30

I don't have a full understanding, but it seems like we can't ignore param argument with transformers in the FuzzyQuery.ts

 protected fuzzySearch(): FuzzySearch {
        return new CaseInsensitiveFuzzySearch(this.searchValues(), undefined)
}

Comment thread client/web/src/fuzzyFinder/CaseInsensitiveFuzzySearch.ts Outdated
@olafurpg

Copy link
Copy Markdown
Contributor Author

@vovakulikov good catch! I only tested it with the repo-local fuzzy finder. I will fix this for the global file finder

Previously, it only worked with the repo-local finder.
@olafurpg

Copy link
Copy Markdown
Contributor Author

@vovakulikov fixed in the latest commit

@olafurpg olafurpg requested a review from vovakulikov July 19, 2023 20:10

@vovakulikov vovakulikov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the slow response; thanks for the fix, and thanks for the new query operator.

@olafurpg olafurpg merged commit 0633c1d into main Jul 20, 2023
@olafurpg olafurpg deleted the olafurpg/ff-line branch July 20, 2023 08:17
@peterguy peterguy added the team/code-search Issues owned by the code search team label Jul 21, 2023
github-actions Bot pushed a commit that referenced this pull request Jul 25, 2023
Previously, it was not possible to navigate straight to a specific line
number with the "Files" tab of the fuzzy finder. This commit adds the
ability to specify a line number with a `:NUMBER` suffix. This feature
makes it possible to copy-paste error messages that use the
`FILE:LINE:COLUMN` format and quickly open the location with the fuzzy
finder.

## Test plan

- New storybook test
- New unit tests for query parsing
<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->

(cherry picked from commit 0633c1d)
olafurpg added a commit that referenced this pull request Jul 25, 2023
BolajiOlajide pushed a commit that referenced this pull request Jul 25, 2023
BolajiOlajide pushed a commit that referenced this pull request Jul 25, 2023
…me (#55252)

Previously, it was not possible to navigate straight to a specific line number with the &quot;Files&quot; tab of the fuzzy finder. This commit adds the ability to specify a line number with a `:NUMBER` suffix. This feature makes it possible to copy-paste error messages that use the `FILE:LINE:COLUMN` format and quickly open the location with the fuzzy finder.

## Test plan

- New storybook test
- New unit tests for query parsing
&lt;!-- All pull requests REQUIRE a test plan: https://docs.sourcegraph.com/dev/background-information/testing_principles --&gt;
 <br> Backport 0633c1d from #55064

Co-authored-by: Ólafur Páll Geirsson <olafurpg@gmail.com>
MaedahBatool pushed a commit that referenced this pull request Jul 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed team/code-search Issues owned by the code search team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants