-
Notifications
You must be signed in to change notification settings - Fork 71
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
Major change making dsymbol deduce ufcs #724
Major change making dsymbol deduce ufcs #724
Conversation
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.
is it possible we split this into multiple smaller PRs? This is pretty hard to review this way otherwise
@WebFreak001 sorry about the big PR I will see what I can do |
Seem like it's a bit hard to split up since it include some refactoring and some new test additions, I have tried to split it up in some commits that should explain the change. the biggest commit is c4b8a74 but the others aren't so big. |
what did the most recent commit 6c66afd fix? Should probably get a unittest |
Yeah think I will investigate it. |
Was a false alarm, I just now mark the symbols as CompletionKind.ufcsName. |
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 round 1
@@ -306,6 +308,8 @@ AutocompleteResponse parenCompletion(T)(T beforeTokens, | |||
auto expression = getExpression(beforeTokens[0 .. $ - 1]); | |||
response.setCompletions(pair.scope_, expression, | |||
cursorPosition, CompletionType.calltips, beforeTokens[$ - 1] == tok!"["); | |||
response.completions ~= pair.ufcsSymbols.map!(s => makeSymbolCompletionInfo(s, s.kind)).array; | |||
response.completionType = CompletionType.calltips; |
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.
why this change? calltips doesn't seem right here and change is unrelated to the PR
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 will clarify this with a comment.
|
||
if (sortedBeforeTokens.length >= 2 | ||
&& sortedBeforeTokens[$ - 1].type is tok!"." | ||
&& sortedBeforeTokens[$ - 2].type is tok!"identifier") |
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 about a prefix like foo().
? This currently only matches identifier.
, but there are a bunch more ways how dot completion could be called.
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.
Yup not yet implemented, which is what is needed for ufcs function chaining.
auto slicedAtParen = sortedBeforeTokens[0 .. index]; | ||
if (slicedAtParen.length >= 4 | ||
&& slicedAtParen[$ - 4].type is tok!"identifier" | ||
&& slicedAtParen[$ - 3].type is tok!"." |
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.
ditto for this may be foo(x).ufcsBar(y)
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.
function chaining isn't yet supported, which is why I needed the return type implementation earlier
I have done the first round of request changes, and added some null checks for when checking |
CI failing |
Forgot to include some updated tests. |
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.
sorry, didn't realize the destroy would introduce memory corruption before, can you just fix these remaining things?
|
I have moved some utils to dsymbol.utils since it is used for ufcs deduction, and made dsymbol handle it all.
Doing this will separate the responsibility of UFCS completion.