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

The documentation for a class defined by the keyword 'class_name' does not appear when searching using the '(doc) Search Help' #86577

Open
adrbodev opened this issue Dec 28, 2023 · 3 comments · May be fixed by #95821

Comments

@adrbodev
Copy link

Tested versions

Reproducible in : 4.2.stable

System information

Godot v4.2.stable - Ubuntu 22.04.3 LTS 22.04 - X11 - Vulkan (Forward+) - dedicated Quadro M2000M (nvidia; 535.129.03) - Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz (8 Threads)

Issue description

The documentation for a class defined by the keyword 'class_name' does not appear when searching using the 'Search Help (doc)' bar located in the Workspace Script in the top-right corner of the script editor.

This documentation appears in the search bar the first time the file is loaded or the first time Godot is opened after modifying the file. Subsequent times, the class documentation is no longer suggested in the search bar.

Steps to reproduce

If you use the MRP (Minimal reproduction project), open the project and jump to the step 3.

  1. Download the following repository :
    git clone https://gitlab.com/Tomateauketchup/la-state-makina.git /tmp/la-state-makina

  2. Create a new empty project with Godot as follows:

  • Directory : /tmp/la-state-makina
  • Name : la-state-makina

Set Version Control metadata to None.

(ignore the warnings saying that the directory is not empty)

  1. Ignore the four errors associated with the following files:
  • unit_test_sm_clock.gd
  • unit_test_sm_clock.gd
  • unit_test_sm_json_serializer.gd
  • unit_test_sm_state_machine.gd

If you want to resolve these errors, install the gdUnit4 asset.
But this is not important and not needed to reproduce the bug.

  1. Do not exit the Godot editor. Click on "Script" in the Workspace. In the top-right corner of the script editor, click on "Search Help," and enter "SMStateMachine."

You should be able to open the SMStateMachine documentation, which should display correctly.

4 bis) (Optional) In the Godot editor, close all documentation, and scripts.

  1. Quit the godot IDE.

  2. Reopen the godot IDE.

If you didn't made the 4bis) operation, you should obtain the error :
"No loader found for resource: res://addons/la-state-makina/src/state_machine/sm_state_machine.gd (expected type: SMStateMachine)"
If you made the 4 bis) operation, you have no error.

  1. Click on "Script" in the Workspace. In the top-right corner of the script editor, click on "Search Help," and enter "SMStateMachine."

The search toolbar should not suggest SMStateMachine.

This is a bug because we don't change anything in our project and the editor was able to display previously the documentation !

  1. Quit the godot IDE.

  2. Modify the source code with an external IDE (like vim) :
    /tmp/la-state-makina/addons/la-state-makina/src/state_machine/sm_state_machine.gd
    Add an empty line at the end of the file.

  3. Reopen the godot IDE

  4. Click on "Script" in the Workspace. In the top-right corner of the script editor, click on "Search Help," and enter "SMStateMachine."

Now, the search toolbar should suggest SMStateMachine, and you should be able to open the SMStateMachine documentation, which should display correctly.

11bis) (optional) In the Godot editor, close all scenes, documentation, and scripts.

  1. Quit the godot IDE.

  2. Reopen the godot IDE

If you didn't made the 11bis) operation, you should obtain the error :
"No loader found for resource: res://addons/la-state-makina/src/state_machine/sm_state_machine.gd (expected type: SMStateMachine)"
If you made the 11bis) operation, you have no error.

  1. Click on "Script" in the Workspace. In the top-right corner of the script editor, click on "Search Help," and enter "SMStateMachine."

The search toolbar should no longer suggest SMStateMachine.

This is a bug, the editor was able to display previously the documentation.

Minimal reproduction project (MRP)

la-state-makina.zip

@dalexeev
Copy link
Member

Probably a duplicate of:

@nagidev
Copy link
Contributor

nagidev commented Apr 11, 2024

Facing the same issue.
One workaround I found was to define class_name YouClass after the first documentation comment.
Example:

extends Control
## A node for doing some stuff
class_name BetterControl

anvilfolk added a commit to anvilfolk/godot that referenced this issue Aug 19, 2024
This PR adds a script documentation cache in the project folder.
It is loaded at alongside native documentation caches. This makes
scripts fully accessible through Search Help, including their
members, etc, right from project start, without having to compile
every single script.

Fixes godotengine#72406, fixes godotengine#86577.
anvilfolk added a commit to anvilfolk/godot that referenced this issue Aug 20, 2024
This PR adds a script documentation cache in the project folder.
It is loaded at alongside native documentation caches. This makes
scripts fully accessible through Search Help, including their
members, etc, right from project start, without having to compile
every single script.

Fixes godotengine#72406, fixes godotengine#86577.
anvilfolk added a commit to anvilfolk/godot that referenced this issue Aug 20, 2024
This PR adds a script documentation cache in the project folder.
It is loaded at alongside native documentation caches. This makes
scripts fully accessible through Search Help, including their
members, etc, right from project start, without having to compile
every single script.

Fixes godotengine#72406, fixes godotengine#86577.
@anvilfolk
Copy link
Contributor

anvilfolk commented Aug 22, 2024

I tested @nagidev's workaround on master and it did not work for me, so it was likely something else that happened to recompile the script in the background that time. Tested the MRP as per OP and it does appear to be a duplicate of #72406 as pointed out by @dalexeev. It is looking like it will be fixed by #95821.

Recommend closing this as a duplicate and reopening later if found to behave different due to classes being in an addon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Fix pending review
Development

Successfully merging a pull request may close this issue.

4 participants