Open ThakeeNathees opened 4 years ago
I'm glad to see that someone is finally working on this, thanks very much for the work!
Would it also be possible associate the "show hint" action to a keyboard shortcut (i.e. show the hint corresponding to the symbol at the cursor's location)? I mainly use the keyboard when coding and having to take the mouse each time I want to check the documentation would be inconvient.
Providing API for (optional) having this for custom classes and methods could be useful as well
@me2beats This will probably be done automatically by https://github.com/godotengine/godot/pull/41095.
@me2beats yeah it's possible with godotengine/godot#41095 tested locally. I've exams next month, I'll improve it and implement color themes when it's done :)
Is work on this still ongoing? The last commit in the linked fork was over a year and a half ago
Is work on this still ongoing? The last commit in the linked fork was over a year and a half ago
@ThakeeNathees has been inactive on GitHub since July 2021, so https://github.com/godotengine/godot/pull/41502 will likely have to be salvaged by another contributor. This won't be trivial to rebase against the latest master
branch since the CodeEdit refactor was recently merged.
I would really like to have this feature now. Is there any way to make a custom Godot Editor build with the functionality shown in the gif at the top?
Is there any way to make a custom Godot Editor build with the functionality shown in the gif at the top?
No, as there is no up-to-date branch with an implementation of this feature. As I mentioned above, the script editor received a large refactor last year, so most of the work would have to be redone from scratch.
Efforts to rebase https://github.com/godotengine/godot/pull/41502 against the latest master
branch are welcome, but it won't be an easy task.
I'm interested in taking a stab at this issue so I've done a quick review of (1) what we already have that is similar, (2) references to the solution in other applications, and (3) the possible features/requirements that may be considered.
Term | Definition |
---|---|
Symbol | A value, function, class, module, or any other construct that can be referenced in code. |
Godot Documentation | The official documentation provided for the Godot game engine. |
Code Documentation | The comments, annotations, API references, and other documentation created by a developer to explain the purpose and functionality of the code to other developers, as well as to provide additional context and insights into the code. |
_ready()
)EditorHelpBit
.My latest WIP branch for this issue:
My PR Draft
Some improvements I'd like to make to this comment include:
Question: Should I create another issue or a discussion for the contents of this comment? I'm not sure if the scope of this issue encompasses these possible features and if this is the right place for their discussion in case it leads to off topic comments.
d. Should there be a delay on hover before showing the tooltip? For example, the inspector tooltip has a delay.
Definitely – I'd use the same delay as GUI tooltips and EditorHelpBits.
In general, I'd recommend reusing the already existing EditorHelpBit rather than creating something bespoke for the script editor. (EditorHelpBit is what's used in the inspector when hovering property names.)
Here are some UI designs that I experimented with (using HTML/CSS).
You can find the file or preview it below.
_ready()
function. Nothing else will show the tooltip on hover.Just to point out I have just rebased godotengine/godot#63908 to master.
As a side-note, it's worth adding Editor Settings to determine what/how much is shown on the hovers. Personally, I'd never really want to hover and see function documentation. I'd mostly want to hover arguments to see their name and type (especially for custom functions), so a very minimal hover would be preferred.
If the tooltip could automatically adjust it's content based on settings, it could remain one general hover, while still allowing users control over what information they see!
Would also be nice if the tip showed on auto completions as a sub popup.
Would also be nice if the tip showed on auto completions as a sub popup.
I presume you mean something like this?
Would also be nice if the tip showed on auto completions as a sub popup.
I presume you mean something like this?
Yup, just like that!
Not sure if it is supported or not (the docs don't show support), so maybe this would be a new proposal, using a @param
tag to describe a function parameter would be nice to show in the popup (again similar to vscode).
## Do something with the two colors
## @param color1 Description of color 1
## @param color2 Description of color 2
func fancy_color(color1: Color, color2: Color):
# Do something with the two colors
So, when creating a JavaScript/TypeScript function, the popup shows like this image, as seen, it auto formats the @param
items with the name, and its description.
Not sure if it is supported or not (the docs don't show support), so maybe this would be a new proposal, using a @param tag to describe a function parameter would be nice to show in the popup (again similar to vscode).
The way Godot class reference docs are written favors documenting parameters inline in the description, using [param name]
references to reference parameters in the description.
For example:
## Do something with the two colors [param color1] (which is a fancy color)
## and [param color2] (which is an even fancier color).
func fancy_color(color1: Color, color2: Color):
# Do something with the two colors
It has been 3 years and this feature has not been officially launched yet. It seems that Godot still has a long way to go. Thank you to those who have contributed to this feature.
Describe the project you are working on: Description hint on hover for the text edit(https://github.com/ThakeeNathees/godot/tree/TextEdit-hover-hint)
Describe the problem or limitation you are having in your project: it's one of the essential feature for a fully featured script editor and currently we lack of. Also the implementation of GDScript doc comments (https://github.com/godotengine/godot/pull/41095) it'll improve the user experience.
Describe the feature / enhancement and how it helps to overcome the problem or limitation: when a symbol is hovered by the mouse, the text editor emits a signal to validate the symbol (like when it's being hovered with a ctrl), and when validating for that symbol it'll add some additional data (like description, type, class_name, return_type, arguments, etc.,) and display them at the text edit's draw call.
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams: A working example (this will work with doc comments when it'll be merged)
If this enhancement will not be used often, can it be worked around with a few lines of script?: No, It would be a great usability improvement and can't be worked around with the script.
Is there a reason why this should be core and not an add-on in the asset library?: there is no way to implement this with an add-on
Bugsquad edit (keywords for easier searching): tooltip