UNPKG

@yaegassy/coc-ruff

Version:

ruff server extension for coc.nvim

428 lines (427 loc) 15.4 kB
{ "name": "@yaegassy/coc-ruff", "version": "0.8.1", "description": "ruff server extension for coc.nvim", "author": "yaegassy <yosstools@gmail.com>", "license": "MIT", "main": "lib/index.js", "keywords": [ "coc.nvim", "python", "python3", "linting", "ruff", "ruff-lsp", "coc-ruff", "vim", "neovim" ], "engines": { "coc": "^0.0.80" }, "repository": { "type": "git", "url": "https://github.com/yaegassy/coc-ruff" }, "publishConfig": { "access": "public" }, "scripts": { "lint": "eslint src --ext ts", "clean": "rimraf lib", "watch": "node esbuild.js --watch", "build": "node esbuild.js", "prepare": "node esbuild.js" }, "prettier": { "singleQuote": true, "printWidth": 120, "semi": true }, "devDependencies": { "@types/node": "^20.11.17", "@types/semver": "^7.5.8", "@types/which": "^2.0.1", "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.21.0", "coc.nvim": "^0.0.82", "esbuild": "^0.16.17", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.1.3", "prettier": "^3.2.5", "rimraf": "^5.0.1", "typescript": "^5.3.3", "which": "^3.0.0" }, "activationEvents": [ "onLanguage:python" ], "contributes": { "rootPatterns": [ { "filetype": "python", "patterns": [ "pyproject.toml", "ruff.toml", ".ruff.toml", "setup.py", "setup.cfg", "tox.ini", "Pipfile", "requirements.txt" ] } ], "configuration": { "type": "object", "title": "coc-ruff configuration", "properties": { "ruff.enable": { "type": "boolean", "default": true, "description": "Enable coc-ruff extension" }, "ruff.disableDocumentFormatting": { "type": "boolean", "default": false, "description": "Disable document formatting only." }, "ruff.disableHover": { "type": "boolean", "default": false, "description": "Disable hover only." }, "ruff.client.codeAction.showDocumantaion.enable": { "type": "boolean", "default": false, "description": "Whether to display the code action for open the Ruff rule documentation web page included in the diagnostic information." }, "ruff.useDetectRuffCommand": { "type": "boolean", "default": true, "description": "Automatically detects the ruff command in the execution environment and sets `ruff.path`." }, "ruff.autoFixOnSave": { "type": "boolean", "default": false, "description": "Turns auto fix on save on or off." }, "ruff.nativeServer": { "default": true, "description": "Use the integrated Rust-based language server, available now in Beta.", "type": "boolean" }, "ruff.nativeBinaryPath": { "type": "string", "default": "", "description": "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." }, "ruff.serverPath": { "type": "string", "default": "", "description": "Custom path to the ruff-lsp command. If not set, the `ruff-lsp` command found in the current Python environment or venv environment will be used." }, "ruff.builtin.pythonPath": { "type": "string", "default": "", "description": "Python 3.x path (Absolute path) to be used for built-in install." }, "ruff.args": { "default": [], "description": "Additional command-line arguments to pass to `ruff check`, e.g., `\"args\": [\"--config=/path/to/pyproject.toml\"]`. Supports a subset of Ruff's command-line arguments, ignoring those that are required to operate the LSP, like `--force-exclude` and `--verbose`.", "items": { "type": "string" }, "scope": "resource", "type": "array" }, "ruff.lint.args": { "default": [], "description": "Additional command-line arguments to pass to `ruff check`, e.g., `\"args\": [\"--config=/path/to/pyproject.toml\"]`. Supports a subset of Ruff's command-line arguments, ignoring those that are required to operate the LSP, like `--force-exclude` and `--verbose`.", "items": { "type": "string" }, "scope": "resource", "type": "array" }, "ruff.lint.preview": { "default": null, "description": "Enable [preview mode](https://docs.astral.sh/ruff/settings/#lint_preview) for the linter; enables unstable rules and fixes. This setting is used only by the native server.", "scope": "resource", "type": "boolean" }, "ruff.lint.select": { "default": null, "description": "Set rule codes to enable. Use `ALL` to enable all rules. See [the documentation](https://docs.astral.sh/ruff/settings/#lint_select) for more details. This setting is used only by the native server.", "items": { "type": "string" }, "scope": "resource", "type": "array" }, "ruff.lint.extendSelect": { "default": null, "description": "Enable additional rule codes on top of existing configuration, instead of overriding it. Use `ALL` to enable all rules. This setting is used only by the native server.", "items": { "type": "string" }, "scope": "resource", "type": "array" }, "ruff.lint.ignore": { "default": null, "description": "Set rule codes to disable. See [the documentation](https://docs.astral.sh/ruff/settings/#lint_ignore) for more details. This setting is used only by the native server.", "items": { "type": "string" }, "scope": "resource", "type": "array" }, "ruff.run": { "default": null, "description": "Run Ruff on every keystroke (`onType`) or on save (`onSave`).", "enum": [ "onType", "onSave" ], "enumDescriptions": [ "Run Ruff on every keystroke.", "Run Ruff on save." ], "scope": "window", "type": [ "string", null ] }, "ruff.lint.run": { "default": "onType", "description": "Run Ruff on every keystroke (`onType`) or on save (`onSave`).", "enum": [ "onType", "onSave" ], "enumDescriptions": [ "Run Ruff on every keystroke.", "Run Ruff on save." ], "scope": "window", "type": "string" }, "ruff.lint.enable": { "default": true, "markdownDescription": "Whether to enable linting. Set to `false` to use Ruff exclusively as a formatter.", "scope": "window", "type": "boolean" }, "ruff.format.args": { "default": [], "description": "Additional command-line arguments to pass to `ruff format`, e.g., `\"args\": [\"--config=/path/to/pyproject.toml\"]`. Supports a subset of Ruff's command-line arguments, ignoring those that are required to operate the LSP, like `--force-exclude` and `--verbose`.", "items": { "type": "string" }, "scope": "resource", "type": "array" }, "ruff.format.preview": { "default": null, "description": "Enable [preview mode](https://docs.astral.sh/ruff/settings/#format_preview) for the formatter; enables unstable formatting. This setting is used only by the native server.", "scope": "resource", "type": "boolean" }, "ruff.path": { "default": [], "description": "Path to a custom `ruff` executable, e.g., `[\"/path/to/ruff\"]`.", "scope": "resource", "items": { "type": "string" }, "type": "array" }, "ruff.importStrategy": { "default": "fromEnvironment", "description": "Strategy for loading the `ruff` executable. `fromEnvironment` picks up Ruff from the environment, falling back to the bundled version if needed. `useBundled` uses the version bundled with the extension.", "enum": [ "fromEnvironment", "useBundled" ], "enumDescriptions": [ "Use `ruff` from environment, fallback to bundled version only if `ruff` not available in the environment.", "Always use the bundled version of `ruff`." ], "scope": "window", "type": "string" }, "ruff.interpreter": { "default": [], "description": "When set to a path to python executable, extension will use that to launch the server and any subprocess.", "scope": "window", "items": { "type": "string" }, "type": "array" }, "ruff.organizeImports": { "default": true, "description": "Whether to register Ruff as capable of handling `source.organizeImports` actions.", "scope": "window", "type": "boolean" }, "ruff.fixAll": { "default": true, "description": "Whether to register Ruff as capable of handling `source.fixAll` actions.", "scope": "window", "type": "boolean" }, "ruff.codeAction.fixViolation.enable": { "default": true, "description": "Whether to display Quick Fix actions to autofix violations.", "scope": "window", "type": "boolean" }, "ruff.codeAction.disableRuleComment.enable": { "default": true, "description": "Whether to display Quick Fix actions to disable rules via `noqa` suppression comments.", "scope": "window", "type": "boolean" }, "ruff.showSyntaxErrors": { "default": true, "description": "Whether to show syntax error diagnostics.", "scope": "window", "type": "boolean" }, "ruff.ignoreStandardLibrary": { "default": true, "markdownDescription": "Whether to ignore files that are inferred to be part of the Python standard library.", "scope": "window", "type": "boolean" }, "ruff.showNotifications": { "default": "off", "markdownDescription": "Controls when notifications are shown by this extension.", "enum": [ "off", "onError", "onWarning", "always" ], "enumDescriptions": [ "All notifications are turned off, any errors or warning are still available in the logs.", "Notifications are shown only in the case of an error.", "Notifications are shown for errors and warnings.", "Notifications are show for anything that the server chooses to show." ], "scope": "machine", "type": "string" }, "ruff.exclude": { "default": null, "items": { "type": "string" }, "description": "Set paths for the linter and formatter to ignore. See [the documentation](https://docs.astral.sh/ruff/settings/#lint_exclude) for more details. This setting is used only by the native server.", "type": "array", "scope": "resource" }, "ruff.lineLength": { "default": null, "description": "Set the [line length](https://docs.astral.sh/ruff/settings/#line-length) used by the formatter and linter. Must be greater than 0 and less than or equal to 320. This setting is used only by the native server.", "scope": "resource", "type": [ "integer", "null" ] }, "ruff.configurationPreference": { "enum": [ "editorFirst", "filesystemFirst", "editorOnly" ], "enumDescriptions": [ "The default strategy - configuration set in the editor takes priority over configuration set in `.toml` files.", "An alternative strategy - configuration set in `.toml` files takes priority over configuration set in the editor.", "An alternative strategy - configuration set in `.toml` files is ignored entirely." ], "description": "The preferred method of resolving configuration in the editor with local configuration froml `.toml` files. This setting is used only by the native server.", "scope": "resource", "type": "string", "default": "editorFirst" }, "ruff.enableExperimentalFormatter": { "default": false, "markdownDescription": "Controls whether Ruff registers as capable of code formatting. The Ruff formatter is in an alpha state during which formatting may change at any time.", "scope": "machine", "type": "boolean" }, "ruff.logLevel": { "default": null, "markdownDescription": "Controls the log level of the language server.\n\n**This setting is used only by the native server.**", "enum": [ "error", "warning", "info", "debug", "trace" ], "scope": "window", "type": "string" }, "ruff.logFile": { "default": null, "markdownDescription": "Path to the log file for the language server.\n\n**This setting is used only by the native server.**", "scope": "window", "type": "string" }, "ruff.trace.server": { "type": "string", "enum": [ "off", "messages", "verbose" ], "default": "off", "description": "Traces the communication between coc.nvim and the ruff-lsp." } } }, "commands": [ { "command": "ruff.executeAutofix", "title": "Fix all auto-fixable problems" }, { "command": "ruff.executeFormat", "title": "Format document" }, { "command": "ruff.executeOrganizeImports", "title": "Format imports" }, { "title": "Print debug information (native server only)", "category": "Ruff", "command": "ruff.debugInformation" }, { "command": "ruff.showLogs", "title": "Show logs" }, { "command": "ruff.restart", "title": "Restart Server" }, { "command": "ruff.builtin.installServer", "title": "Install ruff-lsp" } ] }, "dependencies": { "semver": "^7.6.2", "toml": "^3.0.0" }, "packageManager": "yarn@1.22.19+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447" }