summaryrefslogtreecommitdiff
path: root/ale_linters/d
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2016-09-18 10:38:54 +0100
committerw0rp <devw0rp@gmail.com>2016-09-18 10:38:54 +0100
commit0bc4b4c14c3cce61dd1838b5ed3ae5696f76f14d (patch)
treefc4b765121218694ad513ca5b4826999a716b79e /ale_linters/d
parenta32b380b6f31027e2a6f968cc323bb49f62ac3b3 (diff)
downloadale-0bc4b4c14c3cce61dd1838b5ed3ae5696f76f14d.zip
Run DUB in a separate process as well, so it will not cause import lag.
Diffstat (limited to 'ale_linters/d')
-rw-r--r--ale_linters/d/dmd.vim40
1 files changed, 2 insertions, 38 deletions
diff --git a/ale_linters/d/dmd.vim b/ale_linters/d/dmd.vim
index 6afdc452..25d4b912 100644
--- a/ale_linters/d/dmd.vim
+++ b/ale_linters/d/dmd.vim
@@ -7,7 +7,8 @@ let g:loaded_ale_linters_d_dmd = 1
" A function for finding the dmd-wrapper script in the Vim runtime paths
function! s:FindWrapperScript()
for parent in split(&runtimepath, ',')
- let path = parent . '/' . 'dmd-wrapper'
+ " Expand the path to deal with ~ issues.
+ let path = expand(parent . '/' . 'dmd-wrapper')
if filereadable(path)
return path
@@ -15,48 +16,11 @@ function! s:FindWrapperScript()
endfor
endfunction
-function! ale_linters#d#dmd#GetDubImports(buffer)
- if !executable('dub')
- " If we don't have dub, then stop here.
- return []
- endif
-
- " Try to find dub.json
- let dub_path = findfile("dub.json", ",;")
-
- if dub_path == ''
- " Try to find package.json if that fails
- let dub_path = findfile("package.json", ",;")
- endif
-
- if dub_path == ''
- " We couldn't find the project root directory, so give up.
- return
- endif
-
- let dub_dir = fnamemodify(dub_path, ':h')
- let old_path = getcwd()
-
- try
- " Temporarily change to the project directory.
- execute 'cd' . fnameescape(dub_dir)
-
- return split(system('dub describe --import-paths'), '\n')
- finally
- " Change back to the old path.
- execute 'cd' . fnameescape(old_path)
- endtry
-endfunction
-
function! ale_linters#d#dmd#GetCommand(buffer)
let wrapper_script = s:FindWrapperScript()
let command = wrapper_script . ' -o- -vcolumns -c'
- for path in ale_linters#d#dmd#GetDubImports(a:buffer)
- let command .= ' -I' . shellescape(path)
- endfor
-
return command
endfunction