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

Update pygls version #101

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions hdl_checker/lsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,17 @@
from tempfile import mkdtemp
from typing import Any, Callable, Iterable, List, Optional, Set, Tuple, Union

from pygls.features import (
DEFINITION,
HOVER,
from pygls.server import LanguageServer
from lsprotocol.types import (
TEXT_DOCUMENT_DEFINITION,
TEXT_DOCUMENT_HOVER,
INITIALIZE,
INITIALIZED,
REFERENCES,
TEXT_DOCUMENT_REFERENCES,
TEXT_DOCUMENT_DID_CHANGE,
TEXT_DOCUMENT_DID_OPEN,
TEXT_DOCUMENT_DID_SAVE,
WORKSPACE_DID_CHANGE_CONFIGURATION,
)
from pygls.server import LanguageServer
from pygls.types import (
ClientCapabilities,
Diagnostic,
DiagnosticSeverity,
Expand Down Expand Up @@ -167,7 +165,7 @@ def __init__(self, *args, **kwargs) -> None:
self.onConfigUpdate(None)
self._global_diags: Set[CheckerDiagnostic] = set()
self.initialization_options: Optional[Any] = None
self.client_capabilities: Optional[ClientCapabilities] = None
self._client_capabilities: Optional[ClientCapabilities] = None

@property
def checker(self) -> Server:
Expand Down Expand Up @@ -353,7 +351,7 @@ def _use_markdown_for_hover(self):
try:
return (
MarkupKind.Markdown.value
in self.client_capabilities.textDocument.hover.contentFormat
in self._client_capabilities.textDocument.hover.contentFormat
)
except AttributeError:
return False
Expand Down Expand Up @@ -536,7 +534,7 @@ def setupLanguageServerFeatures(server: HdlCheckerLanguageServer) -> None:
@server.feature(INITIALIZE)
def initialize(self: HdlCheckerLanguageServer, params: InitializeParams) -> None:
options = params.initializationOptions
self.client_capabilities = params.capabilities
self._client_capabilities = params.capabilities
self.initialization_options = options

@server.feature(INITIALIZED)
Expand Down Expand Up @@ -570,17 +568,17 @@ def didChangeConfiguration(
) -> None:
self.onConfigUpdate(settings)

@server.feature(HOVER)
@server.feature(TEXT_DOCUMENT_HOVER)
def onHover(self: HdlCheckerLanguageServer, params: HoverParams) -> Optional[Hover]:
return self.hover(params)

@server.feature(REFERENCES)
@server.feature(TEXT_DOCUMENT_REFERENCES)
def onReferences(
self: HdlCheckerLanguageServer, params: ReferenceParams
) -> Optional[List[Location]]:
return self.references(params)

@server.feature(DEFINITION)
@server.feature(TEXT_DOCUMENT_DEFINITION)
def onDefinition(
self: HdlCheckerLanguageServer, params: TextDocumentPositionParams
) -> Optional[List[Location]]:
Expand Down
2 changes: 1 addition & 1 deletion hdl_checker/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def _watchPidWrapper():

if args.lsp:
stdin, stdout = _binaryStdio()
server = lsp.HdlCheckerLanguageServer()
server = lsp.HdlCheckerLanguageServer("hdl_checker", version)
lsp.setupLanguageServerFeatures(server)
server.start_io(stdin=stdin, stdout=stdout)
else:
Expand Down
4 changes: 2 additions & 2 deletions hdl_checker/tests/test_lsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ def test_ReportBuildSequencePlain(self):
) # pylint: disable=invalid-name
def test_ReportBuildSequenceFallback(self):
_logger.info("#" * 100)
with patch.object(self.server, "client_capabilities", None):
with patch.object(self.server, "_client_capabilities", None):
self.runTestBuildSequenceTable(tablefmt="plain")

@patch(
Expand All @@ -518,7 +518,7 @@ def test_ReportBuildSequenceMarkdown(self):
_logger.info("#" * 100)
with patch.object(
self.server,
"client_capabilities",
"_client_capabilities",
ClientCapabilities(
text_document=TextDocumentClientCapabilities(
synchronization=None,
Expand Down
7 changes: 2 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,11 @@
'backports.functools_lru_cache; python_version<"3.2"',
'bottle>=0.12.9',
'enum34>=1.1.6; python_version<"3.3"',
'future>=0.14.0',
'futures; python_version<"3.2"',
'prettytable>=0.7.2',
'pygls==0.9.1',
'pygls>0.9.1',
'requests>=2.20.0',
'six>=1.10.0',
'tabulate>=0.8.5',
'typing>=3.7.4',
'typing>=3.7.4; python_version<"3.5"',
'waitress>=0.9.0', ],
cmdclass = versioneer.get_cmdclass(),
entry_points = {
Expand Down