@codingame/monaco-vscode-notebook-service-override 22.1.4 → 22.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +4 -1
- package/package.json +23 -23
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSource.d.ts +36 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSource.js +184 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSourceFactory.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSourceFactory.js +34 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.service.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.service.js +6 -0
package/index.js
CHANGED
|
@@ -32,6 +32,8 @@ import { INotebookOriginalCellModelFactory } from '@codingame/monaco-vscode-api/
|
|
|
32
32
|
import { INotebookOriginalModelReferenceFactory } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.service';
|
|
33
33
|
import { OriginalNotebookCellModelFactory } from '@codingame/monaco-vscode-e4d0fd26-1b26-5583-b3f7-582e08d7b389-common/vscode/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory';
|
|
34
34
|
import { NotebookOriginalModelReferenceFactory } from '@codingame/monaco-vscode-e4d0fd26-1b26-5583-b3f7-582e08d7b389-common/vscode/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory';
|
|
35
|
+
import { INotebookCellOutlineDataSourceFactory } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSourceFactory.service';
|
|
36
|
+
import { NotebookCellOutlineDataSourceFactory } from './vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSourceFactory.js';
|
|
35
37
|
import './vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js';
|
|
36
38
|
|
|
37
39
|
function getServiceOverride() {
|
|
@@ -51,7 +53,8 @@ function getServiceOverride() {
|
|
|
51
53
|
[INotebookSearchService.toString()]: new SyncDescriptor(NotebookSearchService, [], true),
|
|
52
54
|
[INotebookDocumentService.toString()]: new SyncDescriptor(NotebookDocumentWorkbenchService, [], true),
|
|
53
55
|
[INotebookOriginalCellModelFactory.toString()]: new SyncDescriptor(OriginalNotebookCellModelFactory, [], true),
|
|
54
|
-
[INotebookOriginalModelReferenceFactory.toString()]: new SyncDescriptor(NotebookOriginalModelReferenceFactory, [], true)
|
|
56
|
+
[INotebookOriginalModelReferenceFactory.toString()]: new SyncDescriptor(NotebookOriginalModelReferenceFactory, [], true),
|
|
57
|
+
[INotebookCellOutlineDataSourceFactory.toString()]: new SyncDescriptor(NotebookCellOutlineDataSourceFactory, [], true),
|
|
55
58
|
};
|
|
56
59
|
}
|
|
57
60
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-notebook-service-override",
|
|
3
|
-
"version": "22.1.
|
|
3
|
+
"version": "22.1.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - notebook service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,28 +15,28 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-0cd5242b-7b61-5f66-ac25-ffa40baf8e8f-common": "22.1.
|
|
19
|
-
"@codingame/monaco-vscode-158b9837-fc78-5d9c-86f5-9134e4358643-common": "22.1.
|
|
20
|
-
"@codingame/monaco-vscode-23aade48-f094-5c08-9555-97fc9cca96c9-common": "22.1.
|
|
21
|
-
"@codingame/monaco-vscode-3109a756-1f83-5d09-945b-9f0fcad928f0-common": "22.1.
|
|
22
|
-
"@codingame/monaco-vscode-501b06ab-3f58-516b-8a1a-c29d375d3da4-common": "22.1.
|
|
23
|
-
"@codingame/monaco-vscode-60014c9d-b815-501d-83a9-4b08725c2ec2-common": "22.1.
|
|
24
|
-
"@codingame/monaco-vscode-622c0cca-d5fa-59b6-b730-0715afcf93ee-common": "22.1.
|
|
25
|
-
"@codingame/monaco-vscode-670aae94-7f88-54d7-90ea-6fcbef423557-common": "22.1.
|
|
26
|
-
"@codingame/monaco-vscode-6f9bc782-77e0-5716-93bd-b05210c768c5-common": "22.1.
|
|
27
|
-
"@codingame/monaco-vscode-88aa9a78-75f5-5aaa-89e9-bbdd580b3b5c-common": "22.1.
|
|
28
|
-
"@codingame/monaco-vscode-8ccb7637-50ea-5359-97bf-00015d7fe567-common": "22.1.
|
|
29
|
-
"@codingame/monaco-vscode-9ed6fe06-a052-57c2-a234-5d9b94d2e7e0-common": "22.1.
|
|
30
|
-
"@codingame/monaco-vscode-9ee79c1a-3f03-568b-8eac-b02513a98b68-common": "22.1.
|
|
31
|
-
"@codingame/monaco-vscode-a793b3ee-7ba9-5176-a019-30ec806fdd95-common": "22.1.
|
|
32
|
-
"@codingame/monaco-vscode-api": "22.1.
|
|
33
|
-
"@codingame/monaco-vscode-b994942c-360d-5b68-8a33-77d4bde6b714-common": "22.1.
|
|
34
|
-
"@codingame/monaco-vscode-b99aef83-0d60-5e8c-a62e-9908b6256f35-common": "22.1.
|
|
35
|
-
"@codingame/monaco-vscode-bba55be6-41a2-50cd-a3cc-8bafa35bfa89-common": "22.1.
|
|
36
|
-
"@codingame/monaco-vscode-caeb744c-8e3f-5c11-80fb-0f057d24d544-common": "22.1.
|
|
37
|
-
"@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common": "22.1.
|
|
38
|
-
"@codingame/monaco-vscode-e4d0fd26-1b26-5583-b3f7-582e08d7b389-common": "22.1.
|
|
39
|
-
"@codingame/monaco-vscode-eda30bac-0984-5b42-9362-c68996b85232-common": "22.1.
|
|
18
|
+
"@codingame/monaco-vscode-0cd5242b-7b61-5f66-ac25-ffa40baf8e8f-common": "22.1.5",
|
|
19
|
+
"@codingame/monaco-vscode-158b9837-fc78-5d9c-86f5-9134e4358643-common": "22.1.5",
|
|
20
|
+
"@codingame/monaco-vscode-23aade48-f094-5c08-9555-97fc9cca96c9-common": "22.1.5",
|
|
21
|
+
"@codingame/monaco-vscode-3109a756-1f83-5d09-945b-9f0fcad928f0-common": "22.1.5",
|
|
22
|
+
"@codingame/monaco-vscode-501b06ab-3f58-516b-8a1a-c29d375d3da4-common": "22.1.5",
|
|
23
|
+
"@codingame/monaco-vscode-60014c9d-b815-501d-83a9-4b08725c2ec2-common": "22.1.5",
|
|
24
|
+
"@codingame/monaco-vscode-622c0cca-d5fa-59b6-b730-0715afcf93ee-common": "22.1.5",
|
|
25
|
+
"@codingame/monaco-vscode-670aae94-7f88-54d7-90ea-6fcbef423557-common": "22.1.5",
|
|
26
|
+
"@codingame/monaco-vscode-6f9bc782-77e0-5716-93bd-b05210c768c5-common": "22.1.5",
|
|
27
|
+
"@codingame/monaco-vscode-88aa9a78-75f5-5aaa-89e9-bbdd580b3b5c-common": "22.1.5",
|
|
28
|
+
"@codingame/monaco-vscode-8ccb7637-50ea-5359-97bf-00015d7fe567-common": "22.1.5",
|
|
29
|
+
"@codingame/monaco-vscode-9ed6fe06-a052-57c2-a234-5d9b94d2e7e0-common": "22.1.5",
|
|
30
|
+
"@codingame/monaco-vscode-9ee79c1a-3f03-568b-8eac-b02513a98b68-common": "22.1.5",
|
|
31
|
+
"@codingame/monaco-vscode-a793b3ee-7ba9-5176-a019-30ec806fdd95-common": "22.1.5",
|
|
32
|
+
"@codingame/monaco-vscode-api": "22.1.5",
|
|
33
|
+
"@codingame/monaco-vscode-b994942c-360d-5b68-8a33-77d4bde6b714-common": "22.1.5",
|
|
34
|
+
"@codingame/monaco-vscode-b99aef83-0d60-5e8c-a62e-9908b6256f35-common": "22.1.5",
|
|
35
|
+
"@codingame/monaco-vscode-bba55be6-41a2-50cd-a3cc-8bafa35bfa89-common": "22.1.5",
|
|
36
|
+
"@codingame/monaco-vscode-caeb744c-8e3f-5c11-80fb-0f057d24d544-common": "22.1.5",
|
|
37
|
+
"@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common": "22.1.5",
|
|
38
|
+
"@codingame/monaco-vscode-e4d0fd26-1b26-5583-b3f7-582e08d7b389-common": "22.1.5",
|
|
39
|
+
"@codingame/monaco-vscode-eda30bac-0984-5b42-9362-c68996b85232-common": "22.1.5",
|
|
40
40
|
"marked": "14.0.0"
|
|
41
41
|
},
|
|
42
42
|
"main": "index.js",
|
package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.d.ts
CHANGED
|
@@ -9,12 +9,12 @@ import { IThemeService } from "@codingame/monaco-vscode-api/vscode/vs/platform/t
|
|
|
9
9
|
import { IEditorPane } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor";
|
|
10
10
|
import { CellFoldingState, INotebookEditorPane } from "@codingame/monaco-vscode-670aae94-7f88-54d7-90ea-6fcbef423557-common/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser";
|
|
11
11
|
import { NotebookEditor } from "@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/notebook/browser/notebookEditor";
|
|
12
|
-
import { INotebookCellOutlineDataSource } from "
|
|
12
|
+
import { INotebookCellOutlineDataSource } from "../../viewModel/notebookOutlineDataSource.js";
|
|
13
13
|
import { CellKind } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon";
|
|
14
14
|
import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service";
|
|
15
15
|
import { IBreadcrumbsDataSource, IOutline, IOutlineCreator, IOutlineListConfig, IQuickPickDataSource, IQuickPickOutlineElement, OutlineChangeEvent, OutlineTarget } from "@codingame/monaco-vscode-622c0cca-d5fa-59b6-b730-0715afcf93ee-common/vscode/vs/workbench/services/outline/browser/outline";
|
|
16
16
|
import { IOutlineService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/outline/browser/outline.service";
|
|
17
|
-
import { OutlineEntry } from "@codingame/monaco-vscode-
|
|
17
|
+
import { OutlineEntry } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/viewModel/OutlineEntry";
|
|
18
18
|
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
19
19
|
import { RawContextKey } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey";
|
|
20
20
|
import { INotebookExecutionStateService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService.service";
|
|
@@ -48,7 +48,7 @@ import { IOutlinePane } from '@codingame/monaco-vscode-0cd5242b-7b61-5f66-ac25-f
|
|
|
48
48
|
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
49
49
|
import { NOTEBOOK_IS_ACTIVE_EDITOR } from '@codingame/monaco-vscode-eda30bac-0984-5b42-9362-c68996b85232-common/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
|
|
50
50
|
import { NotebookOutlineConstants } from '../../viewModel/notebookOutlineEntryFactory.js';
|
|
51
|
-
import { INotebookCellOutlineDataSourceFactory } from '@codingame/monaco-vscode-
|
|
51
|
+
import { INotebookCellOutlineDataSourceFactory } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSourceFactory.service';
|
|
52
52
|
import { NotebookExecutionType } from '@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService';
|
|
53
53
|
import { INotebookExecutionStateService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService.service';
|
|
54
54
|
import { ILanguageFeaturesService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/languageFeatures.service';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Action2 } from "@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions";
|
|
2
2
|
import { ServicesAccessor } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
3
3
|
import { ICellViewModel, INotebookEditor } from "@codingame/monaco-vscode-670aae94-7f88-54d7-90ea-6fcbef423557-common/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser";
|
|
4
|
-
import { OutlineEntry } from "@codingame/monaco-vscode-
|
|
4
|
+
import { OutlineEntry } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/viewModel/OutlineEntry";
|
|
5
5
|
export type NotebookOutlineEntryArgs = {
|
|
6
6
|
notebookEditor: INotebookEditor;
|
|
7
7
|
outlineEntry: OutlineEntry;
|
|
@@ -44,7 +44,7 @@ import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/pl
|
|
|
44
44
|
import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
|
|
45
45
|
import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
46
46
|
import './services/notebookRendererMessagingServiceImpl.js';
|
|
47
|
-
import '
|
|
47
|
+
import './viewModel/notebookOutlineDataSourceFactory.js';
|
|
48
48
|
import '@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
|
|
49
49
|
import './controller/insertCellActions.js';
|
|
50
50
|
import './controller/executeActions.js';
|
package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSource.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
|
|
2
|
+
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
3
|
+
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
4
|
+
import { IMarkerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/markers/common/markers.service";
|
|
5
|
+
import { INotebookEditor } from "@codingame/monaco-vscode-670aae94-7f88-54d7-90ea-6fcbef423557-common/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser";
|
|
6
|
+
import { OutlineChangeEvent } from "@codingame/monaco-vscode-622c0cca-d5fa-59b6-b730-0715afcf93ee-common/vscode/vs/workbench/services/outline/browser/outline";
|
|
7
|
+
import { OutlineEntry } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/viewModel/OutlineEntry";
|
|
8
|
+
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
9
|
+
import { NotebookOutlineEntryFactory } from "./notebookOutlineEntryFactory.js";
|
|
10
|
+
export interface INotebookCellOutlineDataSource {
|
|
11
|
+
readonly activeElement: OutlineEntry | undefined;
|
|
12
|
+
readonly entries: OutlineEntry[];
|
|
13
|
+
}
|
|
14
|
+
export declare class NotebookCellOutlineDataSource implements INotebookCellOutlineDataSource {
|
|
15
|
+
private readonly _editor;
|
|
16
|
+
private readonly _markerService;
|
|
17
|
+
private readonly _configurationService;
|
|
18
|
+
private readonly _outlineEntryFactory;
|
|
19
|
+
private readonly _disposables;
|
|
20
|
+
private readonly _onDidChange;
|
|
21
|
+
readonly onDidChange: Event<OutlineChangeEvent>;
|
|
22
|
+
private _uri;
|
|
23
|
+
private _entries;
|
|
24
|
+
private _activeEntry?;
|
|
25
|
+
constructor(_editor: INotebookEditor, _markerService: IMarkerService, _configurationService: IConfigurationService, _outlineEntryFactory: NotebookOutlineEntryFactory);
|
|
26
|
+
get activeElement(): OutlineEntry | undefined;
|
|
27
|
+
get entries(): OutlineEntry[];
|
|
28
|
+
get isEmpty(): boolean;
|
|
29
|
+
get uri(): URI | undefined;
|
|
30
|
+
computeFullSymbols(cancelToken: CancellationToken): Promise<void>;
|
|
31
|
+
recomputeState(): void;
|
|
32
|
+
recomputeActive(): {
|
|
33
|
+
changeEventTriggered: boolean;
|
|
34
|
+
};
|
|
35
|
+
dispose(): void;
|
|
36
|
+
}
|
package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSource.js
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
4
|
+
import { DisposableStore, MutableDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
5
|
+
import { isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
6
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
7
|
+
import { IMarkerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/markers/common/markers.service';
|
|
8
|
+
import { CellKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
9
|
+
import { OutlineConfigKeys } from '@codingame/monaco-vscode-622c0cca-d5fa-59b6-b730-0715afcf93ee-common/vscode/vs/workbench/services/outline/browser/outline';
|
|
10
|
+
import { INotebookOutlineEntryFactory } from './notebookOutlineEntryFactory.service.js';
|
|
11
|
+
|
|
12
|
+
let NotebookCellOutlineDataSource = class NotebookCellOutlineDataSource {
|
|
13
|
+
constructor(_editor, _markerService, _configurationService, _outlineEntryFactory) {
|
|
14
|
+
this._editor = _editor;
|
|
15
|
+
this._markerService = _markerService;
|
|
16
|
+
this._configurationService = _configurationService;
|
|
17
|
+
this._outlineEntryFactory = _outlineEntryFactory;
|
|
18
|
+
this._disposables = ( new DisposableStore());
|
|
19
|
+
this._onDidChange = ( new Emitter());
|
|
20
|
+
this.onDidChange = this._onDidChange.event;
|
|
21
|
+
this._entries = [];
|
|
22
|
+
this.recomputeState();
|
|
23
|
+
}
|
|
24
|
+
get activeElement() {
|
|
25
|
+
return this._activeEntry;
|
|
26
|
+
}
|
|
27
|
+
get entries() {
|
|
28
|
+
return this._entries;
|
|
29
|
+
}
|
|
30
|
+
get isEmpty() {
|
|
31
|
+
return this._entries.length === 0;
|
|
32
|
+
}
|
|
33
|
+
get uri() {
|
|
34
|
+
return this._uri;
|
|
35
|
+
}
|
|
36
|
+
async computeFullSymbols(cancelToken) {
|
|
37
|
+
try {
|
|
38
|
+
const notebookEditorWidget = this._editor;
|
|
39
|
+
const notebookCells = notebookEditorWidget?.getViewModel()?.viewCells.filter((cell) => cell.cellKind === CellKind.Code);
|
|
40
|
+
if (notebookCells) {
|
|
41
|
+
const promises = [];
|
|
42
|
+
for (const cell of notebookCells.slice(0, 50)) {
|
|
43
|
+
promises.push(this._outlineEntryFactory.cacheSymbols(cell, cancelToken));
|
|
44
|
+
}
|
|
45
|
+
await Promise.allSettled(promises);
|
|
46
|
+
}
|
|
47
|
+
this.recomputeState();
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
console.error('Failed to compute notebook outline symbols:', err);
|
|
51
|
+
this.recomputeState();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
recomputeState() {
|
|
55
|
+
this._disposables.clear();
|
|
56
|
+
this._activeEntry = undefined;
|
|
57
|
+
this._uri = undefined;
|
|
58
|
+
if (!this._editor.hasModel()) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
this._uri = this._editor.textModel.uri;
|
|
62
|
+
const notebookEditorWidget = this._editor;
|
|
63
|
+
if (notebookEditorWidget.getLength() === 0) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const notebookCells = notebookEditorWidget.getViewModel().viewCells;
|
|
67
|
+
const entries = [];
|
|
68
|
+
for (const cell of notebookCells) {
|
|
69
|
+
entries.push(...this._outlineEntryFactory.getOutlineEntries(cell, entries.length));
|
|
70
|
+
}
|
|
71
|
+
if (entries.length > 0) {
|
|
72
|
+
const result = [entries[0]];
|
|
73
|
+
const parentStack = [entries[0]];
|
|
74
|
+
for (let i = 1; i < entries.length; i++) {
|
|
75
|
+
const entry = entries[i];
|
|
76
|
+
while (true) {
|
|
77
|
+
const len = parentStack.length;
|
|
78
|
+
if (len === 0) {
|
|
79
|
+
result.push(entry);
|
|
80
|
+
parentStack.push(entry);
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
const parentCandidate = parentStack[len - 1];
|
|
85
|
+
if (parentCandidate.level < entry.level) {
|
|
86
|
+
parentCandidate.addChild(entry);
|
|
87
|
+
parentStack.push(entry);
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
parentStack.pop();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
this._entries = result;
|
|
97
|
+
}
|
|
98
|
+
const markerServiceListener = ( new MutableDisposable());
|
|
99
|
+
this._disposables.add(markerServiceListener);
|
|
100
|
+
const updateMarkerUpdater = () => {
|
|
101
|
+
if (notebookEditorWidget.isDisposed) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const doUpdateMarker = (clear) => {
|
|
105
|
+
for (const entry of this._entries) {
|
|
106
|
+
if (clear) {
|
|
107
|
+
entry.clearMarkers();
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
entry.updateMarkers(this._markerService);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
const problem = this._configurationService.getValue('problems.visibility');
|
|
115
|
+
if (problem === undefined) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const config = this._configurationService.getValue(OutlineConfigKeys.problemsEnabled);
|
|
119
|
+
if (problem && config) {
|
|
120
|
+
markerServiceListener.value = this._markerService.onMarkerChanged(e => {
|
|
121
|
+
if (notebookEditorWidget.isDisposed) {
|
|
122
|
+
console.error('notebook editor is disposed');
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (( e.some(uri => ( notebookEditorWidget.getCellsInRange().some(cell => isEqual(cell.uri, uri)))))) {
|
|
126
|
+
doUpdateMarker(false);
|
|
127
|
+
this._onDidChange.fire({});
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
doUpdateMarker(false);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
markerServiceListener.clear();
|
|
134
|
+
doUpdateMarker(true);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
updateMarkerUpdater();
|
|
138
|
+
this._disposables.add(this._configurationService.onDidChangeConfiguration(e => {
|
|
139
|
+
if (e.affectsConfiguration('problems.visibility') || e.affectsConfiguration(OutlineConfigKeys.problemsEnabled)) {
|
|
140
|
+
updateMarkerUpdater();
|
|
141
|
+
this._onDidChange.fire({});
|
|
142
|
+
}
|
|
143
|
+
}));
|
|
144
|
+
const { changeEventTriggered } = this.recomputeActive();
|
|
145
|
+
if (!changeEventTriggered) {
|
|
146
|
+
this._onDidChange.fire({});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
recomputeActive() {
|
|
150
|
+
let newActive;
|
|
151
|
+
const notebookEditorWidget = this._editor;
|
|
152
|
+
if (notebookEditorWidget) {
|
|
153
|
+
if (notebookEditorWidget.hasModel() && notebookEditorWidget.getLength() > 0) {
|
|
154
|
+
const cell = notebookEditorWidget.cellAt(notebookEditorWidget.getFocus().start);
|
|
155
|
+
if (cell) {
|
|
156
|
+
for (const entry of this._entries) {
|
|
157
|
+
newActive = entry.find(cell, []);
|
|
158
|
+
if (newActive) {
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (newActive !== this._activeEntry) {
|
|
166
|
+
this._activeEntry = newActive;
|
|
167
|
+
this._onDidChange.fire({ affectOnlyActiveElement: true });
|
|
168
|
+
return { changeEventTriggered: true };
|
|
169
|
+
}
|
|
170
|
+
return { changeEventTriggered: false };
|
|
171
|
+
}
|
|
172
|
+
dispose() {
|
|
173
|
+
this._entries.length = 0;
|
|
174
|
+
this._activeEntry = undefined;
|
|
175
|
+
this._disposables.dispose();
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
NotebookCellOutlineDataSource = ( __decorate([
|
|
179
|
+
( __param(1, IMarkerService)),
|
|
180
|
+
( __param(2, IConfigurationService)),
|
|
181
|
+
( __param(3, INotebookOutlineEntryFactory))
|
|
182
|
+
], NotebookCellOutlineDataSource));
|
|
183
|
+
|
|
184
|
+
export { NotebookCellOutlineDataSource };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type IReference } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
3
|
+
import type { INotebookEditor } from "@codingame/monaco-vscode-670aae94-7f88-54d7-90ea-6fcbef423557-common/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser";
|
|
4
|
+
import { NotebookCellOutlineDataSource } from "./notebookOutlineDataSource.js";
|
|
5
|
+
import { INotebookCellOutlineDataSourceFactory } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSourceFactory.service";
|
|
6
|
+
export declare class NotebookCellOutlineDataSourceFactory implements INotebookCellOutlineDataSourceFactory {
|
|
7
|
+
private readonly _data;
|
|
8
|
+
constructor(instantiationService: IInstantiationService);
|
|
9
|
+
getOrCreate(editor: INotebookEditor): IReference<NotebookCellOutlineDataSource>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { ReferenceCollection } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
5
|
+
import { NotebookCellOutlineDataSource } from './notebookOutlineDataSource.js';
|
|
6
|
+
|
|
7
|
+
let NotebookCellOutlineDataSourceReferenceCollection = class NotebookCellOutlineDataSourceReferenceCollection extends ReferenceCollection {
|
|
8
|
+
constructor(instantiationService) {
|
|
9
|
+
super();
|
|
10
|
+
this.instantiationService = instantiationService;
|
|
11
|
+
}
|
|
12
|
+
createReferencedObject(_key, editor) {
|
|
13
|
+
return this.instantiationService.createInstance(NotebookCellOutlineDataSource, editor);
|
|
14
|
+
}
|
|
15
|
+
destroyReferencedObject(_key, object) {
|
|
16
|
+
object.dispose();
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
NotebookCellOutlineDataSourceReferenceCollection = ( __decorate([
|
|
20
|
+
( __param(0, IInstantiationService))
|
|
21
|
+
], NotebookCellOutlineDataSourceReferenceCollection));
|
|
22
|
+
let NotebookCellOutlineDataSourceFactory = class NotebookCellOutlineDataSourceFactory {
|
|
23
|
+
constructor(instantiationService) {
|
|
24
|
+
this._data = instantiationService.createInstance(NotebookCellOutlineDataSourceReferenceCollection);
|
|
25
|
+
}
|
|
26
|
+
getOrCreate(editor) {
|
|
27
|
+
return this._data.acquire(editor.getId(), editor);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
NotebookCellOutlineDataSourceFactory = ( __decorate([
|
|
31
|
+
( __param(0, IInstantiationService))
|
|
32
|
+
], NotebookCellOutlineDataSourceFactory));
|
|
33
|
+
|
|
34
|
+
export { NotebookCellOutlineDataSourceFactory };
|
package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
2
2
|
import { IOutlineModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/contrib/documentSymbols/browser/outlineModel.service";
|
|
3
3
|
import { ICellViewModel } from "@codingame/monaco-vscode-670aae94-7f88-54d7-90ea-6fcbef423557-common/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser";
|
|
4
|
-
import { OutlineEntry } from "@codingame/monaco-vscode-
|
|
4
|
+
import { OutlineEntry } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/viewModel/OutlineEntry";
|
|
5
5
|
import { INotebookExecutionStateService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService.service";
|
|
6
6
|
import { ITextModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service";
|
|
7
|
-
import { INotebookOutlineEntryFactory } from "
|
|
7
|
+
import { INotebookOutlineEntryFactory } from "./notebookOutlineEntryFactory.service.js";
|
|
8
8
|
export declare enum NotebookOutlineConstants {
|
|
9
9
|
NonHeaderOutlineLevel = 7
|
|
10
10
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
2
|
+
import { ICellViewModel } from "@codingame/monaco-vscode-670aae94-7f88-54d7-90ea-6fcbef423557-common/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser";
|
|
3
|
+
import { OutlineEntry } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/viewModel/OutlineEntry";
|
|
4
|
+
export declare const INotebookOutlineEntryFactory: import("@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation").ServiceIdentifier<INotebookOutlineEntryFactory>;
|
|
5
|
+
export interface INotebookOutlineEntryFactory {
|
|
6
|
+
readonly _serviceBrand: undefined;
|
|
7
|
+
getOutlineEntries(cell: ICellViewModel, index: number): OutlineEntry[];
|
|
8
|
+
cacheSymbols(cell: ICellViewModel, cancelToken: CancellationToken): Promise<void>;
|
|
9
|
+
}
|