diff options
author | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2020-03-05 10:57:09 +0900 |
---|---|---|
committer | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2020-03-05 10:57:09 +0900 |
commit | fed93a0175169d87d06816814c0cde26192b0ad5 (patch) | |
tree | fc5f971771ffba06b1c9d4878b722866314b78d2 /settings/sqls.vim | |
parent | 509f92da05019e682dadc4b9e77947471f39f66d (diff) | |
download | vim-lsp-settings-fed93a0175169d87d06816814c0cde26192b0ad5.tar.gz vim-lsp-settings-fed93a0175169d87d06816814c0cde26192b0ad5.tar.bz2 vim-lsp-settings-fed93a0175169d87d06816814c0cde26192b0ad5.zip |
Rename vue-language-server to vls
Diffstat (limited to 'settings/sqls.vim')
-rw-r--r-- | settings/sqls.vim | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/settings/sqls.vim b/settings/sqls.vim index a8477dc..6f746c1 100644 --- a/settings/sqls.vim +++ b/settings/sqls.vim @@ -12,3 +12,32 @@ augroup vimlsp_settings_sqls \ 'semantic_highlight': lsp_settings#get('sqls', 'semantic_highlight', {}), \ } augroup END + +function! s:sqls_query() abort + call lsp#send_request('sqls', { + \ 'method': 'workspace/executeCommand', + \ 'params': { + \ 'command': 'sqls.executeQuery', + \ 'arguments': [lsp#utils#get_buffer_uri()], + \ }, + \ 'on_notification': function('s:handle_execute_command'), + \ }) +endfunction + +function! s:handle_execute_command(data) abort + let l:lines = a:data['response']['result'] + vnew + call setline(1, split(l:lines, "\n")) +endfunction + +function! s:on_lsp_buffer_enabled() abort + if &ft !=# 'sql' + return + endif + command! -buffer LspSQLQuery call <SID>sqls_query() +endfunction + +augroup lsp_install_sqls + au! + autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled() +augroup END |