Skip to content

Commit

Permalink
Fix #1085 - Add a final newline character to tsserver and LSP messages
Browse files Browse the repository at this point in the history
  • Loading branch information
w0rp committed Nov 5, 2017
1 parent 6f8db3e commit 8e7ede3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions autoload/ale/lsp/message.vim
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function! ale#lsp#message#DidOpen(buffer, language_id) abort
\ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')),
\ 'languageId': a:language_id,
\ 'version': ale#lsp#message#GetNextVersionID(),
\ 'text': join(l:lines, "\n"),
\ 'text': join(l:lines, "\n") . "\n",
\ },
\}]
endfunction
Expand All @@ -67,7 +67,7 @@ function! ale#lsp#message#DidChange(buffer) abort
\ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')),
\ 'version': ale#lsp#message#GetNextVersionID(),
\ },
\ 'contentChanges': [{'text': join(l:lines, "\n")}]
\ 'contentChanges': [{'text': join(l:lines, "\n") . "\n"}]
\}]
endfunction

Expand Down
2 changes: 1 addition & 1 deletion autoload/ale/lsp/tsserver_message.vim
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function! ale#lsp#tsserver_message#Change(buffer) abort
\ 'offset': 1,
\ 'endLine': 1073741824,
\ 'endOffset': 1,
\ 'insertString': join(l:lines, "\n"),
\ 'insertString': join(l:lines, "\n") . "\n",
\}]
endfunction

Expand Down
6 changes: 3 additions & 3 deletions test/lsp/test_lsp_client_messages.vader
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Execute(ale#lsp#message#DidOpen() should return correct messages):
\ 'uri': ale#path#ToURI(g:dir . '/foo/bar.ts'),
\ 'languageId': 'typescript',
\ 'version': 12,
\ 'text': "foo()\nbar()\nbaz()",
\ 'text': "foo()\nbar()\nbaz()\n",
\ },
\ }
\ ],
Expand All @@ -63,7 +63,7 @@ Execute(ale#lsp#message#DidChange() should return correct messages):
\ 'uri': ale#path#ToURI(g:dir . '/foo/bar.ts'),
\ 'version': 34,
\ },
\ 'contentChanges': [{'text': "foo()\nbar()\nbaz()"}],
\ 'contentChanges': [{'text': "foo()\nbar()\nbaz()\n"}],
\ }
\ ],
\ ale#lsp#message#DidChange(bufnr(''))
Expand Down Expand Up @@ -134,7 +134,7 @@ Execute(ale#lsp#tsserver_message#Change() should return correct messages):
\ 'offset': 1,
\ 'endLine': 1073741824,
\ 'endOffset': 1,
\ 'insertString': "foo()\nbar()\nbaz()",
\ 'insertString': "foo()\nbar()\nbaz()\n",
\ }
\ ],
\ ale#lsp#tsserver_message#Change(bufnr(''))
Expand Down

0 comments on commit 8e7ede3

Please sign in to comment.