Skip to content

Commit

Permalink
Add support for ruff: noqa to noqa hover
Browse files Browse the repository at this point in the history
  • Loading branch information
bluetech committed Feb 25, 2023
1 parent aa32918 commit d73120d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ruff_lsp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def did_save(params: DidSaveTextDocumentParams) -> None:

@LSP_SERVER.feature(TEXT_DOCUMENT_DID_CHANGE)
def did_change(params: DidChangeTextDocumentParams) -> None:
"""LSP handler for textDocument/didSave request."""
"""LSP handler for textDocument/didChange request."""
document = LSP_SERVER.workspace.get_document(params.text_document.uri)
diagnostics: list[Diagnostic] = _linting_helper(document)
LSP_SERVER.publish_diagnostics(document.uri, diagnostics)
Expand Down Expand Up @@ -194,7 +194,9 @@ def _get_severity(code: str) -> DiagnosticSeverity:
return DiagnosticSeverity.Warning


NOQA_REGEX = re.compile(r"(?i:# noqa)(?::\s?(?P<codes>([A-Z]+[0-9]+(?:[,\s]+)?)+))?")
NOQA_REGEX = re.compile(
r"(?i:# (?:(?:ruff|flake8): )?noqa)(?::\s?(?P<codes>([A-Z]+[0-9]+(?:[,\s]+)?)+))?"
)
CODE_REGEX = re.compile(r"[A-Z]{1,3}[0-9]{3}")


Expand Down

0 comments on commit d73120d

Please sign in to comment.