-
Notifications
You must be signed in to change notification settings - Fork 847
Added Colorization/Brace Matching Roslyn Services #993
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
Conversation
…to correcthistory
…ts/strings/excluded code
…to correcthistory
|
|
||
| interface IBraceMatcher with | ||
| member this.FindBracesAsync(document: Document, position: int, cancellationToken: CancellationToken): Task<Nullable<BraceMatchingResult>> = | ||
| let computation = async { |
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.
will this do an implicit ConfigureAwait(false)? If not, can you change this to: document.GetTextAsync(ct).ConfigureAwait(false)
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.
Curious: is there a correctness reason for this or is it just to get better perf?
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.
👍
|
Great work. |
| open Microsoft.FSharp.Compiler.SourceCodeServices | ||
|
|
||
| // TODO: add types colorization if available from intellisense | ||
| // TODO: add defines flags if available from project sites and files |
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.
Can we file bugs for each of these and reference them here instead of TODO? A TODO is easy to forget about, bugs less so.
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 is being added in the next PR, as it was the best way to break down the large intellisense changes into separate PRs.
|
I like this, nice work. |
|
|
||
| [<TestCase("[start")>] | ||
| [<TestCase("]end")>] | ||
| member this.BraceInMultiLineCommentShouldnotBeMatched(startMarker: string) = |
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.
Minor point: ShouldNot here and below.
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.
👍
| right <- middle - 1 | ||
| else | ||
| result <- Some(middleToken) | ||
| result |
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.
Consider implementing recursively.
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.
👍
|
Shouldn't |
| endPosition <- endPosition + 1 | ||
| let textSpan = new TextSpan(textLine.Start + startPosition, endPosition - startPosition) | ||
| result.Add(new ClassifiedSpan(classificationType, textSpan)) | ||
| startPosition <- endPosition |
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.
It seems unnecessary to convert from tokens to a character-based colorMap back to token-based ClassifiedSpans. Can we avoid colorMap and map directly from tokens to ClassifiedSpans?
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.
The line scanner produces more tokens that can be grouped. This one-time optimization (borrowed from the deprecated code) provides performance optimization to Roslyn.
|
Modifying the cache to hold lex states for each line, to allow partial parsing per @dsyme comments. |
Added Colorization/Brace Matching Roslyn Services
|
What's the red in appveyor? https://ci.appveyor.com/project/KevinRansom/visualfsharp-radou/build/0.0.1.1622 |
|
@dsyme it is because I'm building against a non-shipped version of Roslyn (on myget), which has internals exposed to F#, so the nuget packages expire quickly. Later on when we have a more stable nuget package, I'll switch this F# branch to use it. |
|
@otawfik-ms can you add the myget feed in Nuget.config? that should fix appveyor, and local build too. |
|
@enricosada myget is out and public :) Roslyn uses it for daily builds, and it is added to this branch's nuget config: |
|
Looks ok to me. |
/cc @Microsoft/fsharp-compiler @jasonmalinowski @CyrusNajmabadi @dsyme