Skip to content

Commit

Permalink
Add deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvmanila committed Jan 31, 2025
1 parent 51e39f5 commit 611601d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
[![image](https://img.shields.io/pypi/pyversions/ruff-lsp.svg)](https://pypi.python.org/pypi/ruff-lsp)
[![Actions status](https://github.com/astral-sh/ruff-lsp/workflows/CI/badge.svg)](https://github.com/astral-sh/ruff-lsp/actions)

> [!WARNING]
>
> **`ruff-lsp` is deprecated. Please switch to the native server (`ruff server`).
> Refer to the [migration guide](https://docs.astral.sh/ruff/editors/migration/) and
> [setup guide](https://docs.astral.sh/ruff/editors/setup/) for more details.**
> [!NOTE]
>
> **As of Ruff v0.4.5, Ruff ships with a built-in language server written in Rust: ⚡ `ruff server`**
Expand Down
13 changes: 13 additions & 0 deletions ruff_lsp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -1570,6 +1570,13 @@ async def run_path(
@LSP_SERVER.feature(INITIALIZE)
def initialize(params: InitializeParams) -> None:
"""LSP handler for initialize request."""
log_warning(
"ruff-lsp is deprecated. Please switch to the native server "
"(`ruff server`). Refer to the "
"[migration guide](https://docs.astral.sh/ruff/editors/migration/) and "
"[setup guide](https://docs.astral.sh/ruff/editors/setup/) for more details."
)

# Extract client capabilities.
CLIENT_CAPABILITIES[CODE_ACTION_RESOLVE] = _supports_code_action_resolve(
params.capabilities
Expand Down Expand Up @@ -1996,6 +2003,12 @@ def show_error(message: str) -> None:
LSP_SERVER.show_message(message, MessageType.Error)


def show_warning(message: str) -> None:
"""Show a pop-up with a warning."""
LSP_SERVER.show_message_log(message, MessageType.Warning)
LSP_SERVER.show_message(message, MessageType.Error)


def log_warning(message: str) -> None:
LSP_SERVER.show_message_log(message, MessageType.Warning)
if os.getenv("LS_SHOW_NOTIFICATION", "off") in ["onWarning", "always"]:
Expand Down

0 comments on commit 611601d

Please sign in to comment.