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

LemMinX illegally invokes client/unregisterCapability with empty arguments upon startup #1586

Open
deathaxe opened this issue Oct 3, 2023 · 2 comments

Comments

@deathaxe
Copy link

deathaxe commented Oct 3, 2023

Recently noticed following error messages in Sublime Text's console, when opening XML documents.

Error handling request
Traceback (most recent call last):
  File "Packages\LSP\plugin\core\sessions.py", line 2273, in on_payload
    handler(result, req_id)
  File "Packages\LSP\plugin\core\sessions.py", line 1983, in m_client_unregisterCapability
    unregistrations = params["unregisterations"]  # typo in the official specification
KeyError: 'unregisterations'

The reason is client/unregisterCapability method being invoked without required unregisterations argument being passed, which is a protocol violation.

:: [14:29:44.642] <-- LemMinX client/unregisterCapability (16): {}
:: [14:29:44.642] ~~> LemMinX (16) (duration: 0ms): {'code': -32603, 'message': "'unregisterations'"}

related with: sublimelsp/LSP#2331

@angelozerr
Copy link
Contributor

Any contribution are welcome!

@deathaxe
Copy link
Author

deathaxe commented Oct 3, 2023

A pre-condition for this issue to trigger is to set "xml.symbols.enabled": false.

Looks like that's causing the capability to be unregistered right after being registered.

:: [16:29:56.840] <-- LemMinX client/registerCapability (15): {'registrations': [{'id': '1e186383-1ca3-4a0a-97a9-e0405291910a', 'method': 'textDocument/documentSymbol'}]}
:: [16:29:56.840] >>> LemMinX (15) (duration: 0ms): None
:: [16:29:56.840] <-- LemMinX client/unregisterCapability (16): {}
:: [16:29:56.840] ~~> LemMinX (16) (duration: 0ms): {'code': -32603, 'message': "'unregisterations'"}

That's suspicious though as I'd interpret the following lines as the capability being registered/unregistered on demand, based on value of xml.symbols.enabled.

XMLSymbolSettings symbolSettings = this.textDocumentService.getSharedSymbolSettings();
if (this.getClientCapabilities().isDocumentSymbolDynamicRegistrationSupported()) {
toggleCapability(symbolSettings.isEnabled(), DOCUMENT_SYMBOL_ID, TEXT_DOCUMENT_DOCUMENT_SYMBOL, null);
}

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

No branches or pull requests

2 participants