Open amunger opened 1 year ago
I'm not sure if this is the same issue, but I noticed that right-clicking a line number causes that line to be selected, whereas right-clicking the gutter beside a line number doesn't change the selection. This behaviour occurs on the desktop Insiders. Therefore, in the second case, creating a permalink from the context menu that shows up for that right click might make it seem as though the previous selection is being shared, when it's more that the selection hasn't changed.
@amunger I cannot repro, this seems to work as expected for me. Do you have an example?
@rzhao271 that is fair, but the alternative is to change the editor selection on a gutter right click, which is likely unwanted for users who are accustomed to right clicking in the gutter. OTOH clicking on a line number already selects the whole line today, so adopting the same behavior for a right click (which previously did nothing) is not a breaking change. If this continues to be a problem for users we could explore additional UI to reflect which lines are selected in the editor.
Seems to repro pretty consistently when opening an editor without giving any focus
@amunger I think this might actually just be a performance issue, because we have to actually exec a git
command to validate that the current file belongs to one of the configured remotes, and depending on what is going on in the extension host at the time this could take a while. If you try the Copy Permalink command, wait a bit (say 5 seconds), then paste, does it produce the right link text?
maybe, now I can't get it to repro at all, though I'm still not sure where it's grabbing the text from when I don't have anything selected.
It takes the word range wherever your cursor is (this is behavior that's been there for 2 years).
when right clicking the gutter, the cursor can be in an unpredictable place. Like in that gif, it looks like files was pulled from the end of the link on the line above the cursor.
The cursor position doesn't matter when you copy a link from the gutter or line number--the link should always be for the line number that you right clicked on.
when right clicking the gutter, the cursor can be in an unpredictable place
Oh, you're talking about what text gets included in the link. Yeah, I don't think we can update the selection when right clicking in the gutter because that would break any existing gutter context menu users.
Maybe if the active editor selection is empty then we should not try to prefill the link text?
Testing microsoft/vscode#177486
right click in the gutter of a ts file in a repository and select 'copy permalink as markdown text'
I've seen: a markdown link using the text from that line or the first line of selected text as link text (expected) a markdown link using previously selected text as link text a markdown link with blank link text a plain link, not markdown
I can't figure out the pattern for which one is chosen