Skip to content

Commit

Permalink
lsp: Backport language_id patch from pygls
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alcarney committed Jul 31, 2022
1 parent a03775a commit ae6283b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/esbonio/esbonio/lsp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit ae6283b

Please sign in to comment.