Skip to content

Commit

Permalink
Remove custom DID_OPEN and DID_CHANGE features
Browse files Browse the repository at this point in the history
These are already defined by pygls; turns out the bug I ran into before
is more with the INCREMENTAL versus FULL than the need for me to
implement my open/close options.

Seems to improve performance as well.
  • Loading branch information
pappasam committed Aug 20, 2019
1 parent 6cfb9ba commit 604a4ef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 36 deletions.
37 changes: 2 additions & 35 deletions jedi_language_server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,11 @@
from typing import List, Optional

from pygls.server import LanguageServer
from pygls.features import (
COMPLETION,
DEFINITION,
HOVER,
REFERENCES,
RENAME,
TEXT_DOCUMENT_DID_CHANGE,
TEXT_DOCUMENT_DID_OPEN,
)
from pygls.features import COMPLETION, DEFINITION, HOVER, REFERENCES, RENAME
from pygls.types import (
CompletionItem,
CompletionList,
CompletionParams,
DidChangeTextDocumentParams,
DidOpenTextDocumentParams,
Hover,
Location,
RenameParams,
Expand All @@ -40,8 +30,7 @@

SERVER = LanguageServer()

# NOTE: neovim LanguageClient doesn't support incremental completions. When it
# does, I may consider relaxing this constraint
# NOTE: Incremental completions appear to be broken for me. Currently debugging
SERVER.sync_kind = TextDocumentSyncKind.FULL


Expand Down Expand Up @@ -121,25 +110,3 @@ def lsp_rename(
else:
changes[location.uri].append(text_edit)
return WorkspaceEdit(changes=changes)


@SERVER.feature(TEXT_DOCUMENT_DID_CHANGE)
def lsp_did_change(
server: LanguageServer, params: DidChangeTextDocumentParams
) -> None:
"""Updates file when the file changes on server"""
workspace = server.workspace
if params.contentChanges:
for change in params.contentChanges:
workspace.update_document(
text_doc=params.textDocument, change=change
)


@SERVER.feature(TEXT_DOCUMENT_DID_OPEN)
def lsp_did_open(
server: LanguageServer, params: DidOpenTextDocumentParams
) -> None:
"""Text document did, in fact, open"""
workspace = server.workspace
workspace.put_document(params.textDocument)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ line-length = 79

[tool.poetry]
name = "jedi-language-server"
version = "0.1.1"
version = "0.1.2"
description = "A language server for Jedi!"
authors = ["Sam Roeca <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 604a4ef

Please sign in to comment.