Skip to content

Commit 543d63c

Browse files
committed
Make view result optional
In case it's not managed by a comm
1 parent e5f451a commit 543d63c

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

positron/comms/variables-backend-openrpc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,8 @@
186186
"schema": {
187187
"description": "The ID of the viewer that was opened.",
188188
"type": "string"
189-
}
189+
},
190+
"required": false
190191
}
191192
}
192193
],

src/vs/workbench/contrib/positronVariables/browser/components/variableItem.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,7 @@ export const VariableItem = (props: VariableItemProps) => {
137137
));
138138
}
139139

140-
// If a binding was returned, save the binding between the viewer and the
141-
// variable item. Note that we intentionally treat `""` as falsy here so
142-
// that backends can return an empty ID if no comm was open. This happens
143-
// with Ark when the user views a function object: a virtual document is
144-
// opened in an editor but is not managed by a comm.
140+
// If a binding was returned, save the binding between the viewer and the variable item.
145141
if (viewerId) {
146142
explorerService.setInstanceForVar(viewerId, item.id);
147143
}

src/vs/workbench/services/languageRuntime/common/positronVariablesComm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ export class PositronVariablesComm extends PositronBaseComm {
415415
*
416416
* @returns The ID of the viewer that was opened.
417417
*/
418-
view(path: Array<string>): Promise<string> {
418+
view(path: Array<string>): Promise<string | undefined> {
419419
return super.performRpc('view', ['path'], [path]);
420420
}
421421

0 commit comments

Comments
 (0)