Autocompleiton and friends
This commit is contained in:
parent
4c5dfe3ea5
commit
d07c351677
13 changed files with 167 additions and 79 deletions
|
|
@ -18,6 +18,7 @@ endfunction
|
|||
|
||||
|
||||
function! features#definition#run()
|
||||
call suggest#New("def", 0, s:DefinitionImpl)
|
||||
call suggest#New("def", 1, 0, s:DefinitionImpl)
|
||||
endfunction
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,66 +6,38 @@ let s:loaded = 1
|
|||
|
||||
let s:InfoImpl = {}
|
||||
|
||||
let s:idtypes = {
|
||||
\ 'skProc': "Function",
|
||||
\ 'skTemplate': "Template",
|
||||
\ 'skType': "Type",
|
||||
\ 'skMacro': "Macro",
|
||||
\ 'skMethod': "Method",
|
||||
\ 'skField': "Field",
|
||||
\ 'skAlias': "Alias",
|
||||
\ 'skConditional': "Conditional",
|
||||
\ 'skConst': "Constant",
|
||||
\ 'skConverter': "Converter",
|
||||
\ 'skDynLib': "Dynamic library",
|
||||
\ 'skEnumField': "Enum field",
|
||||
\ 'skForVar': "Loop variable",
|
||||
\ 'skGenericParam': "Generic parameter",
|
||||
\ 'skGlobalVar': "Global variable",
|
||||
\ 'skGlobalLet': "Global constant",
|
||||
\ 'skIterator': "Iterator",
|
||||
\ 'skLabel': "Label",
|
||||
\ 'skLet': "Runtime constant",
|
||||
\ 'skModule': "Module",
|
||||
\ 'skPackage': "Package",
|
||||
\ 'skParam': "Parameter",
|
||||
\ 'skResult': "Result",
|
||||
\ 'skStub': "Stub",
|
||||
\ 'skTemp': "Temporary",
|
||||
\ 'skUnknown': "Unknown",
|
||||
\ 'skVar': "Variable"
|
||||
\ }
|
||||
|
||||
function! s:InfoImpl.run(data)
|
||||
if len(a:data.lines) == 0
|
||||
echo "No information found"
|
||||
else
|
||||
let res = util#ParseV1(a:data.lines[0])
|
||||
|
||||
echohl None
|
||||
let [_, ctype, name, type, filename, l, c, doc] = split(a:data.lines[0], "\\t")
|
||||
let path = join(split(name, '\.')[0:-2], ".")
|
||||
let module = split(name, '\.')[0]
|
||||
let name = split(name, '\.')[-1]
|
||||
let node_type = s:idtypes[ctype]
|
||||
|
||||
echohl Function | echon name
|
||||
echohl Function | echon res.lname
|
||||
echohl Comment | echon "\n » "
|
||||
echohl Type | echon node_type
|
||||
echohl Type | echon res.kindstr
|
||||
|
||||
if len(type) > 0 && name != type
|
||||
if len(res.name) > 0 && res.lname != res.name
|
||||
echon "\n"
|
||||
echohl Comment | echon " » "
|
||||
echohl Typedef | echon type
|
||||
echohl Typedef | echon res.name
|
||||
end
|
||||
|
||||
echohl Comment | echon "\n » "
|
||||
echohl Include | echon path
|
||||
echohl Include | echon res.location
|
||||
echohl Comment | echon " ("
|
||||
echohl String | echon filename
|
||||
echohl String | echon res.file
|
||||
echohl Comment | echon ")"
|
||||
|
||||
if res.doc != "\"\""
|
||||
echohl Comment | echon "\n » "
|
||||
echohl Normal | echon res.doc
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
function! features#info#run()
|
||||
call suggest#New("def", 0, s:InfoImpl)
|
||||
call suggest#New("def", 1, 0, s:InfoImpl)
|
||||
endfunction
|
||||
|
||||
|
|
|
|||
|
|
@ -27,5 +27,6 @@ endfunction
|
|||
function! features#outline#run()
|
||||
cclose
|
||||
call setqflist([])
|
||||
call suggest#New("outline", 1, s:OutlineImpl)
|
||||
call suggest#New("outline", 1, 1, s:OutlineImpl)
|
||||
endfunction
|
||||
|
||||
|
|
|
|||
|
|
@ -37,5 +37,6 @@ endfunction
|
|||
|
||||
function! features#rename#run(inProject)
|
||||
let s:findInProject = a:inProject
|
||||
call suggest#New("use", 1, s:RenameImpl)
|
||||
call suggest#New("use", 1, 1, s:RenameImpl)
|
||||
endfunction
|
||||
|
||||
|
|
|
|||
|
|
@ -46,13 +46,15 @@ endfunction
|
|||
|
||||
let s:UsagesDefinitionImpl = {}
|
||||
function! s:UsagesDefinitionImpl.run(data)
|
||||
let res = util#ParseV1(a:data.lines[0])
|
||||
call suggest#NewKnown("use", 1, res.file, res.line, res.col + 1, s:UsagesImpl)
|
||||
" let res = util#ParseV1(a:data.lines[0])
|
||||
" call suggest#NewKnown("use", 1, res.file, res.line, res.col + 1, s:UsagesImpl)
|
||||
call suggest#New("use", 1, 1, s:UsagesImpl)
|
||||
endfunction
|
||||
|
||||
function! features#usages#run(findInProject)
|
||||
cclose
|
||||
call setqflist([])
|
||||
let s:findInProject = a:findInProject
|
||||
call suggest#New("def", 0, s:UsagesDefinitionImpl)
|
||||
call suggest#New("def", 1, 0, s:UsagesDefinitionImpl)
|
||||
endfunction
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue