Closed Bug 1773379 Opened 4 years ago Closed 3 years ago

Make DocumentTitler more robust when multiple lines are selected

Categories

(Webtools :: Searchfox, enhancement)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: arai, Assigned: arai)

References

(Depends on 1 open bug)

Details

Attachments

(1 external file)

DocumentTitler uses the last clicked line's information for the symbol information.
If multiple lines are selected, and it doesn't detect symbol information in the last clicked line, it would be nice to look for symbol in other lines.

This would be useful for copying the entire function with Symbol Link, because, selecting the entire function will make the last clicked line be the closing brace, and that line doesn't have the symbol information.
Using other line's information will make the Symbol Link available in such situation.

I think the rationale for what I implemented in bug 1702319 for picking the last line was supporting:

  • Selecting a single definition line.
  • Selecting a range of lines starting with the first line of a block comment for a definition and ending with the first line of the definition. The rationale here was that if I want to link someone to a method, because of our scroll-anchoring logic's bias towards putting the first line of the selection near the top of the window, I want to make sure the selection includes the block comment, otherwise the user will miss it. In this exact selection case, the last line is what we want.

This clearly does not handle selecting the whole function though. I think that's partially down to our choice to have the nesting range end on the line preceding the closing brace. I've thought about us supporting some level of automated brace/bracket-matching, so one thing we could potentially also consider is annotating that closing brace/line with information that helps semantically indicate the brace/line is still part of the symbol that had the large nesting span if we think it's going to be most common to select a whole function. That way we could bypass needing to have heuristics about picking the best symbol across all the lines it sees, etc.

Depends on: 1702319
Attached file GitHub Pull Request —
Assignee: nobody → arai.unmht
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: