mirror of
https://github.com/dense-analysis/ale.git
synced 2026-03-05 22:54:24 +08:00
Compare commits
4 Commits
master
...
copilot/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c849345a8d | ||
|
|
014c959fee | ||
|
|
520c775c6a | ||
|
|
7f79d30fb9 |
@@ -8,10 +8,7 @@ call ale#Set('ruby_solargraph_executable', 'solargraph')
|
||||
call ale#Set('ruby_solargraph_options', {})
|
||||
|
||||
function! ale_linters#ruby#solargraph#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_solargraph_executable')
|
||||
|
||||
return ale#ruby#EscapeExecutable(l:executable, 'solargraph')
|
||||
\ . ale#Pad('stdio')
|
||||
return '%e' . ale#Pad('stdio')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ruby', {
|
||||
|
||||
@@ -246,14 +246,31 @@ function! ale#c#FindCompileCommands(buffer) abort
|
||||
return [fnamemodify(l:json_file, ':h'), l:json_file]
|
||||
endif
|
||||
|
||||
" Something somewhere seems to delete this setting in tests, so ensure
|
||||
" we always have a default value.
|
||||
call ale#Set('c_build_dir_names', [
|
||||
\ 'build',
|
||||
\ 'build/Debug',
|
||||
\ 'build/Release',
|
||||
\ 'bin',
|
||||
\])
|
||||
|
||||
" Search in build directories if we can't find it in the project.
|
||||
for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
|
||||
for l:dirname in ale#Var(a:buffer, 'c_build_dir_names')
|
||||
let l:c_build_dir = l:path . s:sep . l:dirname
|
||||
let l:c_build_dir = ale#path#GetAbsPath(l:path, l:dirname)
|
||||
let l:json_file = l:c_build_dir . s:sep . 'compile_commands.json'
|
||||
|
||||
if filereadable(l:json_file)
|
||||
return [l:path, l:json_file]
|
||||
" For absolute build dir paths, use the parent
|
||||
" of the build dir as the project root. For
|
||||
" relative paths, use the directory found by
|
||||
" searching upwards from the file.
|
||||
let l:root = ale#path#IsAbsolute(l:dirname)
|
||||
\ ? fnamemodify(l:c_build_dir, ':h')
|
||||
\ : l:path
|
||||
|
||||
return [l:root, l:json_file]
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
@@ -227,8 +227,8 @@ g:ale_ruby_solargraph_executable
|
||||
Type: |String|
|
||||
Default: `'solargraph'`
|
||||
|
||||
Override the invoked solargraph binary. Set this to `'bundle'` to invoke
|
||||
`'bundle` `exec` solargraph'.
|
||||
Override the invoked solargraph binary. This is useful for running solargraph
|
||||
from binstubs or a bundle.
|
||||
|
||||
|
||||
===============================================================================
|
||||
|
||||
@@ -13,13 +13,6 @@ Execute(command callback executable can be overridden):
|
||||
let g:ale_ruby_solargraph_executable = 'foobar'
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' stdio'
|
||||
|
||||
Execute(Setting bundle appends 'exec solargraph'):
|
||||
let g:ale_ruby_solargraph_executable = 'path to/bundle'
|
||||
|
||||
AssertLinter 'path to/bundle', ale#Escape('path to/bundle')
|
||||
\ . ' exec solargraph'
|
||||
\ . ' stdio'
|
||||
|
||||
Execute(should set solargraph for rails app):
|
||||
call ale#test#SetFilename('../test-files/ruby/valid_rails_app/app/models/thing.rb')
|
||||
AssertLSPLanguage 'ruby'
|
||||
|
||||
33
test/test_c_find_compile_commands.vader
Normal file
33
test/test_c_find_compile_commands.vader
Normal file
@@ -0,0 +1,33 @@
|
||||
Before:
|
||||
Save g:ale_c_build_dir_names
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Execute(FindCompileCommands should find compile_commands.json with relative build dir names):
|
||||
call ale#test#SetFilename('test-files/c/json_project/subdir/dummy')
|
||||
|
||||
let g:ale_c_build_dir_names = ['build']
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ ale#path#Simplify(g:dir . '/test-files/c/json_project'),
|
||||
\ ale#path#Simplify(g:dir . '/test-files/c/json_project/build/compile_commands.json'),
|
||||
\ ],
|
||||
\ ale#c#FindCompileCommands(bufnr(''))
|
||||
|
||||
Execute(FindCompileCommands should find compile_commands.json with absolute build dir names):
|
||||
call ale#test#SetFilename('test-files/c/json_project/subdir/dummy')
|
||||
|
||||
let g:ale_c_build_dir_names = [ale#path#Simplify(g:dir . '/test-files/c/json_project/build')]
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ ale#path#Simplify(g:dir . '/test-files/c/json_project'),
|
||||
\ ale#path#Simplify(g:dir . '/test-files/c/json_project/build/compile_commands.json'),
|
||||
\ ],
|
||||
\ ale#c#FindCompileCommands(bufnr(''))
|
||||
Reference in New Issue
Block a user