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
Labels
bug
Something isn't working
Comments
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.
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
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
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.
The text was updated successfully, but these errors were encountered: