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

Improved tooltip: functions, tuples, etc #847

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

rongcuid
Copy link

This is an attempt to fix #631.

I have implemented the behavior specified in the issue, allowing tooltip for f when Shift-Tab is pressed inside a function call f(x, y, ... |) or right outside the call f(x, y, ...)|. | is cursor. Detailed behavior is in docstring.

The current implementation has some string hacks which I consider ugly (explained thoroughly, I hope, in docstrings). If I can dig deeper, I prefer an implementation using a proper Julia language parser. Maybe one that comes from Julia itself.

In any case, I tested with quite a few of my Notebooks, and they all seem to work well.

I forgot to squash the commits, though.

@stevengj
Copy link
Member

Would be good to add a test/completion.jl with some tests for get_token.

src/handlers.jl Outdated Show resolved Hide resolved
@stevengj
Copy link
Member

I agree that it would be nice to use the Julia parser; the basic issue is that the user might be asking for help on code they haven't finished writing yet…

@rongcuid
Copy link
Author

I will try quickly adding some test cases. It's the first time I develop Julia packages so I will need to check out some docs...

@rongcuid
Copy link
Author

I have changed behavior slightly to make sure the basic x + y + z works, giving x, y, and z respectively. Further making the completion more robust might be out of scope for my goals, so I propose to merge this as an intermediate solution which provides a slight quality of life improvement. It should be good enough for many common cases.

@rongcuid
Copy link
Author

rongcuid commented Jun 14, 2019

As a note, the julia tokenizer might be helpful for a better solution:

https://github.com/JuliaLang/Tokenize.jl

@rongcuid
Copy link
Author

Do you have any plan on merging? I think the current state is good enough for an intermediate improvement.

@rongcuid
Copy link
Author

rongcuid commented Jul 4, 2019

Any updates?

@rongcuid
Copy link
Author

Any activities on this? @stevengj can this be merged, or are there some feedback?

src/handlers.jl Outdated Show resolved Hide resolved
@rongcuid
Copy link
Author

Any more reviews?

@rongcuid
Copy link
Author

rongcuid commented Oct 3, 2019

Do you think this is mergable or is it too hacky to be put into mainline? I have been waiting for a decision for quite a while.

@rongcuid
Copy link
Author

rongcuid commented May 7, 2021

Is there anything I still need to do? Or is this superseded by some other patches?

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.

Improve tooltips by always showing the docstring of the function being called
3 participants