-
Notifications
You must be signed in to change notification settings - Fork 14
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 completion of enum and fault methods #111
Conversation
Take into account that code inside That being said, new tests you write to support this new features/fixes will be really useful anyway |
Don't worry, I'm ok with having the search changes be scrapped. There are still a few benefits in moving this forward that I'm considering:
And, more importantly specifically for me, this small refactor, as well as by getting used to this part of the codebase, will make it easier for me to draft out an initial implementation of the |
Good stuff! Overall, it wasn't pretty hard. I'd say writing the tests took much more time 😅, but at least that let me find some additional bugs along the way. 😄 |
Partial fix forFixes #110, with fault as a drive-by. These changes were motivated by the method search work for #107Not fully finished, but opening the PR in case of initial feedback.Issues identified and fixed:
CoolEnum inst;
followed byinst.methodNa
).CoolEnum inst;
followed byinst.SOME_ENUM_VALU
shouldn't suggest anything).node_to_enum.go
.CoolEnum.SOME_ENUM_VALUE.methodNa
should provide suggestions where appropriate).Also, updated the stdlib shims to accommodate for an updated FaultConstantBuilder API, as well as EnumeratorBuilder API, to include their modules and parent enum/fault names.
Some notable observed changes to the stdlib shims:
@body
, are now being properly detected and included in the arguments for macros.Extra
I've gone ahead and greatly simplified some of the existing tests by automatically fetching the cursor position. Take a look!
Implementation
membersReadable
istrue
(yep, can read enum values and fault constants from this result); or if it is strictly a parent type of the symbol under the cursor (i.e. it was originally a variable, even though the result returned its type) - thenmembersReadable
isfalse
(do not suggest enum values and fault constants here).membersReadable
isfalse
(indicates the symbol is not an instance but the type itself).TODO:
All done!
Notes on AST
I can't really evaluate how much this could impact a rebase of the AST implementation at the moment as I haven't taken a deep look at the PR, but I think it's noteworthy that this PR contains some refactors regarding method search which will probably make it easier to reimplement.