From ae6283b5f286e68771d137e6ca06a9616c9100e0 Mon Sep 17 00:00:00 2001 From: Alex Carney Date: Sun, 31 Jul 2022 19:00:51 +0100 Subject: [PATCH] lsp: Backport language_id patch from pygls While the `language_id` patch is still unreleased and that we're still supporting Python 3.6 (for now) this backports the functionality into esbonio directly. --- lib/esbonio/esbonio/lsp/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/esbonio/esbonio/lsp/__init__.py b/lib/esbonio/esbonio/lsp/__init__.py index 1c9edb21..454562dd 100644 --- a/lib/esbonio/esbonio/lsp/__init__.py +++ b/lib/esbonio/esbonio/lsp/__init__.py @@ -152,7 +152,11 @@ def on_shutdown(ls: RstLanguageServer, *args): @server.feature(TEXT_DOCUMENT_DID_OPEN) def on_open(ls: RstLanguageServer, params: DidOpenTextDocumentParams): - pass + + # TODO: Delete me when we've dropped Python 3.6 and a pygls release that + # remembers the language id is available. + doc = ls.workspace.get_document(params.text_document.uri) + doc.language_id = params.text_document.language_id # type: ignore @server.feature(TEXT_DOCUMENT_DID_CHANGE) def on_change(ls: RstLanguageServer, params: DidChangeTextDocumentParams):