summaryrefslogtreecommitdiff
path: root/ale_linters/d
diff options
context:
space:
mode:
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