mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -0,0 +1,47 @@
|
||||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:Text = 1
|
||||
let s:Method = 2
|
||||
let s:Function = 3
|
||||
let s:Constructor = 4
|
||||
let s:Field = 5
|
||||
let s:Variable = 6
|
||||
let s:Class = 7
|
||||
let s:Interface = 8
|
||||
let s:Module = 9
|
||||
let s:Property = 10
|
||||
let s:Unit = 11
|
||||
let s:Value = 12
|
||||
let s:Enum = 13
|
||||
let s:Keyword = 14
|
||||
let s:Snippet = 15
|
||||
let s:Color = 16
|
||||
let s:File = 17
|
||||
let s:Reference = 18
|
||||
let s:Folder = 19
|
||||
let s:EnumMember = 20
|
||||
let s:Constant = 21
|
||||
let s:Struct = 22
|
||||
let s:Event = 23
|
||||
let s:Operator = 24
|
||||
let s:TypeParameter = 25
|
||||
|
||||
function! go#lsp#completionitemkind#Vim(kind)
|
||||
if a:kind == s:Method || a:kind == s:Function || a:kind == s:Constructor
|
||||
return 'f'
|
||||
elseif a:kind == s:Variable || a:kind == s:Constant
|
||||
return 'v'
|
||||
elseif a:kind == s:Field || a:kind == s:Property
|
||||
return 'm'
|
||||
elseif a:kind == s:Class || a:kind == s:Interface || a:kind == s:Struct
|
||||
return 't'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
111
sources_non_forked/vim-go/autoload/go/lsp/message.vim
Normal file
111
sources_non_forked/vim-go/autoload/go/lsp/message.vim
Normal file
@ -0,0 +1,111 @@
|
||||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! go#lsp#message#Initialize(wd)
|
||||
return {
|
||||
\ 'notification': 0,
|
||||
\ 'method': 'initialize',
|
||||
\ 'params': {
|
||||
\ 'processId': getpid(),
|
||||
\ 'rootUri': go#path#ToURI(a:wd),
|
||||
\ 'capabilities': {
|
||||
\ 'workspace': {},
|
||||
\ 'textDocument': {}
|
||||
\ }
|
||||
\ }
|
||||
\ }
|
||||
endfunction
|
||||
|
||||
function! go#lsp#message#Definition(file, line, col)
|
||||
return {
|
||||
\ 'notification': 0,
|
||||
\ 'method': 'textDocument/definition',
|
||||
\ 'params': {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': go#path#ToURI(a:file)
|
||||
\ },
|
||||
\ 'position': s:position(a:line, a:col)
|
||||
\ }
|
||||
\ }
|
||||
endfunction
|
||||
|
||||
|
||||
function! go#lsp#message#TypeDefinition(file, line, col)
|
||||
return {
|
||||
\ 'notification': 0,
|
||||
\ 'method': 'textDocument/typeDefinition',
|
||||
\ 'params': {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': go#path#ToURI(a:file)
|
||||
\ },
|
||||
\ 'position': s:position(a:line, a:col)
|
||||
\ }
|
||||
\ }
|
||||
endfunction
|
||||
|
||||
function! go#lsp#message#DidOpen(file, content)
|
||||
return {
|
||||
\ 'notification': 1,
|
||||
\ 'method': 'textDocument/didOpen',
|
||||
\ 'params': {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': go#path#ToURI(a:file),
|
||||
\ 'languageId': 'go',
|
||||
\ 'text': a:content,
|
||||
\ }
|
||||
\ }
|
||||
\ }
|
||||
endfunction
|
||||
|
||||
function! go#lsp#message#DidChange(file, content)
|
||||
return {
|
||||
\ 'notification': 1,
|
||||
\ 'method': 'textDocument/didChange',
|
||||
\ 'params': {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': go#path#ToURI(a:file),
|
||||
\ },
|
||||
\ 'contentChanges': [
|
||||
\ {
|
||||
\ 'text': a:content,
|
||||
\ }
|
||||
\ ]
|
||||
\ }
|
||||
\ }
|
||||
endfunction
|
||||
|
||||
function! go#lsp#message#DidClose(file)
|
||||
return {
|
||||
\ 'notification': 1,
|
||||
\ 'method': 'textDocument/didClose',
|
||||
\ 'params': {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': go#path#ToURI(a:file),
|
||||
\ }
|
||||
\ }
|
||||
\ }
|
||||
endfunction
|
||||
|
||||
function! go#lsp#message#Completion(file, line, col)
|
||||
return {
|
||||
\ 'notification': 0,
|
||||
\ 'method': 'textDocument/completion',
|
||||
\ 'params': {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': go#path#ToURI(a:file)
|
||||
\ },
|
||||
\ 'position': s:position(a:line, a:col),
|
||||
\ }
|
||||
\ }
|
||||
endfunction
|
||||
|
||||
function! s:position(line, col)
|
||||
return {'line': a:line - 1, 'character': a:col-1}
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
Reference in New Issue
Block a user