I’m developing an extension for JupyterLab and I’m trying to use autocomplete for the R language from the Language Server Protocol (LSP) in my TypeScript code.
here is a snippet from my code:
requires: [ILSPDocumentConnectionManager]
activate: (manager: ILSPDocumentConnectionManager){
const path = notebooks.currentWidget?.title.label
const connection = manager.connections.get(path);
const uri = […(connection as any)?.openedUris.keys()][0];
const params = {
textDocument: {uri: uri},
position: {
line: 0,
character: 0
}
};
const response = connection.clientRequests[‘textDocument/completion’].request(params);
}
With this option using clientRequests['textDocument/completion']
, I can retrieve the code autocomplete, but I need to pass the notebook I’m using and the cursor position.
I’d like to achieve autocomplete by simply passing the desired string, for example, passing ‘readr::’ as a parameter to some function and have it return the array with autocomplete options.
I couldn’t find anything in the forum or documentation about this. Is it possible to do this?
Sincerely,
Vitor