Skip to content

Commit 73e81bf

Browse files
committed
⬆️ Upgrade pygls
1 parent fe9587a commit 73e81bf

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ repos:
6868
- mdformat-myst
6969
- mdformat-toc
7070
- mdformat-deflist
71-
- mdformat-beautysh
71+
# - mdformat-beautysh
7272
- mdformat-ruff
7373
- mdformat-config
7474
- mdformat-web
@@ -83,12 +83,12 @@ repos:
8383
hooks:
8484
- id: shfmt
8585
- repo: https://github.com/astral-sh/ruff-pre-commit
86-
rev: v0.14.1
86+
rev: v0.14.2
8787
hooks:
8888
- id: ruff-check
8989
- id: ruff-format
9090
- repo: https://github.com/kumaraditya303/mirrors-pyright
91-
rev: v1.1.406
91+
rev: v1.1.407
9292
hooks:
9393
- id: pyright
9494

src/termux_language_server/server.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
Hover,
2828
MarkupContent,
2929
MarkupKind,
30+
PublishDiagnosticsParams,
3031
TextDocumentPositionParams,
3132
TextEdit,
3233
)
@@ -72,7 +73,9 @@ def did_change(params: DidChangeTextDocumentParams) -> None:
7273
filetype = get_filetype(params.text_document.uri)
7374
if filetype == "":
7475
return None
75-
document = self.workspace.get_document(params.text_document.uri)
76+
document = self.workspace.get_text_document(
77+
params.text_document.uri
78+
)
7679
self.trees[document.uri] = parser.parse(document.source.encode())
7780
diagnostics = get_diagnostics(
7881
document.uri,
@@ -84,7 +87,12 @@ def did_change(params: DidChangeTextDocumentParams) -> None:
8487
from .tools.namcap import namcap
8588

8689
diagnostics += namcap(document.path, document.source)
87-
self.publish_diagnostics(params.text_document.uri, diagnostics)
90+
self.text_document_publish_diagnostics(
91+
PublishDiagnosticsParams(
92+
params.text_document.uri,
93+
diagnostics,
94+
)
95+
)
8896

8997
# https://github.com/termux/termux-language-server/issues/19#issuecomment-2413779969
9098
# @self.feature(TEXT_DOCUMENT_FORMATTING)
@@ -98,7 +106,9 @@ def format(params: DocumentFormattingParams) -> list[TextEdit]:
98106
filetype = get_filetype(params.text_document.uri)
99107
if filetype == "":
100108
return []
101-
document = self.workspace.get_document(params.text_document.uri)
109+
document = self.workspace.get_text_document(
110+
params.text_document.uri
111+
)
102112
return get_text_edits(
103113
document.uri,
104114
self.trees[document.uri],
@@ -117,7 +127,9 @@ def document_link(params: DocumentLinkParams) -> list[DocumentLink]:
117127
filetype = get_filetype(params.text_document.uri)
118128
if filetype == "":
119129
return []
120-
document = self.workspace.get_document(params.text_document.uri)
130+
document = self.workspace.get_text_document(
131+
params.text_document.uri
132+
)
121133
if filetype in {"build.sh", "subpackage.sh"}:
122134
return CSVFinder(filetype).get_document_links(
123135
document.uri,
@@ -154,7 +166,9 @@ def hover(params: TextDocumentPositionParams) -> Hover | None:
154166
filetype = get_filetype(params.text_document.uri)
155167
if filetype == "":
156168
return None
157-
document = self.workspace.get_document(params.text_document.uri)
169+
document = self.workspace.get_text_document(
170+
params.text_document.uri
171+
)
158172
uni = PositionFinder(params.position).find(
159173
document.uri, self.trees[document.uri]
160174
)
@@ -219,7 +233,9 @@ def completions(params: CompletionParams) -> CompletionList:
219233
filetype = get_filetype(params.text_document.uri)
220234
if filetype == "":
221235
return CompletionList(False, [])
222-
document = self.workspace.get_document(params.text_document.uri)
236+
document = self.workspace.get_text_document(
237+
params.text_document.uri
238+
)
223239
uni = PositionFinder(params.position, right_equal=True).find(
224240
document.uri, self.trees[document.uri]
225241
)

0 commit comments

Comments
 (0)