Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/platform/notebook/common/notebookService.ts
13401 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import type { NotebookCell, Uri } from 'vscode';
7
import { createServiceIdentifier } from '../../../util/common/services';
8
9
10
export interface Variable {
11
name: string;
12
value: string;
13
type?: string;
14
summary?: string;
15
}
16
17
export interface VariablesResult {
18
variable: Variable;
19
hasNamedChildren: boolean;
20
indexedChildrenCount: number;
21
}
22
23
export interface PipPackage {
24
name: string;
25
version: string;
26
}
27
28
export const INotebookService = createServiceIdentifier<INotebookService>('INotebookService');
29
30
export interface INotebookService {
31
readonly _serviceBrand: undefined;
32
getVariables(notebook: Uri): Promise<VariablesResult[]>;
33
getPipPackages(notebook: Uri): Promise<PipPackage[]>;
34
getCellExecutions(notebook: Uri): NotebookCell[];
35
runCells(notebook: Uri, range: { start: number; end: number }, autoReveal: boolean): Promise<void>;
36
trackAgentUsage(): void;
37
setFollowState(state: boolean): void;
38
getFollowState(): boolean;
39
ensureKernelSelected(notebook: Uri): Promise<void>;
40
hasSupportedNotebooks(uri: Uri): boolean;
41
// testing utility
42
setVariables(notebook: Uri, variables: VariablesResult[]): void;
43
}
44
45