File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
packages/jupyterlab-lsp/src/features/completion Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -354,9 +354,15 @@ export class LSPConnector
354
354
this . console . debug ( 'Transformed' ) ;
355
355
// required to make the repetitive trigger characters like :: or ::: work for R with R languageserver,
356
356
// see https://github.com/krassowski/jupyterlab-lsp/issues/436
357
- const prefix_offset = token . value . length ;
357
+ let prefix_offset = token . value . length ;
358
+ // completion of dictionaries for Python with jedi-language-server was
359
+ // causing an issue for dic['<tab>'] case; to avoid this let's make
360
+ // sure that prefix.length >= prefix.offset
361
+ if ( all_non_prefixed && prefix_offset > prefix . length ) {
362
+ prefix_offset = prefix . length ;
363
+ }
358
364
359
- return {
365
+ let response = {
360
366
// note in the ContextCompleter it was:
361
367
// start: token.offset,
362
368
// end: token.offset + token.value.length,
@@ -370,6 +376,14 @@ export class LSPConnector
370
376
end : token . offset + prefix . length ,
371
377
items : items
372
378
} ;
379
+ if ( response . start > response . end ) {
380
+ console . warn (
381
+ 'Response contains start beyond end; this should not happen!' ,
382
+ response
383
+ ) ;
384
+ }
385
+
386
+ return response ;
373
387
}
374
388
375
389
protected icon_for ( type : string ) : LabIcon {
You can’t perform that action at this time.
0 commit comments