diff --git a/README.md b/README.md index bd5a91e..7f83604 100644 --- a/README.md +++ b/README.md @@ -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` ⚡** diff --git a/ruff_lsp/server.py b/ruff_lsp/server.py index 5e69051..84587fc 100755 --- a/ruff_lsp/server.py +++ b/ruff_lsp/server.py @@ -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 @@ -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"]: