From 116a0363f466eab96cd05a88525ffe69952fd36f Mon Sep 17 00:00:00 2001 From: jiz4oh Date: Fri, 19 Jul 2024 23:56:08 +0800 Subject: [PATCH] Add ruff server --- README.md | 1 + installer/install-ruff.cmd | 3 +++ installer/install-ruff.sh | 5 +++++ settings.json | 16 ++++++++++++++++ settings/ruff.vim | 14 ++++++++++++++ 5 files changed, 39 insertions(+) create mode 100644 installer/install-ruff.cmd create mode 100755 installer/install-ruff.sh create mode 100644 settings/ruff.vim diff --git a/README.md b/README.md index 21834806..2ec7e5a9 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,7 @@ You can change the directory to install servers by set `g:lsp_settings_servers_d | Python | pylsp-all (pylsp with dependencies) | Yes | Yes | | Python | pylsp (pylsp without dependencies) | Yes | Yes | | Python | pylyzer | Yes | Yes | +| Python | ruff | Yes | Yes | | Python | ruff-lsp | Yes | Yes | | Prisma | prisma-language-server | Yes | Yes | | R | languageserver | Yes | No | diff --git a/installer/install-ruff.cmd b/installer/install-ruff.cmd new file mode 100644 index 00000000..b24fda2e --- /dev/null +++ b/installer/install-ruff.cmd @@ -0,0 +1,3 @@ +@echo off + +call "%~dp0\pip_install.cmd" ruff ruff diff --git a/installer/install-ruff.sh b/installer/install-ruff.sh new file mode 100755 index 00000000..f4f76a27 --- /dev/null +++ b/installer/install-ruff.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +set -e + +"$(dirname "$0")/pip_install.sh" ruff ruff diff --git a/settings.json b/settings.json index e86a0b1d..e81b9288 100644 --- a/settings.json +++ b/settings.json @@ -1386,6 +1386,22 @@ "python3" ] }, + { + "command": "ruff", + "url": "https://github.com/astral-sh/ruff", + "description": "A language server written in Rust and built into Ruff.", + "requires": [ + "py" + ] + }, + { + "command": "ruff", + "url": "https://github.com/astral-sh/ruff", + "description": "A language server written in Rust and built into Ruff.", + "requires": [ + "python3" + ] + }, { "command": "ruff-lsp", "url": "https://github.com/charliermarsh/ruff-lsp", diff --git a/settings/ruff.vim b/settings/ruff.vim new file mode 100644 index 00000000..19c2f041 --- /dev/null +++ b/settings/ruff.vim @@ -0,0 +1,14 @@ +augroup vim_lsp_settings_ruff + au! + LspRegisterServer { + \ 'name': 'ruff', + \ 'cmd': {server_info->lsp_settings#get('ruff', 'cmd', [lsp_settings#exec_path('ruff')]+lsp_settings#get('ruff', 'args', ['server']))}, + \ 'root_uri':{server_info->lsp_settings#get('ruff', 'root_uri', lsp_settings#root_uri('ruff'))}, + \ 'initialization_options': lsp_settings#get('ruff', 'initialization_options', v:null), + \ 'allowlist': lsp_settings#get('ruff', 'allowlist', ['python']), + \ 'blocklist': lsp_settings#get('ruff', 'blocklist', []), + \ 'config': lsp_settings#get('ruff', 'config', lsp_settings#server_config('ruff')), + \ 'workspace_config': lsp_settings#get('ruff', 'workspace_config', {}), + \ 'semantic_highlight': lsp_settings#get('ruff', 'semantic_highlight', {}), + \ } +augroup END