Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit: Fix malformed comments from doc command with selection #2290

Merged
merged 2 commits into from
Dec 12, 2023

Conversation

umpox
Copy link
Contributor

@umpox umpox commented Dec 12, 2023

Description

closes #2058

getDocCommandRange for the /doc command was returning the incorrect selection. It was overriding the end position rather than just adjusting the start position for python.

This meant that the edit command was treating this as an add (no selected code thus nothing to edit)

Before

DocMalformBefore.mov

After

MalformDocAfter.mov

Test plan

  1. Highlight some code where there is not already a folding range
  2. Use the "doc" command via the chat or right click menu
  3. Check that the inserted documentation is correct

@umpox umpox marked this pull request as ready for review December 12, 2023 09:54
@umpox umpox requested review from beyang and a team December 12, 2023 09:54
@@ -235,5 +232,10 @@ function getDocCommandRange(
}
}

return new vscode.Selection(pos, pos)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was the offending line (overriding the entire range rather than just the start).

Once we're out for GA I think we should improve our integration tests around all the entry points for commands to help catch stuff like this, lots of variants depending on if there's a selection/the language/the command

@umpox
Copy link
Contributor Author

umpox commented Dec 12, 2023

Follow up for a related scroll bug: #2296

@umpox umpox requested review from a team, kalanchan and toolmantim December 12, 2023 10:43
Copy link
Contributor

@philipp-spiess philipp-spiess left a comment

Choose a reason for hiding this comment

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

Awesome!

@umpox umpox merged commit d881df4 into main Dec 12, 2023
14 checks passed
@umpox umpox deleted the tr/doc-malform-comment branch December 12, 2023 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: Document command returns malformed comments
2 participants