neovim function args are passed in as list.
@@ -112,7 +112,14 @@ class LanguageClient:
})
@neovim.function('LanguageClient_textDocument_hover')
- def textDocument_hover(self, filename: str, line: int, character: int, cb=None):
+ def textDocument_hover(self, args, cb=None):
+ if len(args) == 0:
+ filename = self.nvim.current.buffer.name
+ line = self.nvim.eval("line('.')")
+ character = self.nvim.eval("col('.')")
+ else:
+ filename, line, character = args
+
mid = self.incMid()
self.queue[mid] = partial(self.handleTextDocumentHoverResponse, cb=cb)
@@ -203,7 +210,7 @@ class TestLanguageClient():
time.sleep(3)
# textDocument/hover
- self.client.textDocument_hover(self.joinPath("tests/sample-rs/src/main.rs"), 8, 22,
+ self.client.textDocument_hover((self.joinPath("tests/sample-rs/src/main.rs"), 8, 22),
lambda value: assertEqual(value, 'fn () -> i32'))
while len(self.client.queue) > 0:
time.sleep(0.1)
