-
Notifications
You must be signed in to change notification settings - Fork 789
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
Fix reporting IsFromComputationExpression for inappropriate symbols #17375
Conversation
❗ Release notes required
|
5e7c8ac
to
c14a435
Compare
You can notice incorrect coloring of parentheses as CE keyword color there. It also seems incorrect for a more complex case (tested on VS v17.10.3): There is also the issue in VS Code: I did not research the logic of how Visual Studio/VS Code maps symbols to highlightings; however, the extra As a result, it will also fix highlightings in Rider (and, hopefully, in VS/VS Code) PS. Thanks, I updated the PR description a little bit |
For context, here's how FSAC does semantic tokenization. Generally we take the classifications directly from FCS via the So in general we assume FSC is true/correct, and try to do the most minimal mapping/handling possible for this feature area. |
I like this change @DedSec256 . At least the VS once, by starting it in VisualFsharp.sln |
@T-Gro, have checked before and after the fix. The issue is resolved. As you can see, the unit parameter of the constructor is still being highlighted in blue, but I think this is a separate issue; I don't observe the same problem in Rider/VS Code. |
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.
Nice job! Thanks for adding a test there as well.
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Description
Upon investigating the syntax highlighting issue for CE code in Rider, I found that FCS reports a separate
SymbolUse
for expressions that are not a constructor invocation of the CE builder type or an associated with it let-binding:This behavior seems incorrect because the
Object.Prop
expression does not appear to require highlighting as a CE keyword. Unexpected case, and therefore it may not be properly handled, which can lead to incorrect overlapped code highlighting, for example, like thisor even worse
and can also lead to navigation errors in the 'go to definition' due to overlapping
SymbolUse
ranges.The same issue is reproducible in VS/VS Code.
fsharp/src/Compiler/Service/FSharpCheckerResults.fs
Lines 236 to 242 in 5c6d8e7
Also, I did not find any tests confirming that IsFromComputationExpression should be true for such expressions.
Fix
This PR suggests reporting
IsFromComputationExpression
only for CE Builder type constructors and let-bindings.Checklist