-
Notifications
You must be signed in to change notification settings - Fork 57
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
Remove FCS syntax tree checks from typing assists #702
Conversation
7fa91e9
to
61f5e39
Compare
c4f1dfa
to
96d60f8
Compare
96d60f8
to
3ac9a40
Compare
3fa45e1
to
07d1c49
Compare
@DedSec256 Is is possible to extract and merge some manageable parts of this PR? I'd like to work on the typing assists, but don't want to add conflicts or more code to rework later. |
07d1c49
to
7e20444
Compare
|
||
| _ -> defaultTraverse expr } | ||
let range = | ||
let inline checkExpr (expr: IFSharpExpression) (node: ITreeNode) = |
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.
What does checkExpr
mean? Could then name convey what the function does actually?
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.
While I was coming up with a name for the function, I found an old bug for the case
for a = 0
to 10 do {caret}
which resulted in
for a = 0
to 10 do
{caret}
instead of
for a = 0
to 10 do
{caret}
its' because here
the range was taken not from to ...
expr, but do ...
, which could never be matched with prevTokenEnd.
Fixed, test added.
ReSharper.FSharp/src/FSharp/FSharp.Psi.Features/src/FSharpTypingAssist.fs
Outdated
Show resolved
Hide resolved
ReSharper.FSharp/src/FSharp/FSharp.Psi.Features/src/FSharpTypingAssist.fs
Outdated
Show resolved
Hide resolved
ReSharper.FSharp/src/FSharp/FSharp.Psi.Features/src/FSharpTypingAssist.fs
Outdated
Show resolved
Hide resolved
getEndOffset document lastRange = prevTokenEnd -> | ||
Some range | ||
let indentOffset = | ||
let inline tryGetIndentOffset (exprBeforeKeyword: IFSharpExpression) (indentAnchor: ITreeNode) = |
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.
What is the reason to inline it?
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.
In order not to allocate a closure for tokenBeforeKeywordEnd
, used inside
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.
Does it make any measurable difference?
Compared to reparsing the whole file after the Enter press, converting the resulting FCS tree into a R# one, type checking it, running the daemon, and calculating code completions, how much do we save here? I'd rather keep things simple and use the language default behavior, unless there's a convincing reason (e.g. we're going to allocate it hundreds/thousands times).
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.
And I also don't see where and how exactly it's allocated. Could you explain this, please? Thank you 🙂
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.
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.
Wow, I'd not expect a closure there at all. Thanks for showing this!
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.
Maybe it's worth trying to find a minimal repro and reporting it to the compiler team. Or is it expected and I'm missing something?
No description provided.