Skip to content

Commit

Permalink
💩 Disable formatting temporarily
Browse files Browse the repository at this point in the history
  • Loading branch information
Freed-Wu committed Oct 15, 2024
1 parent 66db21b commit 91298e4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ exclude: ^templates/|\.json$

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: fix-byte-order-marker
Expand Down Expand Up @@ -51,7 +51,7 @@ repos:
exclude_types:
- zsh
- repo: https://github.com/rhysd/actionlint
rev: v1.7.2
rev: v1.7.3
hooks:
- id: actionlint
- repo: https://github.com/adrienverge/yamllint
Expand Down Expand Up @@ -83,12 +83,12 @@ repos:
hooks:
- id: shfmt
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.7
rev: v0.6.9
hooks:
- id: ruff
- id: ruff-format
- repo: https://github.com/kumaraditya303/mirrors-pyright
rev: v1.1.381
rev: v1.1.383
hooks:
- id: pyright

Expand Down
13 changes: 10 additions & 3 deletions src/termux_language_server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
TEXT_DOCUMENT_DID_CHANGE,
TEXT_DOCUMENT_DID_OPEN,
TEXT_DOCUMENT_DOCUMENT_LINK,
TEXT_DOCUMENT_FORMATTING,
# TEXT_DOCUMENT_FORMATTING,
TEXT_DOCUMENT_HOVER,
CompletionItem,
CompletionItemKind,
Expand Down Expand Up @@ -86,7 +86,8 @@ def did_change(params: DidChangeTextDocumentParams) -> None:
diagnostics += namcap(document.path, document.source)
self.publish_diagnostics(params.text_document.uri, diagnostics)

@self.feature(TEXT_DOCUMENT_FORMATTING)
# https://github.com/termux/termux-language-server/issues/19#issuecomment-2413779969
# @self.feature(TEXT_DOCUMENT_FORMATTING)
def format(params: DocumentFormattingParams) -> list[TextEdit]:
r"""Format.
Expand Down Expand Up @@ -177,6 +178,7 @@ def hover(params: TextDocumentPositionParams) -> Hover | None:
if (
parent.type == "array"
and parent.parent is not None
and parent.parent.children[0].text is not None
and parent.parent.children[0].text.decode()
in PACKAGE_VARIABLES.get(filetype, set())
):
Expand Down Expand Up @@ -230,6 +232,7 @@ def completions(params: CompletionParams) -> CompletionList:
if (
parent.type == "array"
and parent.parent is not None
and parent.parent.children[0].text is not None
and parent.parent.children[0].text.decode()
in PACKAGE_VARIABLES.get(filetype, set())
):
Expand All @@ -250,7 +253,11 @@ def completions(params: CompletionParams) -> CompletionList:
],
)
schema = get_schema(filetype)
if parent.type == "array" and parent.parent is not None:
if (
parent.type == "array"
and parent.parent is not None
and parent.parent.children[0].text is not None
):
property = schema["properties"].get(
parent.parent.children[0].text.decode(), {}
)
Expand Down

0 comments on commit 91298e4

Please sign in to comment.