Skip to content

Commit 7848e4e

Browse files
committed
⬆️ Upgrade pygls, fix #7
1 parent 469a479 commit 7848e4e

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ repos:
3939
args:
4040
- --msg-filename
4141
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
42-
rev: 3.4.0
42+
rev: 3.4.1
4343
hooks:
4444
- id: editorconfig-checker
4545
- repo: https://github.com/jumanjihouse/pre-commit-hooks
@@ -55,16 +55,16 @@ repos:
5555
hooks:
5656
- id: yamllint
5757
- repo: https://github.com/executablebooks/mdformat
58-
rev: 0.7.22
58+
rev: 1.0.0
5959
hooks:
6060
- id: mdformat
6161
additional_dependencies:
6262
- mdformat-pyproject
6363
- mdformat-gfm
64-
- mdformat-myst
64+
# - mdformat-myst
6565
- mdformat-toc
6666
- mdformat-deflist
67-
# - mdformat-beautysh
67+
- mdformat-beautysh
6868
- mdformat-ruff
6969
- mdformat-config
7070
- mdformat-web
@@ -75,7 +75,7 @@ repos:
7575
additional_dependencies:
7676
- markdown-it-texmath
7777
- repo: https://github.com/astral-sh/ruff-pre-commit
78-
rev: v0.14.2
78+
rev: v0.14.4
7979
hooks:
8080
- id: ruff-check
8181
- id: ruff-format

src/tmux_language_server/server.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
Hover,
2424
MarkupContent,
2525
MarkupKind,
26+
PublishDiagnosticsParams,
2627
TextDocumentPositionParams,
2728
)
2829
from pygls.lsp.server import LanguageServer
@@ -55,15 +56,22 @@ def did_change(params: DidChangeTextDocumentParams) -> None:
5556
:type params: DidChangeTextDocumentParams
5657
:rtype: None
5758
"""
58-
document = self.workspace.get_document(params.text_document.uri)
59+
document = self.workspace.get_text_document(
60+
params.text_document.uri
61+
)
5962
self.trees[document.uri] = parser.parse(document.source.encode())
6063
diagnostics = get_diagnostics(
6164
document.uri,
6265
self.trees[document.uri],
6366
DIAGNOSTICS_FINDER_CLASSES,
6467
"tmux",
6568
)
66-
self.publish_diagnostics(params.text_document.uri, diagnostics)
69+
self.text_document_publish_diagnostics(
70+
PublishDiagnosticsParams(
71+
params.text_document.uri,
72+
diagnostics,
73+
)
74+
)
6775

6876
@self.feature(TEXT_DOCUMENT_DOCUMENT_LINK)
6977
def document_link(params: DocumentLinkParams) -> list[DocumentLink]:
@@ -73,7 +81,9 @@ def document_link(params: DocumentLinkParams) -> list[DocumentLink]:
7381
:type params: DocumentLinkParams
7482
:rtype: list[DocumentLink]
7583
"""
76-
document = self.workspace.get_document(params.text_document.uri)
84+
document = self.workspace.get_text_document(
85+
params.text_document.uri
86+
)
7787
return ImportTmuxFinder().get_document_links(
7888
document.uri, self.trees[document.uri]
7989
)
@@ -86,7 +96,9 @@ def hover(params: TextDocumentPositionParams) -> Hover | None:
8696
:type params: TextDocumentPositionParams
8797
:rtype: Hover | None
8898
"""
89-
document = self.workspace.get_document(params.text_document.uri)
99+
document = self.workspace.get_text_document(
100+
params.text_document.uri
101+
)
90102
uni = PositionFinder(params.position).find(
91103
document.uri, self.trees[document.uri]
92104
)
@@ -115,7 +127,9 @@ def completions(params: CompletionParams) -> CompletionList:
115127
:type params: CompletionParams
116128
:rtype: CompletionList
117129
"""
118-
document = self.workspace.get_document(params.text_document.uri)
130+
document = self.workspace.get_text_document(
131+
params.text_document.uri
132+
)
119133
uni = PositionFinder(params.position, right_equal=True).find(
120134
document.uri, self.trees[document.uri]
121135
)

0 commit comments

Comments
 (0)