Added some filtering to the dscanner results.

This commit is contained in:
IdanArye 2012-12-05 01:17:31 +02:00
parent 8475dc5dfd
commit 0a0b7ff36e
1 changed files with 15 additions and 12 deletions

View File

@ -34,19 +34,22 @@ function! dcomplete#Complete(findstart,base)
return resultLines[-1] return resultLines[-1]
end end
"Identify the type of result received "Find the begining of the results.
let b:dscanner_resultType=resultLines[0] while len(resultLines)
"Parse the result accoring to their type "Identify the type of result received
if b:dscanner_resultType=='dotComplete' let b:dscanner_resultType=resultLines[0]
return s:parsePairs(a:base,resultLines,'','') "Parse the result accoring to their type
elseif b:dscanner_resultType=='completions' if b:dscanner_resultType=='dotComplete'
return s:parsePairs(a:base,resultLines,'',')') return s:parsePairs(a:base,resultLines,'','')
elseif b:dscanner_resultType=='calltips' elseif b:dscanner_resultType=='completions'
return s:parseCalltips(a:base,resultLines) return s:parsePairs(a:base,resultLines,'',')')
endif elseif b:dscanner_resultType=='calltips'
return s:parseCalltips(a:base,resultLines)
endif
let resultLines=resultLines[1:]
endwhile
endif endif
endfunction endfunction
echo "hi"
"Run dscanner "Run dscanner
function! s:runDScanner(scanCommand) function! s:runDScanner(scanCommand)
if exists('g:dscanner_path') if exists('g:dscanner_path')
@ -85,7 +88,7 @@ endfunction
function! s:parseCalltips(base,resultLines) function! s:parseCalltips(base,resultLines)
let result=[a:base] let result=[a:base]
for resultLine in a:resultLines[1:] for resultLine in a:resultLines[1:]
if len(resultLine) if 0<=match(resultLine,".*(.*)")
let funcArgs=[] let funcArgs=[]
for funcArg in split(resultLine[match(resultLine,'(')+1:-2],',\\n\\t') for funcArg in split(resultLine[match(resultLine,'(')+1:-2],',\\n\\t')
let argParts=split(funcArg) let argParts=split(funcArg)