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

Add option to open online doc for selected class in script editor #90952

Merged
merged 1 commit into from
May 17, 2024

Conversation

Gaktan
Copy link
Contributor

@Gaktan Gaktan commented Apr 20, 2024

When the script editor's current tab is a script (or no tab is opened):
image

When the current tab is a class:
image

There might be an issue if we try to open a custom class, but from what I can tell, it's not possible to open the documentation for a custom class in the editor. (At least I was not able to)

Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested locally, it mostly works as expected. I've tested various classes such as HTTPClient, AnimatedSprite2D and so on. This feature makes sense to quickly access the online docs for the current class, which makes it easier to link to people (e.g. on forums).

One issue is that in user-defined classes, clicking Open in Online Docs will point to a nonexisting page. For instance, a class named Test will point me to https://docs.godotengine.org/en/latest/classes/class_test.html which doesn't exist. I suggest finding a way to disable this button for user-defined classes.

@Gaktan
Copy link
Contributor Author

Gaktan commented May 8, 2024

Yes indeed, I did not test this since I was not able to open the documentation for the custom classes in my project. I assumed it was not possible.

Can you clarify the steps you used to open a custom class's documentation?

@Calinou
Copy link
Member

Calinou commented May 9, 2024

Can you clarify the steps you used to open a custom class's documentation?

Add this line above an extends declaration in a script:

class_name Test

Then use Search Help in the top-right corner of the script editor and search for Test, and open its page.

@Gaktan
Copy link
Contributor Author

Gaktan commented May 9, 2024

That's odd, it's not working for me:
image

Do I need to enable an option somewhere?

@Gaktan
Copy link
Contributor Author

Gaktan commented May 9, 2024

Nevermind, I figured it out. The documentation is not available for classes that only have private attributes and functions by the looks of it.

@Gaktan
Copy link
Contributor Author

Gaktan commented May 9, 2024

This now works with custom classes.
I have no idea if this fix works with custom C++ classes though, as I have no way to test this currently.

@Gaktan Gaktan requested a review from Calinou May 9, 2024 12:13
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

The button now correctly displays Online Docs (instead of Open in Online Docs) when selecting a custom class named Test, but clicking it still opens the page https://docs.godotengine.org/en/latest/classes/class_test.html which doesn't exist.

@Gaktan Gaktan requested a review from Calinou May 13, 2024 17:41
@Chaosus
Copy link
Member

Chaosus commented May 13, 2024

Commits needs to be squashed (see https://docs.godotengine.org/en/latest/contributing/workflow/pr_workflow.html#the-interactive-rebase).

Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested locally, it works as expected now. Code looks good to me.

@akien-mga akien-mga modified the milestones: 4.x, 4.3 May 16, 2024
@akien-mga akien-mga merged commit 096fb3a into godotengine:master May 17, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks! And congrats for your first merged Godot contribution 🎉

@Gaktan Gaktan deleted the add_online_doc_link branch May 17, 2024 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants