Skip to content

LSP: Fix type bind, mark as experimental, deprecate direct LSP access#105016

Merged
Repiteo merged 1 commit into
godotengine:masterfrom
HolonProduction:lsp-unexpose
Feb 16, 2026
Merged

LSP: Fix type bind, mark as experimental, deprecate direct LSP access#105016
Repiteo merged 1 commit into
godotengine:masterfrom
HolonProduction:lsp-unexpose

Conversation

@HolonProduction

@HolonProduction HolonProduction commented Apr 4, 2025

Copy link
Copy Markdown
Member

Fixes (not anymore) #52162
Fixes (not anymore) #86132

The LSP types were not added at the right time, so they were not picked up at some places e.g. by the doctools (internal documentation recognized them though).

This PR binds them at the correct time to get picked up by the doc tools. The classes are now marked as experimental, the amount of internals that is exposed makes implementation of new LSP features while keeping behavior of all those methods infeasible.

In addition this PR marks some methods as deprecated:

  • Methods that have the primary purpose of interacting with connected clients: The LSP is not meant to be extendable and usage of those methods isn't possible in a meaningful way, since there is no way to actually obtain information about the connected clients
  • Methods that directly implement an LSP endpoint: Those had to be exposed due to how JSONRPC functioned before JSONRPC: Require manual method registration #104890 . They are not save to access as public API though for two reasons:
    1. They expect to be communicating with an compliant LSP client, so users would have to ensure to follow the LSP lifecycle when using those, it's unlikely that they will.
    2. Some of those methods rely on context from the networking code (which peer is processed at the moment). When accessing those methods not through the networking code this context isn't set correctly, which could lead to incorrect behavior.
@HolonProduction

Copy link
Copy Markdown
Member Author

Updated to also fix the timing of registering the singleton, thus fixing two old issues about it.

@Mickeon Mickeon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If this is approved by others, the methods that are not deprecated should absolutely provide a meaningful description.

Comment thread doc/classes/GDScriptLanguageProtocol.xml Outdated
@HolonProduction HolonProduction force-pushed the lsp-unexpose branch 2 times, most recently from fc2cf9a to fb36523 Compare April 6, 2025 13:22
@HolonProduction

Copy link
Copy Markdown
Member Author

Seems like singletons must directly inherit Object. Not sure how to precede here 🤷

Comment thread doc/classes/GDScriptLanguageProtocol.xml Outdated
Comment thread doc/classes/GDScriptLanguageProtocol.xml Outdated
<method name="is_smart_resolve_enabled" qualifiers="const">
<return type="bool" />
<description>
Returns whether the language server is providing the smart resolve feature. The feature can be configured through the editor settings.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Returns whether the language server is providing the smart resolve feature. The feature can be configured through the editor settings.
Returns [code]true[/code] if the language server is providing the smart resolve feature, [code]false[/code] otherwise. The feature can be configured using [member EditorSettings.network/language_server/enable_smart_resolve].

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The editor settings does not show up in the docs, so I'd rather not add a link which might be broken.

Comment thread doc/classes/GDScriptWorkspace.xml Outdated
Comment thread doc/classes/GDScriptLanguageProtocol.xml
@HolonProduction

Copy link
Copy Markdown
Member Author

I removed the singleton binding from this PR:

What does this PR do now:

  • Bind types at correct time for doc tool
  • Add documentation for LSP classes
  • Marks LSP classes as experimental
  • Deprecates a lot of methods for the reasons mentioned above

The singleton binding is still broken. This should be tackled separately.

Comment thread modules/gdscript/language_server/gdscript_workspace.cpp
@HolonProduction HolonProduction force-pushed the lsp-unexpose branch 2 times, most recently from a77675a to ad7ce7e Compare September 17, 2025 08:51
Comment thread modules/gdscript/doc_classes/GDScriptLanguageProtocol.xml Outdated

@akien-mga akien-mga left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me.

@akien-mga akien-mga modified the milestones: 4.x, 4.7 Feb 16, 2026
@Repiteo Repiteo merged commit c9c4446 into godotengine:master Feb 16, 2026
20 checks passed
@Repiteo

Repiteo commented Feb 16, 2026

Copy link
Copy Markdown
Contributor

Thanks!

@HolonProduction HolonProduction deleted the lsp-unexpose branch February 16, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment