Added travis script

This commit is contained in:
baabelfish 2016-01-30 20:32:45 +02:00
commit 7953c47a57
16 changed files with 403 additions and 42 deletions

View file

@ -9,12 +9,15 @@ let s:DefinitionImpl = {}
function! s:DefinitionImpl.run(data)
if len(a:data.lines) > 0
let [_, _, _, _, filename, l, c, _] = split(a:data.lines[0], " ")
call util#JumpToLocation(filename, l, c + 2)
let res = util#ParseV1(a:data.lines[0])
call util#JumpToLocation(res.file, res.line, res.col + 1)
else
echohl Comment | echo "Not found"
endif
endfunction
function! features#definition#run()
call util#StartQuery()
call suggest#New("def", 0, s:DefinitionImpl)
endfunction

View file

@ -6,18 +6,67 @@ 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 [_, ctype, name, type, filename, l, c, doc] = split(a:data.lines[0], " ")
echohl Function | echon "Type"
echohl Comment | echon ": "
echohl Typedef | echon type
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 Comment | echon "\n » "
echohl Type | echon node_type
if len(type) > 0 && name != type
echon "\n"
echohl Comment | echon " » "
echohl Typedef | echon type
end
echohl Comment | echon "\n » "
echohl Include | echon path
echohl Comment | echon " ("
echohl String | echon filename
echohl Comment | echon ")"
endif
endfunction
function! features#info#run()
call util#StartQuery()
call suggest#New("def", 0, s:InfoImpl)
endfunction

View file

@ -4,37 +4,56 @@ endif
let s:loaded = 1
let s:highlights = -1
let s:UsagesImpl = {}
function! s:UsagesImpl.run(data)
for line in a:data.lines
if len(line) == 0
continue
endif
if s:highlights >= 0
call matchdelete(s:highlights)
end
let s:highlights = -1
let highlights = []
let [ctype, context, fullname, type, filename, line, column, doc, random] = split(line, " ")
if !s:findInProject && filename != expand("%:p")
continue
endif
if len(a:data.lines) < 1
echohl Comment | echo "No usages found"
else
for line in a:data.lines
if len(line) == 0
continue
endif
let module = split(fullname, '\.')[0]
let name = split(fullname, '\.')[-1]
call setqflist([{
\ 'filename': filename,
\ 'lnum': line,
\ 'col': column + 1,
\ 'text': ctype . ": " . name . " (" . fullname . ")"}],
\ 'a')
endfor
copen
nnoremap <buffer><silent> <return> :call util#JumpFromQuickfix(0)<cr>
nnoremap <buffer><silent> o :call util#JumpFromQuickfix(1)<cr>
let res = util#ParseV2(line)
if !s:findInProject && res.file != expand("%:p")
continue
endif
call setqflist([{
\ 'filename': res.file,
\ 'lnum': res.line,
\ 'col': res.col + 1,
\ 'text': res.ctype . ": " . res.name . " (" . res.location . ")"}],
\ 'a')
" call add(highlights, [line, column + 1, len(name)])
endfor
" let s:highlights = matchaddpos("Search", highlights)
copen
nnoremap <buffer><silent> <return> :call util#JumpFromQuickfix(0)<cr>
nnoremap <buffer><silent> o :call util#JumpFromQuickfix(1)<cr>
endif
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)
endfunction
function! features#usages#run(findInProject)
call util#StartQuery()
cclose
call setqflist([])
let s:findInProject = a:findInProject
call suggest#New("use", 1, s:UsagesImpl)
call suggest#New("def", 0, s:UsagesDefinitionImpl)
endfunction