From eb856bd1c52cc19fd9ed7f922cf6f7f0f93f5e1c Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Tue, 18 Feb 2020 22:54:16 +0900 Subject: Add eslint-language-server --- installer/install-eslint-language-server.cmd | 13 +++++++++++ installer/install-eslint-language-server.sh | 15 +++++++++++++ settings/eslint-language-server.vim | 32 ++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 installer/install-eslint-language-server.cmd create mode 100755 installer/install-eslint-language-server.sh create mode 100644 settings/eslint-language-server.vim diff --git a/installer/install-eslint-language-server.cmd b/installer/install-eslint-language-server.cmd new file mode 100644 index 0000000..846638d --- /dev/null +++ b/installer/install-eslint-language-server.cmd @@ -0,0 +1,13 @@ +@echo off + +git clone "https://github.com/microsoft/vscode-eslint" . +git checkout release/1.9.1 +call npm install +call npm run compile:server + +echo @echo off ^ + +node %%~dp0\server\out\eslintServer.js --stdio %%* ^ + +> eslint-language-server.cmd + diff --git a/installer/install-eslint-language-server.sh b/installer/install-eslint-language-server.sh new file mode 100755 index 0000000..05beeb3 --- /dev/null +++ b/installer/install-eslint-language-server.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +git clone "https://github.com/microsoft/vscode-eslint" . +git checkout release/1.9.1 +npm install +npm run compile:server + +cat <eslint-language-server +#!/usr/bin/env bash + +DIR=\$(cd \$(dirname \$0); pwd) +node \$DIR/server/out/eslintServer.js --stdio \$* +EOF + +chmod +x eslint-language-server diff --git a/settings/eslint-language-server.vim b/settings/eslint-language-server.vim new file mode 100644 index 0000000..eed9082 --- /dev/null +++ b/settings/eslint-language-server.vim @@ -0,0 +1,32 @@ +augroup vimlsp_settings_eslint_language_server + au! + LspRegisterServer { + \ 'name': 'eslint-language-server', + \ 'cmd': {server_info->lsp_settings#get('eslint-language-server', 'cmd', [lsp_settings#exec_path('eslint-language-server'), '--stdio'])}, + \ 'root_uri':{server_info->lsp_settings#get('eslint-language-server', 'root_uri', lsp_settings#root_uri(['package.json', 'tsconfig.json']))}, + \ 'initialization_options': lsp_settings#get('eslint-language-server', 'initialization_options', {'diagnostics': 'true'}), + \ 'whitelist': lsp_settings#get('eslint-language-server', 'whitelist', ['javascript', 'javascriptreact', 'typescript', 'typescriptreact', 'typescript.tsx']), + \ 'blacklist': lsp_settings#get('eslint-language-server', 'blacklist', []), + \ 'config': lsp_settings#get('eslint-language-server', 'config', lsp_settings#server_config('eslint-language-server')), + \ 'workspace_config': { + \ 'validate': v:true, + \ 'packageManager': 'npm', + \ 'autoFix': v:true, + \ 'autoFixOnSave': v:true, + \ 'options': {}, + \ 'run': 'onType', + \ 'nodePath': v:null, + \ 'quiet': v:false, + \ 'workspaceFolder': v:null, + \ 'codeAction': { + \ 'disableRuleComment': { + \ 'enable': v:true, + \ 'location': 'separateLine' + \ }, + \ 'showDocumentation': { + \ 'enable': v:true + \ } + \ } + \ }, + \ } +augroup END -- cgit v1.2.3-54-g00ecf