mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-08 21:44:47 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5556fcbd1c | ||
|
|
cf599f4470 | ||
|
|
e71d831119 |
@@ -282,6 +282,15 @@ function! s:TimerHandler(...) abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Stop any completion timer that is queued. This is useful for tests.
|
||||||
|
function! ale#completion#StopTimer() abort
|
||||||
|
if s:timer_id != -1
|
||||||
|
call timer_stop(s:timer_id)
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:timer_id = -1
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! ale#completion#Queue() abort
|
function! ale#completion#Queue() abort
|
||||||
let l:time = get(b:, 'ale_complete_done_time', 0)
|
let l:time = get(b:, 'ale_complete_done_time', 0)
|
||||||
|
|
||||||
@@ -298,9 +307,7 @@ function! ale#completion#Queue() abort
|
|||||||
let b:ale_completion_info.request_id = 0
|
let b:ale_completion_info.request_id = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if s:timer_id != -1
|
call ale#completion#StopTimer()
|
||||||
call timer_stop(s:timer_id)
|
|
||||||
endif
|
|
||||||
|
|
||||||
let s:timer_id = timer_start(g:ale_completion_delay, function('s:TimerHandler'))
|
let s:timer_id = timer_start(g:ale_completion_delay, function('s:TimerHandler'))
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ function! ale#handlers#haskell#HandleGHCFormat(buffer, lines) abort
|
|||||||
" in Haskell error messages with the basename for this file.
|
" in Haskell error messages with the basename for this file.
|
||||||
let l:temp_filename_regex = s:temp_regex_prefix . l:basename
|
let l:temp_filename_regex = s:temp_regex_prefix . l:basename
|
||||||
|
|
||||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+):(.*)?$'
|
let l:pattern = '\v^\s*([a-zA-Z]?:?[^:]+):(\d+):(\d+):(.*)?$'
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
let l:corrected_lines = []
|
let l:corrected_lines = []
|
||||||
|
|||||||
@@ -185,5 +185,12 @@ function! ale#path#FromURI(uri) abort
|
|||||||
let l:i = len('file://')
|
let l:i = len('file://')
|
||||||
let l:encoded_path = a:uri[: l:i - 1] is# 'file://' ? a:uri[l:i :] : a:uri
|
let l:encoded_path = a:uri[: l:i - 1] is# 'file://' ? a:uri[l:i :] : a:uri
|
||||||
|
|
||||||
return ale#uri#Decode(l:encoded_path)
|
let l:path = ale#uri#Decode(l:encoded_path)
|
||||||
|
|
||||||
|
" If the path is like /C:/foo/bar, it should be C:\foo\bar instead.
|
||||||
|
if l:path =~# '^/[a-zA-Z]:'
|
||||||
|
let l:path = substitute(l:path[1:], '/', '\\', 'g')
|
||||||
|
endif
|
||||||
|
|
||||||
|
return l:path
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -76,3 +76,25 @@ Execute(The ghc handler should handle ghc 7 output):
|
|||||||
\ ale#path#Winify('src/Main.hs') . ':94:5:Error:',
|
\ ale#path#Winify('src/Main.hs') . ':94:5:Error:',
|
||||||
\ ' Some other error',
|
\ ' Some other error',
|
||||||
\ ])
|
\ ])
|
||||||
|
|
||||||
|
Execute(The ghc handler should handle stack 1.5.1 output):
|
||||||
|
call ale#test#SetFilename('src/Main.hs')
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ [
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 160,
|
||||||
|
\ 'col': 14,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': '• Expecting one fewer arguments to ‘Exp’ Expected kind ‘k0 -> *’, but ‘Exp’ has kind ‘*’ • In the type ‘Exp a’ | 160 | pattern F :: Exp a | ^^^^^',
|
||||||
|
\ },
|
||||||
|
\ ],
|
||||||
|
\ ale#handlers#haskell#HandleGHCFormat(bufnr(''), [
|
||||||
|
\ ' ' . ale#path#Winify('src/Main.hs') . ':160:14: error:',
|
||||||
|
\ ' • Expecting one fewer arguments to ‘Exp’',
|
||||||
|
\ ' Expected kind ‘k0 -> *’, but ‘Exp’ has kind ‘*’',
|
||||||
|
\ ' • In the type ‘Exp a’',
|
||||||
|
\ ' |',
|
||||||
|
\ ' 160 | pattern F :: Exp a',
|
||||||
|
\ ' | ^^^^^',
|
||||||
|
\ ])
|
||||||
|
|||||||
@@ -41,6 +41,10 @@ After:
|
|||||||
|
|
||||||
delfunction CheckCompletionCalled
|
delfunction CheckCompletionCalled
|
||||||
|
|
||||||
|
" Stop any timers we left behind.
|
||||||
|
" This stops the tests from failing randomly.
|
||||||
|
call ale#completion#StopTimer()
|
||||||
|
|
||||||
runtime autoload/ale/completion.vim
|
runtime autoload/ale/completion.vim
|
||||||
runtime autoload/ale/lsp.vim
|
runtime autoload/ale/lsp.vim
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ Execute(ale#path#ToURI should work for Windows paths):
|
|||||||
AssertEqual 'file:///C:/foo/bar/baz.tst', ale#path#ToURI('C:\foo\bar\baz.tst')
|
AssertEqual 'file:///C:/foo/bar/baz.tst', ale#path#ToURI('C:\foo\bar\baz.tst')
|
||||||
AssertEqual 'foo/bar/baz.tst', ale#path#ToURI('foo\bar\baz.tst')
|
AssertEqual 'foo/bar/baz.tst', ale#path#ToURI('foo\bar\baz.tst')
|
||||||
|
|
||||||
|
Execute(ale#path#FromURI should work for Windows paths):
|
||||||
|
AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromURI('file:///C:/foo/bar/baz.tst')
|
||||||
|
|
||||||
Execute(ale#path#ToURI should work for Unix paths):
|
Execute(ale#path#ToURI should work for Unix paths):
|
||||||
AssertEqual 'file:///foo/bar/baz.tst', ale#path#ToURI('/foo/bar/baz.tst')
|
AssertEqual 'file:///foo/bar/baz.tst', ale#path#ToURI('/foo/bar/baz.tst')
|
||||||
AssertEqual 'foo/bar/baz.tst', ale#path#ToURI('foo/bar/baz.tst')
|
AssertEqual 'foo/bar/baz.tst', ale#path#ToURI('foo/bar/baz.tst')
|
||||||
|
|||||||
Reference in New Issue
Block a user