-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Formatting on Enter #649
Formatting on Enter #649
Conversation
…nto lint Fix Windows terminal tests
@brettcannon we have a new package here, guess this means it won't make the Jan release. |
Codecov Report
@@ Coverage Diff @@
## master #649 +/- ##
==========================================
+ Coverage 61.44% 62.58% +1.14%
==========================================
Files 233 240 +7
Lines 10635 11066 +431
Branches 1852 1998 +146
==========================================
+ Hits 6535 6926 +391
- Misses 4094 4132 +38
- Partials 6 8 +2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review not completed
|
||
public Tokenize(text: string, start?: number, length?: number): ITextRangeCollection<IToken> { | ||
public tokenize(text: string, start?: number, length?: number, mode?: TokenizerMode): ITextRangeCollection<IToken> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is getting busier (i.e. its doing a lot synchronously).
Should we try to put an intermittently push control back to the event loop (e.g. await on a timeout or similar
) to ensure VS Code has time to catch up on any UI events, which could potentially cancel this operation.
I.e. if we have a large file and this takes 1-2 seconds, then VS Code will hang until then.
We could pass in a cancellation token into this method and every few milliseconds or so we could check the value of this token (ensuring we pas control back to the main event loop).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tokenization, although usually somewhat long code, is typically pretty fast (tens of ms on 10000 lines). This one is pretty simple and only runs on very specific actions. VSC runs regex for colorization ;-)
This one primarily tokenizes comments and strings in a file and only used for detailed information for a single line.
I can measure if you wish.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can measure if you wish.
Yes, it would be good to measure this.
Besides, we're testing this on our beefed up hardware. Lately I've been using this repo for simple testing (https://github.com/python/cpython.git)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
10-20 ms per 1000 lines full tokenization (which we don't normally do anyway).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Speaking of |
Please do bring this up with @brettcannon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good, but not approving this due to the inclusion of the new package.
Includes new
unicode
package so not sure about the CLA here