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

Truncation in Refactor Preview panel #130527

Closed
Colengms opened this issue Aug 10, 2021 · 2 comments · Fixed by #146710
Closed

Truncation in Refactor Preview panel #130527

Colengms opened this issue Aug 10, 2021 · 2 comments · Fixed by #146710
Assignees
Labels
help wanted Issues identified as good community contribution opportunities insiders-released Patch has been released in VS Code Insiders polish Cleanup and polish issue ux User experience issues workspace-edit
Milestone

Comments

@Colengms
Copy link
Contributor

Version: 1.59.0 (user setup)
Commit: 379476f
Date: 2021-08-04T23:13:12.822Z
Electron: 13.1.7
Chrome: 91.0.4472.124
Node.js: 14.16.0
V8: 9.1.269.36-electron.0
OS: Windows_NT x64 10.0.19043

This was originally reported against the C/C++ extension here: microsoft/vscode-cpptools#7826

There appears to be some truncation that occurs in the Refactor Preview panel. Repro is fairly simple, but involves using the C/C++ Extension. Note that the C/C++ Extension does not return the contents of the line replicated in the Refactor Preview panel. It only provides the range to be replaced, what to replace it with, what Icon to use, text for the group label, etc.. The remainder of the line extracted from the original file appears to be coming from VS Code.

Repro code:

int foo(void)
{
    int foo = 1; // A much longer line that is not trunacated.
}

int main(void)
{
    foo();
}

The repro is to use the Rename feature to change foo to foo2.

image

@jrieken jrieken added polish Cleanup and polish issue ux User experience issues workspace-edit help wanted Issues identified as good community contribution opportunities labels Aug 16, 2021
@jrieken
Copy link
Member

jrieken commented Aug 16, 2021

code pointer:

let prefixLen = 23; // default value for the no tokens/grammar case

@jrieken jrieken added the feature-request Request for new features or functionality label Oct 4, 2021
@jrieken jrieken added this to the Backlog milestone Oct 4, 2021
@weartist weartist mentioned this issue Apr 4, 2022
@weartist
Copy link
Contributor

weartist commented Apr 4, 2022

code pointer:

let prefixLen = 23; // default value for the no tokens/grammar case

hi, I found that the 'findTokenIndexAtOffset' is calculated from 0, but the range we pass to him is calculated from 1, so we may need to add a -1, both the ‘prefixLen’ and ‘suffixLen’ are required, but the prefixLen is fine without it, when there is only one character, it is only one more loop, and the calculate result of this loop is always 0

@jrieken jrieken removed the feature-request Request for new features or functionality label May 6, 2022
@jrieken jrieken modified the milestones: Backlog, May 2022 May 6, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jun 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Issues identified as good community contribution opportunities insiders-released Patch has been released in VS Code Insiders polish Cleanup and polish issue ux User experience issues workspace-edit
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@jrieken @weartist @miguelsolorio @Colengms and others