aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattn <mattn.jp@gmail.com>2020-01-27 12:35:01 +0900
committerGitHub <noreply@github.com>2020-01-27 12:35:01 +0900
commitd83e45e1a1f5b16dab688c9e1e1d4789a46b28bb (patch)
tree88b2611e0ae173005271787ffa90c4218daf5ac6
parent0d0827debc115f214b69621bb63e27b18dce2b4e (diff)
parent5d06f7504b505fdae63888d75d813e60d9675004 (diff)
downloadvim-lsp-settings-d83e45e1a1f5b16dab688c9e1e1d4789a46b28bb.tar.gz
vim-lsp-settings-d83e45e1a1f5b16dab688c9e1e1d4789a46b28bb.tar.bz2
vim-lsp-settings-d83e45e1a1f5b16dab688c9e1e1d4789a46b28bb.zip
Merge pull request #101 from mattn/efm
Add efm-langserver
-rw-r--r--plugin/lsp_settings.vim25
-rw-r--r--schema.json4
-rw-r--r--settings.json7
-rw-r--r--settings/efm-langserver.vim13
4 files changed, 39 insertions, 10 deletions
diff --git a/plugin/lsp_settings.vim b/plugin/lsp_settings.vim
index 43c6225..70aec73 100644
--- a/plugin/lsp_settings.vim
+++ b/plugin/lsp_settings.vim
@@ -41,8 +41,8 @@ function! s:executable(cmd) abort
return 0
endfunction
-function! s:vim_lsp_installer() abort
- let l:ft = tolower(split(&filetype, '\.')[0])
+function! s:vim_lsp_installer(ft, ...) abort
+ let l:ft = tolower(split(a:ft, '\.')[0])
if !has_key(s:settings, l:ft)
return []
endif
@@ -50,6 +50,10 @@ function! s:vim_lsp_installer() abort
if empty(l:server)
return []
endif
+ let l:name = get(a:000, 0, '')
+ if !empty(l:name)
+ return filter(copy(l:server), 'l:conf.command ==# l:name')
+ endif
let l:found = {}
for l:conf in l:server
let l:missing = 0
@@ -105,8 +109,8 @@ function! s:vim_lsp_install_server_post(command, job, code, ...) abort
endif
endfunction
-function! s:vim_lsp_install_server() abort
- let l:entry = s:vim_lsp_installer()
+function! s:vim_lsp_install_server(ft, name) abort
+ let l:entry = s:vim_lsp_installer(a:ft, a:name)
if empty(l:entry)
return
endif
@@ -128,8 +132,8 @@ function! s:vim_lsp_install_server() abort
endif
endfunction
-function! s:vim_lsp_settings_suggest() abort
- if empty(s:vim_lsp_installer())
+function! s:vim_lsp_settings_suggest(ft) abort
+ if empty(s:vim_lsp_installer(a:ft))
return
endif
if exists(':LspInstallServer') !=# 2
@@ -137,7 +141,7 @@ function! s:vim_lsp_settings_suggest() abort
echohl Directory
echomsg 'Please do :LspInstallServer to enable Language Server'
echohl None
- command! -buffer LspInstallServer call s:vim_lsp_install_server()
+ command! -nargs=? -buffer LspInstallServer call s:vim_lsp_install_server(&l:filetype, <q-args>)
endif
endfunction
@@ -214,7 +218,7 @@ function! s:vim_lsp_load_or_suggest(ft) abort
let l:found = 0
for l:server in s:settings[a:ft]
- if s:vim_lsp_settings_get(l:server.command, 'disabled', 0)
+ if get(l:server, 'disabled', 0) || s:vim_lsp_settings_get(l:server.command, 'disabled', 0)
continue
endif
let l:default = get(g:, 'lsp_settings_' . a:ft, '')
@@ -255,11 +259,11 @@ function! s:vim_lsp_load_or_suggest(ft) abort
endfor
if l:found ==# 0
- call s:vim_lsp_settings_suggest()
+ call s:vim_lsp_settings_suggest(a:ft)
else
doautocmd User lsp_setup
if exists(':LspInstallServer') !=# 2
- command! -buffer LspInstallServer call s:vim_lsp_install_server()
+ command! -nargs=? -buffer LspInstallServer call s:vim_lsp_install_server(&l:filetype, <q-args>)
endif
endif
@@ -273,3 +277,4 @@ function! s:load_or_suggest_group_name(ft) abort
endfunction
call s:vim_lsp_settings()
+call s:vim_lsp_load_or_suggest('_')
diff --git a/schema.json b/schema.json
index c9ccb91..2537af6 100644
--- a/schema.json
+++ b/schema.json
@@ -23,6 +23,10 @@
"description": "define name of language server",
"type": "string"
},
+ "diabled": {
+ "description": "disable this server",
+ "type": "boolean"
+ },
"requires": {
"description": "define commands to install this language server",
"type": "array",
diff --git a/settings.json b/settings.json
index 105ca15..c374e70 100644
--- a/settings.json
+++ b/settings.json
@@ -1,5 +1,12 @@
{
"$schema": "https://mattn.github.io/vim-lsp-settings/schema.json",
+ "_": [
+ {
+ "command": "efm-langserver",
+ "disabled": true,
+ "requires": []
+ }
+ ],
"c": [
{
"command": "clangd",
diff --git a/settings/efm-langserver.vim b/settings/efm-langserver.vim
new file mode 100644
index 0000000..1a7c8cc
--- /dev/null
+++ b/settings/efm-langserver.vim
@@ -0,0 +1,13 @@
+augroup vimlsp_settings_efm_langserver
+ au!
+ LspRegisterServer {
+ \ 'name': 'efm-langserver',
+ \ 'cmd': {server_info->lsp_settings#get('efm-langserver', 'cmd', [lsp_settings#exec_path('efm-langserver')])},
+ \ 'root_uri':{server_info->lsp_settings#get('efm-langserver', 'root_uri', lsp_settings#root_uri(g:lsp_settings_root_markers))},
+ \ 'initialization_options': lsp_settings#get('efm-langserver', 'initialization_options', v:null),
+ \ 'whitelist': lsp_settings#get('efm-langserver', 'whitelist', ['*']),
+ \ 'blacklist': lsp_settings#get('efm-langserver', 'blacklist', []),
+ \ 'config': lsp_settings#get('efm-langserver', 'config', {}),
+ \ 'workspace_config': lsp_settings#get('efm-langserver', 'workspace_config', {}),
+ \ }
+augroup END