Skip to content

Commit 2d36cf0

Browse files
committed
Revert cursor restore regression.
1 parent e4aefaa commit 2d36cf0

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

autoload/LanguageClient.vim

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,15 @@ function! s:HandleMessage(job, lines, event) abort
141141

142142
try
143143
let l:message = json_decode(s:input)
144-
let s:input = ''
144+
if type(l:message) !=# type({})
145+
throw 'Messsage is not dict.'
146+
endif
145147
catch
146-
let s:input = ''
147-
call s:Debug(string(v:exception))
148+
call s:Debug('Error decoding message: ' . string(v:exception) .
149+
\ ' Message: ' . s:input)
148150
continue
151+
finally
152+
let s:input = ''
149153
endtry
150154

151155
if has_key(l:message, 'method')

src/languageclient.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ pub trait ILanguageClient: IVim {
191191
"Begin apply WorkspaceEdit: {:?}. Params: {:?}",
192192
edit, params
193193
);
194-
let curpos: Vec<u64> = self.call(None, "getcurpos", json!([]))?;
194+
let (filename, line, character): (String, u64, u64) =
195+
self.gather_args(&[VimVar::Filename, VimVar::Line, VimVar::Character], params)?;
195196

196197
if let Some(ref changes) = edit.document_changes {
197198
for e in changes {
@@ -203,7 +204,7 @@ pub trait ILanguageClient: IVim {
203204
self.apply_TextEdits(&uri.filepath()?, edits)?;
204205
}
205206
}
206-
self.call::<_, u8>(None, "setpos", json!([".", curpos]))?;
207+
self.goto_location(&Some("buffer".to_string()), &filename, line, character)?;
207208
debug!("End apply WorkspaceEdit");
208209
Ok(())
209210
}

0 commit comments

Comments
 (0)