@codingame/monaco-vscode-notebook-service-override 22.1.5 → 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 +3 -0
- package/package.json +23 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.d.ts +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 +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSource.js +1 -1
- 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/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.service.d.ts +0 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.service.js +0 -6
package/index.js
CHANGED
|
@@ -35,6 +35,8 @@ import { NotebookOriginalModelReferenceFactory } from '@codingame/monaco-vscode-
|
|
|
35
35
|
import { INotebookCellOutlineDataSourceFactory } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSourceFactory.service';
|
|
36
36
|
import { NotebookCellOutlineDataSourceFactory } from './vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSourceFactory.js';
|
|
37
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';
|
|
38
40
|
|
|
39
41
|
function getServiceOverride() {
|
|
40
42
|
return {
|
|
@@ -55,6 +57,7 @@ function getServiceOverride() {
|
|
|
55
57
|
[INotebookOriginalCellModelFactory.toString()]: new SyncDescriptor(OriginalNotebookCellModelFactory, [], true),
|
|
56
58
|
[INotebookOriginalModelReferenceFactory.toString()]: new SyncDescriptor(NotebookOriginalModelReferenceFactory, [], true),
|
|
57
59
|
[INotebookCellOutlineDataSourceFactory.toString()]: new SyncDescriptor(NotebookCellOutlineDataSourceFactory, [], true),
|
|
60
|
+
[INotebookOutlineEntryFactory.toString()]: new SyncDescriptor(NotebookOutlineEntryFactory, [], true)
|
|
58
61
|
};
|
|
59
62
|
}
|
|
60
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
|
@@ -14,7 +14,7 @@ import { CellKind } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contr
|
|
|
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";
|
|
@@ -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;
|
|
@@ -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
CHANGED
|
@@ -4,7 +4,7 @@ import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/pl
|
|
|
4
4
|
import { IMarkerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/markers/common/markers.service";
|
|
5
5
|
import { INotebookEditor } from "@codingame/monaco-vscode-670aae94-7f88-54d7-90ea-6fcbef423557-common/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser";
|
|
6
6
|
import { OutlineChangeEvent } from "@codingame/monaco-vscode-622c0cca-d5fa-59b6-b730-0715afcf93ee-common/vscode/vs/workbench/services/outline/browser/outline";
|
|
7
|
-
import { OutlineEntry } from "
|
|
7
|
+
import { OutlineEntry } from "./OutlineEntry.js";
|
|
8
8
|
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
9
9
|
import { NotebookOutlineEntryFactory } from "./notebookOutlineEntryFactory.js";
|
|
10
10
|
export interface INotebookCellOutlineDataSource {
|
package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSource.js
CHANGED
|
@@ -7,7 +7,7 @@ import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/pl
|
|
|
7
7
|
import { IMarkerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/markers/common/markers.service';
|
|
8
8
|
import { CellKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
9
9
|
import { OutlineConfigKeys } from '@codingame/monaco-vscode-622c0cca-d5fa-59b6-b730-0715afcf93ee-common/vscode/vs/workbench/services/outline/browser/outline';
|
|
10
|
-
import { INotebookOutlineEntryFactory } from '
|
|
10
|
+
import { INotebookOutlineEntryFactory } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.service';
|
|
11
11
|
|
|
12
12
|
let NotebookCellOutlineDataSource = class NotebookCellOutlineDataSource {
|
|
13
13
|
constructor(_editor, _markerService, _configurationService, _outlineEntryFactory) {
|
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 "
|
|
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() {
|
|
@@ -1,9 +0,0 @@
|
|
|
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
|
-
}
|