Skip to content

Commit

Permalink
Include server command in failure to start message (#315)
Browse files Browse the repository at this point in the history
Makes it easier to diagnose issues like #309
  • Loading branch information
natebosch authored Jul 6, 2020
1 parent a8eae06 commit e24d328
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 5 additions & 1 deletion autoload/lsc/server.vim
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,11 @@ function! lsc#server#register(filetype, config) abort
let l:old_status = self.status
if l:old_status ==# 'starting'
let self.status= 'failed'
call lsc#message#error('Failed to initialize server: '.self.config.name)
let l:message = 'Failed to initialize server "'.self.config.name.'".'
if self.config.name != string(self.config.command)
let l:message .= ' Failing command is: '.string(self.config.command)
endif
call lsc#message#error(l:message)
elseif l:old_status ==# 'exiting'
let self.status= 'exited'
elseif l:old_status ==# 'running'
Expand Down
2 changes: 1 addition & 1 deletion test/integration/test/early_exit_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ void main() {
test('reports a failure to start', () async {
await vim.edit('foo.txt');
final messages = await vim.messages(1);
expect(messages, ['[lsc:Error] Failed to initialize server: \'false\'']);
expect(messages, ['[lsc:Error] Failed to initialize server "\'false\'".']);
});
}
6 changes: 4 additions & 2 deletions test/integration/test/stderr_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ void main() {
final messages = await vim.messages(2);
expect(messages, [
'[lsc:Error] StdErr from some server: messagestderr',
'[lsc:Error] Failed to initialize server: some server'
'[lsc:Error] Failed to initialize server "some server". '
'Failing command is: [\'sh\', \'-c\', \'echo messagestderr >&2\']'
]);
});

Expand All @@ -45,7 +46,8 @@ void main() {
final messages = await vim.messages(2);
expect(messages, [
'"foo.txt" [New] --No lines in buffer--',
'[lsc:Error] Failed to initialize server: some server'
'[lsc:Error] Failed to initialize server "some server". '
'Failing command is: [\'sh\', \'-c\', \'echo messagestderr >&2\']'
]);
});
}

0 comments on commit e24d328

Please sign in to comment.