Context: return lines around symbol match#63773
Conversation
| func fileMatchToContextMatch(fm *result.FileMatch) FileChunkContext { | ||
| if len(fm.ChunkMatches) == 0 { | ||
| var startLine int | ||
| if len(fm.Symbols) != 0 { |
There was a problem hiding this comment.
Just a thought. In the code I see that we do this kind of check in several places. I wonder whether it would help to just make this a method of FileMatch.
There was a problem hiding this comment.
hmm, what are you suggesting we could pull out? A method like containsSymbols? Or something like firstStartLine?
|
I'm going to merge but happy to make any follow-ups. |
This PR fixes an important bug in #62976, where we didn't properly map the symbol line match to the return type. Instead, we accidentally treated symbol matches like file matches and returned the start of the file. ## Test plan Add new unit test for symbol match conversion. Extensive manual testing. (cherry picked from commit 004eb0f)
|
The backport to To backport this PR manually, you can either: Via the sg toolUse the sg backport -r 5.5.x -p 63773Via your terminalTo backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-5.5.x 5.5.x
# Navigate to the new working tree
cd .worktrees/backport-5.5.x
# Create a new branch
git switch --create backport-63773-to-5.5.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 004eb0fd830755376c8ee6b895a814d79bd8f21b
# Push it to GitHub
git push --set-upstream origin backport-63773-to-5.5.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-5.5.xIf you encouter conflict, first resolve the conflict and stage all files, then run the commands below: git cherry-pick --continue
# Push it to GitHub
git push --set-upstream origin backport-63773-to-5.5.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-5.5.x
Once the pull request has been created, please ensure the following:
|
This PR fixes an important bug in #62976, where we didn't properly map the symbol line match to the return type. Instead, we accidentally treated symbol matches like file matches and returned the start of the file. ## Test plan Add new unit test for symbol match conversion. Extensive manual testing. <br> Backport 004eb0f from #63773 Co-authored-by: Julie Tibshirani <[email protected]>
This PR fixes an important bug in #62976, where we didn't properly map the
symbol line match to the return type. Instead, we accidentally treated symbol
matches like file matches and returned the start of the file.
Test plan
Add new unit test for symbol match conversion. Extensive manual testing.