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

Evaluatable expression off by one in range computation #91406

Closed
isidorn opened this issue Feb 25, 2020 · 2 comments
Closed

Evaluatable expression off by one in range computation #91406

isidorn opened this issue Feb 25, 2020 · 2 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Milestone

Comments

@isidorn
Copy link
Contributor

isidorn commented Feb 25, 2020

Refs: #91268

  1. Use the mock debug evaluatble expression API
  2. Hover over some word
  3. Notice how the range highlight in the editor is 1 character shorter than it should be. WHile the extracted result is correct

Upon looking at the mock debug implementation it seems like Mock debug incorectly returns a Range shorter by 1. And it seems like vscode properly shows this in the higlighted background, however the result extraction takes 1 character too much.

Contrast is not so strong but this picture shows the issue. y in funcitonlaity is not highlighted, while funcitonlaity is extracted as the result.
Screenshot 2020-02-25 at 16 37 06

@weinand weinand added the debug Debug viewlet, configurations, breakpoints, adapter issues label Feb 25, 2020
@weinand weinand added this to the February 2020 milestone Feb 25, 2020
@connor4312
Copy link
Member

I'm seeing that the EvaluatableExpression seems to take one character too much off the word. In the simple test case:

  vscode.languages.registerEvaluatableExpressionProvider('javascript', {
    provideEvaluatableExpression(document, position) {
      const word = document.getWordRangeAtPosition(position)
      return new vscode.EvaluatableExpression(word);
    },
  });

Hovering over the console in a console.log() correctly selects the word "console", but over DAP I see an evaluate request for console.

@weinand weinand added the bug Issue identified by VS Code Team member as probable bug label Feb 26, 2020
@weinand
Copy link
Contributor

weinand commented Feb 26, 2020

Great find (because of the weak contrast of the selection color I did not notice the selection being off-by-one).
Please note: the fix is both in VS Code and Mock Debug.

weinand added a commit to microsoft/vscode-mock-debug that referenced this issue Feb 26, 2020
@isidorn isidorn added the verified Verification succeeded label Feb 27, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants