Skip to content

Commit 9e4e5b1

Browse files
committed
Make view result optional
In case it's not managed by a comm
1 parent 80ace2f commit 9e4e5b1

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ export const VariableItem = (props: VariableItemProps) => {
138138
}
139139

140140
// 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.
141+
// variable item. Note that it's valid for backends to not return any ID
142+
// if no comm was open. This happens with Ark when the user views a
143+
// function object: a virtual document is opened in an editor but is not
144+
// managed by a comm.
145145
if (viewerId) {
146146
explorerService.setInstanceForVar(viewerId, item.id);
147147
}

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)