@yaegassy/coc-ruff
Advanced tools
+3
-3
| { | ||
| "name": "@yaegassy/coc-ruff", | ||
| "version": "0.7.10", | ||
| "description": "ruff-lsp extension for coc.nvim", | ||
| "version": "0.8.0", | ||
| "description": "ruff server extension for coc.nvim", | ||
| "author": "yaegassy <yosstools@gmail.com>", | ||
@@ -111,3 +111,3 @@ "license": "MIT", | ||
| "ruff.nativeServer": { | ||
| "default": false, | ||
| "default": true, | ||
| "description": "Use the integrated Rust-based language server, available now in Beta.", | ||
@@ -114,0 +114,0 @@ "type": "boolean" |
+4
-4
@@ -129,3 +129,3 @@ # This file is automatically @generated by Poetry 2.0.1 and should not be changed by hand. | ||
| name = "ruff-lsp" | ||
| version = "0.0.61" | ||
| version = "0.0.62" | ||
| description = "A Language Server Protocol implementation for Ruff." | ||
@@ -136,4 +136,4 @@ optional = false | ||
| files = [ | ||
| {file = "ruff_lsp-0.0.61-py3-none-any.whl", hash = "sha256:c84988a2016066e5f808ba43b7b84e961cfd0339321fd986f35caf6f2c95334a"}, | ||
| {file = "ruff_lsp-0.0.61.tar.gz", hash = "sha256:4a1704dc96dc1353557b5edd0733768f3948cfc92042fd332927648e080754bc"}, | ||
| {file = "ruff_lsp-0.0.62-py3-none-any.whl", hash = "sha256:fb6c04a0cb09bb3ae316121b084ff09497edd01df58b36fa431f14515c63029e"}, | ||
| {file = "ruff_lsp-0.0.62.tar.gz", hash = "sha256:6db2a39375973ecb16c64d3c8dc37e23e1e191dcb7aebcf525b1f85ebd338c0d"}, | ||
| ] | ||
@@ -166,2 +166,2 @@ | ||
| python-versions = "^3.8" | ||
| content-hash = "81bd31be76f77d6b9372cff897955994e7e019f5344df3b8963c3cfbb5efc5d2" | ||
| content-hash = "f59c1c7fe6a16004c1c57ddccc2e57f6489c5161e136ef2c6f923dd5348ae0f0" |
+1
-1
@@ -9,3 +9,3 @@ [tool.poetry] | ||
| python = "^3.8" | ||
| ruff-lsp = "0.0.61" | ||
| ruff-lsp = "0.0.62" | ||
@@ -12,0 +12,0 @@ [build-system] |
+2
-116
| # coc-ruff | ||
| [ruff-lsp](https://github.com/astral-sh/ruff-lsp) extension for [coc.nvim](https://github.com/neoclide/coc.nvim). | ||
| [Ruff](https://github.com/astral-sh/ruff) Language Server extension for [coc.nvim](https://github.com/neoclide/coc.nvim). | ||
@@ -23,110 +23,6 @@ <img width="791" alt="coc-ruff-demo" src="https://user-images.githubusercontent.com/188642/212628682-82b1f97d-f349-427f-95a0-f53c46c9854b.png"> | ||
| ## Note | ||
| ### Detecting the "ruff" command from the execution environment | ||
| The `ruff` command used by `ruff-lsp` uses the `ruff` command installed with the `ruff-lsp` dependency. | ||
| To use the `ruff` command installed in the virtual environment of a project created by `venv`, `poetry`, etc., `ruff.path` must be set to an absolute path. | ||
| [coc-ruff](https://github.com/yaegassy/coc-ruff/) adds the feature to automatically detect ruff commands in the execution environment and use them in `ruff-lsp`. | ||
| If you do not need this feature, set `ruff.useDetectRuffCommand` to `false`. | ||
| **coc-settings.json**: | ||
| ```jsonc | ||
| { | ||
| "ruff.useDetectRuffCommand": false | ||
| } | ||
| ``` | ||
| ### [EXPERIMENTAL] Enabling the Rust-based language server | ||
| To use the new Rust-based language server (ruff server), you'll need to enable the `ruff.nativeServer` setting in the coc-settings.json: | ||
| ```jsonc | ||
| { | ||
| "ruff.nativeServer": true | ||
| } | ||
| ``` | ||
| In coc-ruff, the ruff binary is detected from the runtime environment (PATH) by default to start the native server. If you want to specify a custom ruff binary path, please set ruff.nativeBinaryPath. | ||
| ```jsonc | ||
| { | ||
| "ruff.nativeBinaryPath": "/path/to/ruff" | ||
| } | ||
| ``` | ||
| ### Format (DocumentFormatting) | ||
| The [black](https://github.com/psf/black) equivalent formatting feature has been added to `ruff`. This feature is enabled by default in `ruff-lsp` "v0.0.42" and later. | ||
| If you want to disable this feature, set the `ruff.disableDocumentFormatting` setting to `true`. | ||
| **coc-settings.json**: | ||
| ```jsonc | ||
| { | ||
| "ruff.disableDocumentFormatting": true | ||
| } | ||
| ``` | ||
| --- | ||
| If you are using `ruff-lsp` "v0.4.1" or earlier and want to use this feature, please follow these steps. | ||
| 1. Please set `ruff.enableExperimentalFormatter` to `true`. | ||
| 1. If you are using other Python-related coc-extensions alongside` coc-ruff`, please disable the formatting feature of those coc-extensions. | ||
| - e.g. `coc-pyright`: | ||
| - Please set `python.formatting.provider` to `none`. | ||
| **coc-settings.json**: | ||
| ```jsonc | ||
| { | ||
| "ruff.enableExperimentalFormatter": true, | ||
| "python.formatting.provider": "none" | ||
| } | ||
| ``` | ||
| ### Auto-fixing | ||
| Auto-fixing can be executed via the `ruff.executeAutofix` command or CodeAction. | ||
| Set `ruff.autoFixOnSave` setting to `true` if you also want auto-fixing to be performed when the file is saved. | ||
| **coc-settings.json**: | ||
| ```jsonc | ||
| { | ||
| "ruff.autoFixOnSave": true | ||
| } | ||
| ``` | ||
| ## Order of detection of ruff-lsp used by extensions | ||
| [coc-ruff](https://github.com/yaegassy/coc-ruff/) detects and starts `ruff-lsp` in the following priority order. | ||
| 1. `ruff.serverPath` (If there is a setting) | ||
| 1. current python3/python environment (e.g. ruff-lsp in global or virtual environment) | ||
| 1. built-in ruff-lsp (Installation commands are also provided) | ||
| ## Bult-in install | ||
| [coc-ruff](https://github.com/yaegassy/coc-ruff/) allows you to create an extension-only "venv" and install `ruff-lsp`. | ||
| When using [coc-ruff](https://github.com/yaegassy/coc-ruff/) for the first time, if `ruff-lsp` is not present in the runtime environment, you will be prompted to do a built-in install. | ||
| To use the built-in installation feature, execute the following command. | ||
| ```vim | ||
| :CocCommand ruff.builtin.installServer | ||
| ``` | ||
| ## Configuration options | ||
| - `ruff.enable`: Enable coc-ruff extension, default: `true` | ||
| - `ruff.nativeServer`: Use the integrated Rust-based language server, available now in Beta, default: `false` | ||
| - `ruff.nativeServer`: Use the integrated Rust-based language server, available now in Beta, default: `true` | ||
| - `ruff.nativeBinaryPath`: Custom path for the `ruff` binary when using the native server. If no value is set, the `ruff` command will be detected from the runtime environment, default: `""` | ||
@@ -136,6 +32,3 @@ - `ruff.disableDocumentFormatting`: Disable document formatting only, default: `false` | ||
| - `ruff.useDetectRuffCommand`: Automatically detects the ruff command in the execution environment and sets `ruff.path`, default: `true` | ||
| - `ruff.autoFixOnSave`: Turns auto fix on save on or off, default: `false` | ||
| - `ruff.client.codeAction.showDocumantaion.enable`: Whether to display the code action for open the Ruff rule documentation web page included in the diagnostic information, default: `false` | ||
| - `ruff.serverPath`: Custom path to the `ruff-lsp` command. If not set, the `ruff-lsp` command found in the current Python environment or in the venv environment created for the extension will be used, default: `""` | ||
| - `ruff.builtin.pythonPath`: Python 3.x path (Absolute path) to be used for built-in install, default: `""` | ||
| - `ruff.trace.server`: Traces the communication between coc.nvim and the ruff-lsp, default: `"off"` | ||
@@ -153,8 +46,2 @@ | ||
| - `ruff.restart`: Restart Server | ||
| - `ruff.builtin.installServer`: Install ruff-lsp | ||
| - It will be installed in this path: | ||
| - Mac/Linux: | ||
| - `~/.config/coc/extensions/@yaegassy/coc-ruff-data/ruff-lsp/venv/bin/ruff-lsp` | ||
| - Windows: | ||
| - `~\AppData\Local\coc\extensions\@yaegassy\coc-ruff-data\ruff-lsp\venv\Scripts\ruff-lsp.exe` | ||
@@ -164,3 +51,2 @@ ## Thanks | ||
| - [astral-sh/ruff](https://github.com/astral-sh/ruff) | ||
| - [astral-sh/ruff-lsp](https://github.com/astral-sh/ruff-lsp) | ||
| - [astral-sh/ruff-vscode](https://github.com/astral-sh/ruff-vscode) | ||
@@ -167,0 +53,0 @@ |
463829
-0.84%57
-66.67%