Skip to content
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

Use crumb to get return type of a templated function or the type of a cast #178

Closed
wants to merge 7 commits into from

Conversation

ryuukk
Copy link

@ryuukk ryuukk commented Jun 19, 2022

Before:

image

After:

image

Don't mind the colors, it's just my theme that is broken

@ryuukk ryuukk changed the title Use crumb to get return type of a templated function Use crumb to get return type of a templated function or the type of a cast Jun 19, 2022
@ryuukk
Copy link
Author

ryuukk commented Jun 19, 2022

And now also supports casting!

image

@ryuukk
Copy link
Author

ryuukk commented Jun 19, 2022

Not ready to be merged until DCD can be compiled with latest version of libdparse/dsymbol..

Copy link
Member

@WebFreak001 WebFreak001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a test for this?

else if (currentSymbol.type is null)
break; // this is a fully resolved type (casting)!
else if (currentSymbol.type.name == "void")
return; // it's void, no need to continue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about void[]?

@ryuukk
Copy link
Author

ryuukk commented Jun 20, 2022

can you add a test for this?

yes, i am working on that right now

@ryuukk
Copy link
Author

ryuukk commented Jun 22, 2022

The more i test things, the more i realize that the code is broken, DSymbol doesn't hold enough information to make such guesses about templates/casting.. therefore it produces a lot wrong completions as a side effect

The code base is also challenging to read and follow, i'm not sure i will be able to continue this PR, it's very challenging

@ryuukk
Copy link
Author

ryuukk commented Jun 23, 2022

I think i managed to find a way to do it reliably, but that'll need to also touch DCD

I will send a PR once DSymbol and DCD get merged together, so the PR will be easier to review

cc @WebFreak001 @nordlow

@WebFreak001
Copy link
Member

moved to dlang-community/DCD#681

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants