Skip to content

Commit d08cfb5

Browse files
resolveCompletionItem use the old item with documentation added in (#9867)
1 parent 29b7519 commit d08cfb5

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

news/2 Fixes/9857.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
When comitting intellisense in Notebook Editor with Jedi place code in correct position.

src/datascience-ui/interactive-common/intellisenseProvider.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ export class IntellisenseProvider
6666
return promise.promise;
6767
}
6868

69-
public resolveCompletionItem(
69+
public async resolveCompletionItem(
7070
model: monacoEditor.editor.ITextModel,
7171
position: monacoEditor.Position,
7272
item: monacoEditor.languages.CompletionItem,
7373
token: monacoEditor.CancellationToken
74-
): monacoEditor.languages.ProviderResult<monacoEditor.languages.CompletionItem> {
74+
): Promise<monacoEditor.languages.CompletionItem> {
7575
// If the item has already resolved documentation (as with MS LS) we don't need to do this
7676
if (!item.documentation) {
7777
// Emit a new request
@@ -86,7 +86,11 @@ export class IntellisenseProvider
8686
this.resolveCompletionRequests.set(requestId, { promise, cancelDisposable });
8787
this.sendMessage(InteractiveWindowMessages.ResolveCompletionItemRequest, { position, item, requestId, cellId: this.getCellId(model.id) });
8888

89-
return promise.promise;
89+
const newItem = await promise.promise;
90+
// Our code strips out _documentPosition and possibly other items that are too large to send
91+
// so instead of returning the new resolve completion item, just return the old item with documentation added in
92+
// which is what we are resolving the item to get
93+
return Promise.resolve({ ...item, documentation: newItem.documentation });
9094
} else {
9195
return Promise.resolve(item);
9296
}

0 commit comments

Comments
 (0)