From d7a15bda2f9a10bffee1198dddf7cbc33482db3c Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Wed, 5 Feb 2020 14:27:48 +0900 Subject: Support b:asyncomplete_refresh_pattern --- autoload/lsp_settings.vim | 13 ++++++++++ schema.json | 60 +++++++++++++++++++++++++---------------------- settings.json | 1 + 3 files changed, 46 insertions(+), 28 deletions(-) diff --git a/autoload/lsp_settings.vim b/autoload/lsp_settings.vim index 55d9452..e0160de 100644 --- a/autoload/lsp_settings.vim +++ b/autoload/lsp_settings.vim @@ -325,6 +325,19 @@ function! s:vim_lsp_suggest_plugin() abort endfunction function! s:vim_lsp_load_or_suggest(ft) abort + if !has_key(s:settings, a:ft) + return + endif + + if get(g:, 'lsp_loaded', 0) + for l:server in s:settings[a:ft] + let l:pattern = get(l:server, 'asyncomplete-refresh-pattern', '') + if !empty(l:pattern) + let b:asyncomplete_refresh_pattern = l:pattern + endif + endfor + endif + if get(s:ftmap, a:ft, 0) return endif diff --git a/schema.json b/schema.json index dd01f15..38c11d6 100644 --- a/schema.json +++ b/schema.json @@ -1,24 +1,17 @@ { "$schema": "http://json-schema.org/draft-04/schema", - "type": "object", - "title": "vim-lsp-settings", "additionalProperties": false, "patternProperties": { - "^\\$schema$": { - "type": "string" - }, "^([a-z0-9_-]+)+$": { - "type": "array", "description": "filetype name", "items": { - "description": "define command description", - "type": "object", "additionalProperties": false, - "required": [ - "command", - "requires" - ], + "description": "define command description", "properties": { + "asyncomplete-refresh-pattern": { + "description": "define refresh pattern for asyncomplete", + "type": "string" + }, "command": { "description": "define name of language server", "type": "string" @@ -29,32 +22,43 @@ }, "requires": { "description": "define commands to install this language server", - "type": "array", "items": { - "type": "string", - "description": "executable command name" - } + "description": "executable command name", + "type": "string" + }, + "type": "array" }, "vim-plugin": { - "description": "define suggestion for vim-plugin", - "type": "object", "additionalProperties": false, + "description": "define suggestion for vim-plugin", "properties": { "extensions": { - "type": "array", "items": { - "type": "string", - "description": "file extensions" - } + "description": "file extensions", + "type": "string" + }, + "type": "array" }, "name": { - "type": "string", - "description": "plugin identify user/repo" + "description": "plugin identify user/repo", + "type": "string" } - } + }, + "type": "object" } - } - } + }, + "required": [ + "command", + "requires" + ], + "type": "object" + }, + "type": "array" + }, + "^\\$schema$": { + "type": "string" } - } + }, + "title": "vim-lsp-settings", + "type": "object" } diff --git a/settings.json b/settings.json index 17dd92e..12e7704 100644 --- a/settings.json +++ b/settings.json @@ -344,6 +344,7 @@ ], "ps1": [ { + "asyncomplete-refresh-pattern": "\\(\\$\\k*$\\|\\k\\+$\\)", "command": "powershell-languageserver", "requires": [ "pwsh" -- cgit v1.2.3-54-g00ecf