Fix some bugs so the PHP language server will show errors at least once

This commit is contained in:
w0rp 2017-07-30 14:42:00 +01:00
parent 63b9d9e9df
commit 84af543907
2 changed files with 5 additions and 3 deletions

View File

@ -25,7 +25,7 @@ endfunction
function! ale_linters#php#langserver#GetProjectRoot(buffer) abort function! ale_linters#php#langserver#GetProjectRoot(buffer) abort
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h') : '' return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''
endfunction endfunction
call ale#linter#Define('php', { call ale#linter#Define('php', {

View File

@ -164,6 +164,8 @@ function! s:HandleInitializeResponse(conn, response) abort
return return
endif endif
let l:project.initialized = 1
" After the server starts, send messages we had queued previously. " After the server starts, send messages we had queued previously.
for l:message_data in l:project.message_queue for l:message_data in l:project.message_queue
call s:SendMessageData(a:conn, l:message_data) call s:SendMessageData(a:conn, l:message_data)
@ -211,7 +213,7 @@ function! s:RegisterProject(conn, project_root) abort
" Tools without project roots are ready right away, like tsserver. " Tools without project roots are ready right away, like tsserver.
let a:conn.projects[a:project_root] = { let a:conn.projects[a:project_root] = {
\ 'initialized': empty(a:project_root), \ 'initialized': empty(a:project_root),
\ 'init_messsage_id': 0, \ 'init_request_id': 0,
\ 'message_queue': [], \ 'message_queue': [],
\} \}
endif endif
@ -319,7 +321,7 @@ function! ale#lsp#Send(conn_id, message, ...) abort
" Only send the init message once. " Only send the init message once.
if !l:project.init_request_id if !l:project.init_request_id
let [l:init_id, l:init_data] = ale#lsp#CreateMessageData( let [l:init_id, l:init_data] = ale#lsp#CreateMessageData(
\ ale#lsp#message#Initialize(l:conn.project_root), \ ale#lsp#message#Initialize(l:project_root),
\) \)
let l:project.init_request_id = l:init_id let l:project.init_request_id = l:init_id