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

Diagnostic is shown at incorrect location after multi-line comment #88

Closed
enricolyb opened this issue Apr 25, 2019 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@enricolyb
Copy link

Describe the bug
The position of the diagnostic in the VSCode editor is incorrect if a multi-line comment is present in the source file before the referenced position.
This happens when CRLF line endings (Windows) are used.

To Reproduce
Add a multi-line comment using either """ or ''' at the top of the source file with CRLF line endings.
Add incorrect Python code after the multi-line comment.

Expected behavior
The position of the incorrect Python code is marked correctly in VSCode editor.

Screenshots or Code
image
The green line comes from the built-in Python code checker, location is correct
The red line comes from pyright, location is incorrect

VS Code extension or command-line
VSCode extension version 1.0.16 does not work correctly.
VSCode extension version 1.0.15 works correctly.

Additional context
It seems to be related to the recent changes in tokenizer.ts, line ~973. This check doesn't handle CRLF. The resulting Tokenizer lines collection is not correct.

@erictraut
Copy link
Collaborator

Thanks for reporting. Yes, this was a regression I introduced recently. It affects only files formatted with CR/LF. I didn't notice because I tend to use LF only. I've fixed the regression and added a unit test so a similar regression won't occur in the future. The fix will be in the next version (1.0.18).

erictraut pushed a commit that referenced this issue Apr 25, 2019
…s. Added test case to prevent such a regression in the future.
@erictraut erictraut added the bug Something isn't working label Apr 25, 2019
@erictraut
Copy link
Collaborator

This is now fixed in version 1.0.18, which I just published.

heejaechang added a commit to heejaechang/pyright that referenced this issue Feb 13, 2020
microsoft#88)

* support library code in fourslash test and added missing typestub diagnostic test

* Squashed 'server/pyright/' changes from 9521693..b1e0ff8

b1e0ff8 made reportMissingTypeStub diagnostics warning by default and some refactoring around code actions. (microsoft#507)

git-subtree-dir: server/pyright
git-subtree-split: b1e0ff8

* addressed PR feedback and fix python syntax error on python test code

* Squashed 'server/pyright/' changes from 9521693..b1e0ff8

b1e0ff8 made reportMissingTypeStub diagnostics warning by default and some refactoring around code actions. (microsoft#507)

git-subtree-dir: server/pyright
git-subtree-split: b1e0ff8

* added site-packages to consts.ts as well
heejaechang added a commit to heejaechang/pyright that referenced this issue Nov 3, 2021
microsoft#88)

* support library code in fourslash test and added missing typestub diagnostic test

* Squashed 'server/pyright/' changes from 9521693..b1e0ff8

b1e0ff8 made reportMissingTypeStub diagnostics warning by default and some refactoring around code actions. (microsoft#507)

git-subtree-dir: server/pyright
git-subtree-split: b1e0ff8

* addressed PR feedback and fix python syntax error on python test code

* Squashed 'server/pyright/' changes from 9521693..b1e0ff8

b1e0ff8 made reportMissingTypeStub diagnostics warning by default and some refactoring around code actions. (microsoft#507)

git-subtree-dir: server/pyright
git-subtree-split: b1e0ff8

* added site-packages to consts.ts as well
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants