@codingame/monaco-vscode-notebook-service-override 22.1.4 → 22.1.6
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 +7 -1
- package/package.json +23 -24
- 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/OutlineEntry.d.ts +37 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/OutlineEntry.js +98 -0
- 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.js +135 -30
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +12 -12
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +1 -1
package/index.js
CHANGED
|
@@ -32,7 +32,11 @@ 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';
|
|
38
|
+
import { NotebookOutlineEntryFactory } from './vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js';
|
|
39
|
+
import { INotebookOutlineEntryFactory } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.service';
|
|
36
40
|
|
|
37
41
|
function getServiceOverride() {
|
|
38
42
|
return {
|
|
@@ -51,7 +55,9 @@ function getServiceOverride() {
|
|
|
51
55
|
[INotebookSearchService.toString()]: new SyncDescriptor(NotebookSearchService, [], true),
|
|
52
56
|
[INotebookDocumentService.toString()]: new SyncDescriptor(NotebookDocumentWorkbenchService, [], true),
|
|
53
57
|
[INotebookOriginalCellModelFactory.toString()]: new SyncDescriptor(OriginalNotebookCellModelFactory, [], true),
|
|
54
|
-
[INotebookOriginalModelReferenceFactory.toString()]: new SyncDescriptor(NotebookOriginalModelReferenceFactory, [], true)
|
|
58
|
+
[INotebookOriginalModelReferenceFactory.toString()]: new SyncDescriptor(NotebookOriginalModelReferenceFactory, [], true),
|
|
59
|
+
[INotebookCellOutlineDataSourceFactory.toString()]: new SyncDescriptor(NotebookCellOutlineDataSourceFactory, [], true),
|
|
60
|
+
[INotebookOutlineEntryFactory.toString()]: new SyncDescriptor(NotebookOutlineEntryFactory, [], true)
|
|
55
61
|
};
|
|
56
62
|
}
|
|
57
63
|
|
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.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - notebook service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,29 +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.
|
|
40
|
-
"marked": "14.0.0"
|
|
18
|
+
"@codingame/monaco-vscode-0cd5242b-7b61-5f66-ac25-ffa40baf8e8f-common": "22.1.6",
|
|
19
|
+
"@codingame/monaco-vscode-158b9837-fc78-5d9c-86f5-9134e4358643-common": "22.1.6",
|
|
20
|
+
"@codingame/monaco-vscode-23aade48-f094-5c08-9555-97fc9cca96c9-common": "22.1.6",
|
|
21
|
+
"@codingame/monaco-vscode-3109a756-1f83-5d09-945b-9f0fcad928f0-common": "22.1.6",
|
|
22
|
+
"@codingame/monaco-vscode-501b06ab-3f58-516b-8a1a-c29d375d3da4-common": "22.1.6",
|
|
23
|
+
"@codingame/monaco-vscode-60014c9d-b815-501d-83a9-4b08725c2ec2-common": "22.1.6",
|
|
24
|
+
"@codingame/monaco-vscode-622c0cca-d5fa-59b6-b730-0715afcf93ee-common": "22.1.6",
|
|
25
|
+
"@codingame/monaco-vscode-670aae94-7f88-54d7-90ea-6fcbef423557-common": "22.1.6",
|
|
26
|
+
"@codingame/monaco-vscode-6f9bc782-77e0-5716-93bd-b05210c768c5-common": "22.1.6",
|
|
27
|
+
"@codingame/monaco-vscode-88aa9a78-75f5-5aaa-89e9-bbdd580b3b5c-common": "22.1.6",
|
|
28
|
+
"@codingame/monaco-vscode-8ccb7637-50ea-5359-97bf-00015d7fe567-common": "22.1.6",
|
|
29
|
+
"@codingame/monaco-vscode-9ed6fe06-a052-57c2-a234-5d9b94d2e7e0-common": "22.1.6",
|
|
30
|
+
"@codingame/monaco-vscode-9ee79c1a-3f03-568b-8eac-b02513a98b68-common": "22.1.6",
|
|
31
|
+
"@codingame/monaco-vscode-a793b3ee-7ba9-5176-a019-30ec806fdd95-common": "22.1.6",
|
|
32
|
+
"@codingame/monaco-vscode-api": "22.1.6",
|
|
33
|
+
"@codingame/monaco-vscode-b994942c-360d-5b68-8a33-77d4bde6b714-common": "22.1.6",
|
|
34
|
+
"@codingame/monaco-vscode-b99aef83-0d60-5e8c-a62e-9908b6256f35-common": "22.1.6",
|
|
35
|
+
"@codingame/monaco-vscode-bba55be6-41a2-50cd-a3cc-8bafa35bfa89-common": "22.1.6",
|
|
36
|
+
"@codingame/monaco-vscode-caeb744c-8e3f-5c11-80fb-0f057d24d544-common": "22.1.6",
|
|
37
|
+
"@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common": "22.1.6",
|
|
38
|
+
"@codingame/monaco-vscode-e4d0fd26-1b26-5583-b3f7-582e08d7b389-common": "22.1.6",
|
|
39
|
+
"@codingame/monaco-vscode-eda30bac-0984-5b42-9362-c68996b85232-common": "22.1.6"
|
|
41
40
|
},
|
|
42
41
|
"main": "index.js",
|
|
43
42
|
"module": "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 "
|
|
17
|
+
import { OutlineEntry } from "../../viewModel/OutlineEntry.js";
|
|
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 "
|
|
4
|
+
import { OutlineEntry } from "../viewModel/OutlineEntry.js";
|
|
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';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ThemeIcon } from "@codingame/monaco-vscode-api/vscode/vs/base/common/themables";
|
|
2
|
+
import { MarkerSeverity } from "@codingame/monaco-vscode-api/vscode/vs/platform/markers/common/markers";
|
|
3
|
+
import { IMarkerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/markers/common/markers.service";
|
|
4
|
+
import { ICellViewModel } from "@codingame/monaco-vscode-670aae94-7f88-54d7-90ea-6fcbef423557-common/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser";
|
|
5
|
+
import { IRange } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/core/range";
|
|
6
|
+
import { SymbolKind } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages";
|
|
7
|
+
export interface IOutlineMarkerInfo {
|
|
8
|
+
readonly count: number;
|
|
9
|
+
readonly topSev: MarkerSeverity;
|
|
10
|
+
}
|
|
11
|
+
export declare class OutlineEntry {
|
|
12
|
+
readonly index: number;
|
|
13
|
+
readonly level: number;
|
|
14
|
+
readonly cell: ICellViewModel;
|
|
15
|
+
readonly label: string;
|
|
16
|
+
readonly isExecuting: boolean;
|
|
17
|
+
readonly isPaused: boolean;
|
|
18
|
+
readonly range?: IRange | undefined;
|
|
19
|
+
readonly symbolKind?: SymbolKind | undefined;
|
|
20
|
+
private _children;
|
|
21
|
+
private _parent;
|
|
22
|
+
private _markerInfo;
|
|
23
|
+
get icon(): ThemeIcon;
|
|
24
|
+
constructor(index: number, level: number, cell: ICellViewModel, label: string, isExecuting: boolean, isPaused: boolean, range?: IRange | undefined, symbolKind?: SymbolKind | undefined);
|
|
25
|
+
addChild(entry: OutlineEntry): void;
|
|
26
|
+
get parent(): OutlineEntry | undefined;
|
|
27
|
+
get children(): Iterable<OutlineEntry>;
|
|
28
|
+
get markerInfo(): IOutlineMarkerInfo | undefined;
|
|
29
|
+
get position(): {
|
|
30
|
+
startLineNumber: number;
|
|
31
|
+
startColumn: number;
|
|
32
|
+
} | undefined;
|
|
33
|
+
updateMarkers(markerService: IMarkerService): void;
|
|
34
|
+
clearMarkers(): void;
|
|
35
|
+
find(cell: ICellViewModel, parents: OutlineEntry[]): OutlineEntry | undefined;
|
|
36
|
+
asFlatList(bucket: OutlineEntry[]): void;
|
|
37
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
|
|
2
|
+
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
3
|
+
import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
|
|
4
|
+
import { MarkerSeverity } from '@codingame/monaco-vscode-api/vscode/vs/platform/markers/common/markers';
|
|
5
|
+
import { executingStateIcon } from '@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/notebook/browser/notebookIcons';
|
|
6
|
+
import { CellKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
7
|
+
import { SymbolKinds } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages';
|
|
8
|
+
|
|
9
|
+
class OutlineEntry {
|
|
10
|
+
get icon() {
|
|
11
|
+
if (this.symbolKind) {
|
|
12
|
+
return SymbolKinds.toIcon(this.symbolKind);
|
|
13
|
+
}
|
|
14
|
+
return this.isExecuting && this.isPaused ? executingStateIcon :
|
|
15
|
+
this.isExecuting ? ThemeIcon.modify(executingStateIcon, 'spin') :
|
|
16
|
+
this.cell.cellKind === CellKind.Markup ? Codicon.markdown : Codicon.code;
|
|
17
|
+
}
|
|
18
|
+
constructor(index, level, cell, label, isExecuting, isPaused, range, symbolKind) {
|
|
19
|
+
this.index = index;
|
|
20
|
+
this.level = level;
|
|
21
|
+
this.cell = cell;
|
|
22
|
+
this.label = label;
|
|
23
|
+
this.isExecuting = isExecuting;
|
|
24
|
+
this.isPaused = isPaused;
|
|
25
|
+
this.range = range;
|
|
26
|
+
this.symbolKind = symbolKind;
|
|
27
|
+
this._children = [];
|
|
28
|
+
}
|
|
29
|
+
addChild(entry) {
|
|
30
|
+
this._children.push(entry);
|
|
31
|
+
entry._parent = this;
|
|
32
|
+
}
|
|
33
|
+
get parent() {
|
|
34
|
+
return this._parent;
|
|
35
|
+
}
|
|
36
|
+
get children() {
|
|
37
|
+
return this._children;
|
|
38
|
+
}
|
|
39
|
+
get markerInfo() {
|
|
40
|
+
return this._markerInfo;
|
|
41
|
+
}
|
|
42
|
+
get position() {
|
|
43
|
+
if (this.range) {
|
|
44
|
+
return { startLineNumber: this.range.startLineNumber, startColumn: this.range.startColumn };
|
|
45
|
+
}
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
updateMarkers(markerService) {
|
|
49
|
+
if (this.cell.cellKind === CellKind.Code) {
|
|
50
|
+
const marker = markerService.read({ resource: this.cell.uri, severities: MarkerSeverity.Error | MarkerSeverity.Warning });
|
|
51
|
+
if (marker.length === 0) {
|
|
52
|
+
this._markerInfo = undefined;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
const topSev = marker.find(a => a.severity === MarkerSeverity.Error)?.severity ?? MarkerSeverity.Warning;
|
|
56
|
+
this._markerInfo = { topSev, count: marker.length };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
let topChild;
|
|
61
|
+
for (const child of this.children) {
|
|
62
|
+
child.updateMarkers(markerService);
|
|
63
|
+
if (child.markerInfo) {
|
|
64
|
+
topChild = !topChild ? child.markerInfo.topSev : Math.max(child.markerInfo.topSev, topChild);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
this._markerInfo = topChild && { topSev: topChild, count: 0 };
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
clearMarkers() {
|
|
71
|
+
this._markerInfo = undefined;
|
|
72
|
+
for (const child of this.children) {
|
|
73
|
+
child.clearMarkers();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
find(cell, parents) {
|
|
77
|
+
if (cell.id === this.cell.id) {
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
parents.push(this);
|
|
81
|
+
for (const child of this.children) {
|
|
82
|
+
const result = child.find(cell, parents);
|
|
83
|
+
if (result) {
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
parents.pop();
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
asFlatList(bucket) {
|
|
91
|
+
bucket.push(this);
|
|
92
|
+
for (const child of this.children) {
|
|
93
|
+
child.asFlatList(bucket);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export { OutlineEntry };
|
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 "./OutlineEntry.js";
|
|
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 '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.service';
|
|
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 "
|
|
4
|
+
import { OutlineEntry } from "./OutlineEntry.js";
|
|
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 "@codingame/monaco-vscode-
|
|
7
|
+
import { INotebookOutlineEntryFactory } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.service";
|
|
8
8
|
export declare enum NotebookOutlineConstants {
|
|
9
9
|
NonHeaderOutlineLevel = 7
|
|
10
10
|
}
|
package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js
CHANGED
|
@@ -1,37 +1,142 @@
|
|
|
1
1
|
|
|
2
|
-
import '@codingame/monaco-vscode-api/
|
|
3
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/
|
|
4
|
-
import '@codingame/monaco-vscode-api/vscode/vs/
|
|
5
|
-
import '@codingame/monaco-vscode-api/vscode/vs/
|
|
6
|
-
import '@codingame/monaco-vscode-
|
|
7
|
-
import '
|
|
8
|
-
import '@codingame/monaco-vscode-api/vscode/vs/
|
|
9
|
-
import '@codingame/monaco-vscode-api/vscode/vs/
|
|
10
|
-
import '
|
|
11
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/charCode';
|
|
12
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/marshallingIds';
|
|
13
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
|
|
14
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
15
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
16
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
17
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
18
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/browser/domSanitize';
|
|
19
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/browser/browser';
|
|
20
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/keybindings';
|
|
21
|
-
import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
22
|
-
import '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
23
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
24
|
-
import '@codingame/monaco-vscode-api/vscode/vs/editor/common/model';
|
|
25
|
-
import '@codingame/monaco-vscode-api/vscode/vs/editor/contrib/folding/browser/foldingRanges';
|
|
26
|
-
import '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
27
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
28
|
-
import '@codingame/monaco-vscode-api/vscode/vs/platform/markers/common/markers';
|
|
29
|
-
import '@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/notebook/browser/notebookIcons';
|
|
30
|
-
import '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages';
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { renderAsPlaintext } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/markdownRenderer';
|
|
4
|
+
import { IOutlineModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/contrib/documentSymbols/browser/outlineModel.service';
|
|
5
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
6
|
+
import { getMarkdownHeadersInCell } from '@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/notebook/browser/viewModel/foldingModel';
|
|
7
|
+
import { OutlineEntry } from './OutlineEntry.js';
|
|
8
|
+
import { CellKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
9
|
+
import { INotebookExecutionStateService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService.service';
|
|
10
|
+
import { ITextModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service';
|
|
31
11
|
|
|
32
12
|
var NotebookOutlineConstants;
|
|
33
13
|
(function (NotebookOutlineConstants) {
|
|
34
14
|
NotebookOutlineConstants[NotebookOutlineConstants["NonHeaderOutlineLevel"] = 7] = "NonHeaderOutlineLevel";
|
|
35
15
|
})(NotebookOutlineConstants || (NotebookOutlineConstants = {}));
|
|
16
|
+
function getMarkdownHeadersInCellFallbackToHtmlTags(fullContent) {
|
|
17
|
+
const headers = Array.from(getMarkdownHeadersInCell(fullContent));
|
|
18
|
+
if (headers.length) {
|
|
19
|
+
return headers;
|
|
20
|
+
}
|
|
21
|
+
const match = fullContent.match(/<h([1-6]).*>(.*)<\/h\1>/i);
|
|
22
|
+
if (match) {
|
|
23
|
+
const level = parseInt(match[1]);
|
|
24
|
+
const text = match[2].trim();
|
|
25
|
+
headers.push({ depth: level, text });
|
|
26
|
+
}
|
|
27
|
+
return headers;
|
|
28
|
+
}
|
|
29
|
+
let NotebookOutlineEntryFactory = class NotebookOutlineEntryFactory {
|
|
30
|
+
constructor(executionStateService, outlineModelService, textModelService) {
|
|
31
|
+
this.executionStateService = executionStateService;
|
|
32
|
+
this.outlineModelService = outlineModelService;
|
|
33
|
+
this.textModelService = textModelService;
|
|
34
|
+
this.cellOutlineEntryCache = {};
|
|
35
|
+
this.cachedMarkdownOutlineEntries = ( new WeakMap());
|
|
36
|
+
}
|
|
37
|
+
getOutlineEntries(cell, index) {
|
|
38
|
+
const entries = [];
|
|
39
|
+
const isMarkdown = cell.cellKind === CellKind.Markup;
|
|
40
|
+
let content = getCellFirstNonEmptyLine(cell);
|
|
41
|
+
let hasHeader = false;
|
|
42
|
+
if (isMarkdown) {
|
|
43
|
+
const fullContent = cell.getText().substring(0, 10000);
|
|
44
|
+
const cache = this.cachedMarkdownOutlineEntries.get(cell);
|
|
45
|
+
const headers = cache?.alternativeId === cell.getAlternativeId() ? cache.headers : Array.from(getMarkdownHeadersInCellFallbackToHtmlTags(fullContent));
|
|
46
|
+
this.cachedMarkdownOutlineEntries.set(cell, { alternativeId: cell.getAlternativeId(), headers });
|
|
47
|
+
for (const { depth, text } of headers) {
|
|
48
|
+
hasHeader = true;
|
|
49
|
+
entries.push(( new OutlineEntry(index++, depth, cell, text, false, false)));
|
|
50
|
+
}
|
|
51
|
+
if (!hasHeader) {
|
|
52
|
+
content = renderAsPlaintext({ value: content });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (!hasHeader) {
|
|
56
|
+
const exeState = !isMarkdown && this.executionStateService.getCellExecution(cell.uri);
|
|
57
|
+
let preview = content.trim();
|
|
58
|
+
if (!isMarkdown) {
|
|
59
|
+
const cached = this.cellOutlineEntryCache[cell.id];
|
|
60
|
+
if (cached) {
|
|
61
|
+
entries.push(( new OutlineEntry(
|
|
62
|
+
index++,
|
|
63
|
+
NotebookOutlineConstants.NonHeaderOutlineLevel,
|
|
64
|
+
cell,
|
|
65
|
+
preview,
|
|
66
|
+
!!exeState,
|
|
67
|
+
exeState ? exeState.isPaused : false
|
|
68
|
+
)));
|
|
69
|
+
cached.forEach((entry) => {
|
|
70
|
+
entries.push(( new OutlineEntry(
|
|
71
|
+
index++,
|
|
72
|
+
entry.level,
|
|
73
|
+
cell,
|
|
74
|
+
entry.name,
|
|
75
|
+
false,
|
|
76
|
+
false,
|
|
77
|
+
entry.range,
|
|
78
|
+
entry.kind
|
|
79
|
+
)));
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (entries.length === 0) {
|
|
84
|
+
if (preview.length === 0) {
|
|
85
|
+
preview = ( localize(9298, "empty cell"));
|
|
86
|
+
}
|
|
87
|
+
entries.push(( new OutlineEntry(
|
|
88
|
+
index++,
|
|
89
|
+
NotebookOutlineConstants.NonHeaderOutlineLevel,
|
|
90
|
+
cell,
|
|
91
|
+
preview,
|
|
92
|
+
!!exeState,
|
|
93
|
+
exeState ? exeState.isPaused : false
|
|
94
|
+
)));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return entries;
|
|
98
|
+
}
|
|
99
|
+
async cacheSymbols(cell, cancelToken) {
|
|
100
|
+
if (cell.cellKind === CellKind.Markup) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const ref = await this.textModelService.createModelReference(cell.uri);
|
|
104
|
+
try {
|
|
105
|
+
const textModel = ref.object.textEditorModel;
|
|
106
|
+
const outlineModel = await this.outlineModelService.getOrCreate(textModel, cancelToken);
|
|
107
|
+
const entries = createOutlineEntries(outlineModel.getTopLevelSymbols(), 8);
|
|
108
|
+
this.cellOutlineEntryCache[cell.id] = entries;
|
|
109
|
+
}
|
|
110
|
+
finally {
|
|
111
|
+
ref.dispose();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
NotebookOutlineEntryFactory = ( __decorate([
|
|
116
|
+
( __param(0, INotebookExecutionStateService)),
|
|
117
|
+
( __param(1, IOutlineModelService)),
|
|
118
|
+
( __param(2, ITextModelService))
|
|
119
|
+
], NotebookOutlineEntryFactory));
|
|
120
|
+
function createOutlineEntries(symbols, level) {
|
|
121
|
+
const entries = [];
|
|
122
|
+
symbols.forEach(symbol => {
|
|
123
|
+
entries.push({ name: symbol.name, range: symbol.range, level, kind: symbol.kind });
|
|
124
|
+
if (symbol.children) {
|
|
125
|
+
entries.push(...createOutlineEntries(symbol.children, level + 1));
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
return entries;
|
|
129
|
+
}
|
|
130
|
+
function getCellFirstNonEmptyLine(cell) {
|
|
131
|
+
const textBuffer = cell.textBuffer;
|
|
132
|
+
for (let i = 0; i < textBuffer.getLineCount(); i++) {
|
|
133
|
+
const firstNonWhitespace = textBuffer.getLineFirstNonWhitespaceColumn(i + 1);
|
|
134
|
+
const lineLength = textBuffer.getLineLength(i + 1);
|
|
135
|
+
if (firstNonWhitespace < lineLength) {
|
|
136
|
+
return textBuffer.getLineContent(i + 1);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return cell.getText().substring(0, 100);
|
|
140
|
+
}
|
|
36
141
|
|
|
37
|
-
export { NotebookOutlineConstants };
|
|
142
|
+
export { NotebookOutlineConstants, NotebookOutlineEntryFactory };
|
|
@@ -48,8 +48,8 @@ import { IProgressService } from '@codingame/monaco-vscode-api/vscode/vs/platfor
|
|
|
48
48
|
var FileWorkingCopyManager_1;
|
|
49
49
|
let FileWorkingCopyManager = class FileWorkingCopyManager extends Disposable {
|
|
50
50
|
static { FileWorkingCopyManager_1 = this; }
|
|
51
|
-
static { this.FILE_WORKING_COPY_SAVE_CREATE_SOURCE = SaveSourceRegistry.registerSource('fileWorkingCopyCreate.source', ( localize(
|
|
52
|
-
static { this.FILE_WORKING_COPY_SAVE_REPLACE_SOURCE = SaveSourceRegistry.registerSource('fileWorkingCopyReplace.source', ( localize(
|
|
51
|
+
static { this.FILE_WORKING_COPY_SAVE_CREATE_SOURCE = SaveSourceRegistry.registerSource('fileWorkingCopyCreate.source', ( localize(14086, "File Created"))); }
|
|
52
|
+
static { this.FILE_WORKING_COPY_SAVE_REPLACE_SOURCE = SaveSourceRegistry.registerSource('fileWorkingCopyReplace.source', ( localize(14087, "File Replaced"))); }
|
|
53
53
|
constructor(workingCopyTypeId, storedWorkingCopyModelFactory, untitledWorkingCopyModelFactory, fileService, lifecycleService, labelService, logService, workingCopyFileService, workingCopyBackupService, uriIdentityService, fileDialogService, filesConfigurationService, workingCopyService, notificationService, workingCopyEditorService, editorService, elevatedFileService, pathService, environmentService, dialogService, decorationsService, progressService) {
|
|
54
54
|
super();
|
|
55
55
|
this.workingCopyTypeId = workingCopyTypeId;
|
|
@@ -104,7 +104,7 @@ let FileWorkingCopyManager = class FileWorkingCopyManager extends Disposable {
|
|
|
104
104
|
constructor(stored) {
|
|
105
105
|
super();
|
|
106
106
|
this.stored = stored;
|
|
107
|
-
this.label = ( localize(
|
|
107
|
+
this.label = ( localize(14088, "File Working Copy Decorations"));
|
|
108
108
|
this._onDidChange = this._register(( new Emitter()));
|
|
109
109
|
this.onDidChange = this._onDidChange.event;
|
|
110
110
|
this.registerListeners();
|
|
@@ -131,20 +131,20 @@ let FileWorkingCopyManager = class FileWorkingCopyManager extends Disposable {
|
|
|
131
131
|
color: listErrorForeground,
|
|
132
132
|
letter: Codicon.lockSmall,
|
|
133
133
|
strikethrough: true,
|
|
134
|
-
tooltip: ( localize(
|
|
134
|
+
tooltip: ( localize(14089, "Deleted, Read-only")),
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
137
|
else if (isReadonly) {
|
|
138
138
|
return {
|
|
139
139
|
letter: Codicon.lockSmall,
|
|
140
|
-
tooltip: ( localize(
|
|
140
|
+
tooltip: ( localize(14090, "Read-only")),
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
143
|
else if (isOrphaned) {
|
|
144
144
|
return {
|
|
145
145
|
color: listErrorForeground,
|
|
146
146
|
strikethrough: true,
|
|
147
|
-
tooltip: ( localize(
|
|
147
|
+
tooltip: ( localize(14091, "Deleted")),
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
150
|
return undefined;
|
|
@@ -279,17 +279,17 @@ let FileWorkingCopyManager = class FileWorkingCopyManager extends Disposable {
|
|
|
279
279
|
const { confirmed } = await this.dialogService.confirm({
|
|
280
280
|
type: 'warning',
|
|
281
281
|
message: ( localize(
|
|
282
|
-
|
|
282
|
+
14092,
|
|
283
283
|
"'{0}' already exists. Do you want to replace it?",
|
|
284
284
|
basename(resource)
|
|
285
285
|
)),
|
|
286
286
|
detail: ( localize(
|
|
287
|
-
|
|
287
|
+
14093,
|
|
288
288
|
"A file or folder with the name '{0}' already exists in the folder '{1}'. Replacing it will overwrite its current contents.",
|
|
289
289
|
basename(resource),
|
|
290
290
|
basename(dirname(resource))
|
|
291
291
|
)),
|
|
292
|
-
primaryButton: ( localize(
|
|
292
|
+
primaryButton: ( localize(14094, "&&Replace"))
|
|
293
293
|
});
|
|
294
294
|
return confirmed;
|
|
295
295
|
}
|
|
@@ -297,12 +297,12 @@ let FileWorkingCopyManager = class FileWorkingCopyManager extends Disposable {
|
|
|
297
297
|
const { confirmed } = await this.dialogService.confirm({
|
|
298
298
|
type: 'warning',
|
|
299
299
|
message: ( localize(
|
|
300
|
-
|
|
300
|
+
14095,
|
|
301
301
|
"'{0}' is marked as read-only. Do you want to save anyway?",
|
|
302
302
|
basename(resource)
|
|
303
303
|
)),
|
|
304
|
-
detail: ( localize(
|
|
305
|
-
primaryButton: ( localize(
|
|
304
|
+
detail: ( localize(14096, "Paths can be configured as read-only via settings.")),
|
|
305
|
+
primaryButton: ( localize(14097, "&&Save Anyway"))
|
|
306
306
|
});
|
|
307
307
|
return confirmed;
|
|
308
308
|
}
|
|
@@ -78,7 +78,7 @@ let StoredFileWorkingCopyManager = class StoredFileWorkingCopyManager extends Ba
|
|
|
78
78
|
this._register(this.lifecycleService.onBeforeShutdown(event => event.veto(this.onBeforeShutdownWeb(), 'veto.fileWorkingCopyManager')));
|
|
79
79
|
}
|
|
80
80
|
else {
|
|
81
|
-
this._register(this.lifecycleService.onWillShutdown(event => event.join(this.onWillShutdownDesktop(), { id: 'join.fileWorkingCopyManager', label: ( localize(
|
|
81
|
+
this._register(this.lifecycleService.onWillShutdown(event => event.join(this.onWillShutdownDesktop(), { id: 'join.fileWorkingCopyManager', label: ( localize(14115, "Saving working copies")) })));
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
onBeforeShutdownWeb() {
|