@opensumi/ide-editor 3.2.5-next-1725353631.0 → 3.2.5-next-1725356044.0
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/lib/browser/doc-model/editor-document-model-service.d.ts +2 -1
- package/lib/browser/doc-model/editor-document-model-service.d.ts.map +1 -1
- package/lib/browser/doc-model/editor-document-model-service.js +22 -0
- package/lib/browser/doc-model/editor-document-model-service.js.map +1 -1
- package/lib/browser/doc-model/editor-document-model.d.ts +1 -0
- package/lib/browser/doc-model/editor-document-model.d.ts.map +1 -1
- package/lib/browser/doc-model/editor-document-model.js +14 -0
- package/lib/browser/doc-model/editor-document-model.js.map +1 -1
- package/lib/browser/doc-model/saveParticipants.d.ts.map +1 -1
- package/lib/browser/doc-model/saveParticipants.js +1 -0
- package/lib/browser/doc-model/saveParticipants.js.map +1 -1
- package/lib/browser/doc-model/types.d.ts +3 -1
- package/lib/browser/doc-model/types.d.ts.map +1 -1
- package/lib/browser/doc-model/types.js.map +1 -1
- package/lib/browser/editor-scrollbar/index.module.less +1 -1
- package/lib/browser/editor.contribution.d.ts.map +1 -1
- package/lib/browser/editor.contribution.js +7 -4
- package/lib/browser/editor.contribution.js.map +1 -1
- package/lib/browser/editor.module.less +3 -11
- package/lib/browser/format/formatter-selector.d.ts.map +1 -1
- package/lib/browser/format/formatter-selector.js +6 -8
- package/lib/browser/format/formatter-selector.js.map +1 -1
- package/lib/browser/fs-resource/fs-resource.d.ts.map +1 -1
- package/lib/browser/fs-resource/fs-resource.js +5 -7
- package/lib/browser/fs-resource/fs-resource.js.map +1 -1
- package/lib/browser/hooks/useEditor.d.ts +2 -2
- package/lib/browser/hooks/useEditor.d.ts.map +1 -1
- package/lib/browser/hooks/useEditor.js +10 -11
- package/lib/browser/hooks/useEditor.js.map +1 -1
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +5 -0
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/merge-conflict/merge-conflict.model.d.ts.map +1 -1
- package/lib/browser/merge-conflict/merge-conflict.model.js +3 -4
- package/lib/browser/merge-conflict/merge-conflict.model.js.map +1 -1
- package/lib/browser/monaco-contrib/callHierarchy/callHierarchy.service.d.ts.map +1 -1
- package/lib/browser/monaco-contrib/callHierarchy/callHierarchy.service.js +3 -3
- package/lib/browser/monaco-contrib/callHierarchy/callHierarchy.service.js.map +1 -1
- package/lib/browser/monaco-contrib/typeHierarchy/typeHierarchy.service.d.ts.map +1 -1
- package/lib/browser/monaco-contrib/typeHierarchy/typeHierarchy.service.js +3 -3
- package/lib/browser/monaco-contrib/typeHierarchy/typeHierarchy.service.js.map +1 -1
- package/lib/browser/notebook.service.d.ts +20 -0
- package/lib/browser/notebook.service.d.ts.map +1 -0
- package/lib/browser/notebook.service.js +24 -0
- package/lib/browser/notebook.service.js.map +1 -0
- package/lib/browser/tab.view.d.ts.map +1 -1
- package/lib/browser/tab.view.js +5 -0
- package/lib/browser/tab.view.js.map +1 -1
- package/lib/browser/untitled-resource.d.ts.map +1 -1
- package/lib/browser/untitled-resource.js +5 -7
- package/lib/browser/untitled-resource.js.map +1 -1
- package/lib/browser/workbench-editor.service.d.ts.map +1 -1
- package/lib/browser/workbench-editor.service.js +12 -20
- package/lib/browser/workbench-editor.service.js.map +1 -1
- package/lib/common/editor.d.ts +47 -0
- package/lib/common/editor.d.ts.map +1 -1
- package/lib/common/editor.js.map +1 -1
- package/lib/common/index.d.ts +4 -3
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +4 -3
- package/lib/common/index.js.map +1 -1
- package/lib/common/language.d.ts +1 -0
- package/lib/common/language.d.ts.map +1 -1
- package/lib/common/notebook.d.ts +169 -0
- package/lib/common/notebook.d.ts.map +1 -0
- package/lib/common/notebook.js +26 -0
- package/lib/common/notebook.js.map +1 -0
- package/package.json +14 -14
- package/src/browser/doc-model/editor-document-model-service.ts +25 -1
- package/src/browser/doc-model/editor-document-model.ts +18 -0
- package/src/browser/doc-model/saveParticipants.ts +1 -0
- package/src/browser/doc-model/types.ts +3 -1
- package/src/browser/editor-scrollbar/index.module.less +1 -1
- package/src/browser/editor.contribution.ts +8 -3
- package/src/browser/editor.module.less +3 -11
- package/src/browser/format/formatter-selector.ts +6 -8
- package/src/browser/fs-resource/fs-resource.ts +5 -7
- package/src/browser/hooks/useEditor.ts +13 -12
- package/src/browser/index.ts +6 -0
- package/src/browser/merge-conflict/merge-conflict.model.ts +4 -5
- package/src/browser/monaco-contrib/callHierarchy/callHierarchy.service.ts +4 -2
- package/src/browser/monaco-contrib/typeHierarchy/typeHierarchy.service.ts +5 -2
- package/src/browser/notebook.service.ts +19 -0
- package/src/browser/tab.view.tsx +5 -0
- package/src/browser/untitled-resource.ts +5 -7
- package/src/browser/workbench-editor.service.ts +13 -21
- package/src/common/editor.ts +59 -1
- package/src/common/index.ts +4 -3
- package/src/common/language.ts +1 -0
- package/src/common/notebook.ts +196 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Event, IRange, UriComponents } from '@opensumi/ide-core-common';
|
|
3
|
+
export declare enum NotebookCellsChangeType {
|
|
4
|
+
ModelChange = 1,
|
|
5
|
+
Move = 2,
|
|
6
|
+
ChangeCellLanguage = 5,
|
|
7
|
+
Initialize = 6,
|
|
8
|
+
ChangeCellMetadata = 7,
|
|
9
|
+
Output = 8,
|
|
10
|
+
OutputItem = 9,
|
|
11
|
+
ChangeCellContent = 10,
|
|
12
|
+
ChangeDocumentMetadata = 11,
|
|
13
|
+
ChangeCellInternalMetadata = 12,
|
|
14
|
+
ChangeCellMime = 13,
|
|
15
|
+
Unknown = 100
|
|
16
|
+
}
|
|
17
|
+
export type NotebookCellTextModelSplice<T> = [start: number, deleteCount: number, newItems: T[]];
|
|
18
|
+
/**
|
|
19
|
+
* [start, end]
|
|
20
|
+
*/
|
|
21
|
+
export interface ICellRange {
|
|
22
|
+
/**
|
|
23
|
+
* zero based index
|
|
24
|
+
*/
|
|
25
|
+
start: number;
|
|
26
|
+
/**
|
|
27
|
+
* zero based index
|
|
28
|
+
*/
|
|
29
|
+
end: number;
|
|
30
|
+
}
|
|
31
|
+
export declare enum CellKind {
|
|
32
|
+
Markup = 1,
|
|
33
|
+
Code = 2
|
|
34
|
+
}
|
|
35
|
+
export interface NotebookCellMetadata {
|
|
36
|
+
/**
|
|
37
|
+
* custom metadata
|
|
38
|
+
*/
|
|
39
|
+
[key: string]: unknown;
|
|
40
|
+
}
|
|
41
|
+
export interface ICellExecutionError {
|
|
42
|
+
message: string;
|
|
43
|
+
stack: string | undefined;
|
|
44
|
+
uri: UriComponents;
|
|
45
|
+
location: IRange | undefined;
|
|
46
|
+
}
|
|
47
|
+
export type NotebookDocumentMetadata = Record<string, unknown>;
|
|
48
|
+
export interface NotebookCellInternalMetadata {
|
|
49
|
+
executionId?: string;
|
|
50
|
+
executionOrder?: number;
|
|
51
|
+
lastRunSuccess?: boolean;
|
|
52
|
+
runStartTime?: number;
|
|
53
|
+
runStartTimeAdjustment?: number;
|
|
54
|
+
runEndTime?: number;
|
|
55
|
+
renderDuration?: {
|
|
56
|
+
[key: string]: number;
|
|
57
|
+
};
|
|
58
|
+
error?: ICellExecutionError;
|
|
59
|
+
}
|
|
60
|
+
export interface NotebookOutputItemDto {
|
|
61
|
+
readonly mime: string;
|
|
62
|
+
readonly valueBytes: Buffer;
|
|
63
|
+
}
|
|
64
|
+
export interface NotebookOutputDto {
|
|
65
|
+
items: NotebookOutputItemDto[];
|
|
66
|
+
outputId: string;
|
|
67
|
+
metadata?: Record<string, any>;
|
|
68
|
+
}
|
|
69
|
+
export interface NotebookCellDto {
|
|
70
|
+
handle: number;
|
|
71
|
+
uri: UriComponents;
|
|
72
|
+
eol: string;
|
|
73
|
+
source: string[];
|
|
74
|
+
language: string;
|
|
75
|
+
mime?: string;
|
|
76
|
+
cellKind: CellKind;
|
|
77
|
+
outputs: NotebookOutputDto[];
|
|
78
|
+
metadata?: NotebookCellMetadata;
|
|
79
|
+
internalMetadata?: NotebookCellInternalMetadata;
|
|
80
|
+
}
|
|
81
|
+
export interface NotebookCellDataDto {
|
|
82
|
+
source: string;
|
|
83
|
+
language: string;
|
|
84
|
+
mime: string | undefined;
|
|
85
|
+
cellKind: CellKind;
|
|
86
|
+
outputs: NotebookOutputDto[];
|
|
87
|
+
metadata?: NotebookCellMetadata;
|
|
88
|
+
internalMetadata?: NotebookCellInternalMetadata;
|
|
89
|
+
}
|
|
90
|
+
export interface NotebookDataDto {
|
|
91
|
+
readonly cells: NotebookCellDataDto[];
|
|
92
|
+
readonly metadata: NotebookDocumentMetadata;
|
|
93
|
+
}
|
|
94
|
+
export interface NotebookCellsChangeLanguageEvent {
|
|
95
|
+
readonly kind: NotebookCellsChangeType.ChangeCellLanguage;
|
|
96
|
+
readonly index: number;
|
|
97
|
+
readonly language: string;
|
|
98
|
+
}
|
|
99
|
+
export interface NotebookCellsChangeMimeEvent {
|
|
100
|
+
readonly kind: NotebookCellsChangeType.ChangeCellMime;
|
|
101
|
+
readonly index: number;
|
|
102
|
+
readonly mime: string | undefined;
|
|
103
|
+
}
|
|
104
|
+
export interface NotebookCellsChangeMetadataEvent {
|
|
105
|
+
readonly kind: NotebookCellsChangeType.ChangeCellMetadata;
|
|
106
|
+
readonly index: number;
|
|
107
|
+
readonly metadata: NotebookCellMetadata;
|
|
108
|
+
}
|
|
109
|
+
export interface NotebookCellsChangeInternalMetadataEvent {
|
|
110
|
+
readonly kind: NotebookCellsChangeType.ChangeCellInternalMetadata;
|
|
111
|
+
readonly index: number;
|
|
112
|
+
readonly internalMetadata: NotebookCellInternalMetadata;
|
|
113
|
+
}
|
|
114
|
+
export interface NotebookCellContentChangeEvent {
|
|
115
|
+
readonly kind: NotebookCellsChangeType.ChangeCellContent;
|
|
116
|
+
readonly index: number;
|
|
117
|
+
}
|
|
118
|
+
export type NotebookRawContentEventDto = {
|
|
119
|
+
readonly kind: NotebookCellsChangeType.ModelChange;
|
|
120
|
+
readonly changes: NotebookCellTextModelSplice<NotebookCellDto>[];
|
|
121
|
+
} | {
|
|
122
|
+
readonly kind: NotebookCellsChangeType.Move;
|
|
123
|
+
readonly index: number;
|
|
124
|
+
readonly length: number;
|
|
125
|
+
readonly newIdx: number;
|
|
126
|
+
} | {
|
|
127
|
+
readonly kind: NotebookCellsChangeType.Output;
|
|
128
|
+
readonly index: number;
|
|
129
|
+
readonly outputs: NotebookOutputDto[];
|
|
130
|
+
} | {
|
|
131
|
+
readonly kind: NotebookCellsChangeType.OutputItem;
|
|
132
|
+
readonly index: number;
|
|
133
|
+
readonly outputId: string;
|
|
134
|
+
readonly outputItems: NotebookOutputItemDto[];
|
|
135
|
+
readonly append: boolean;
|
|
136
|
+
} | NotebookCellsChangeLanguageEvent | NotebookCellsChangeMimeEvent | NotebookCellsChangeMetadataEvent | NotebookCellsChangeInternalMetadataEvent | NotebookCellContentChangeEvent;
|
|
137
|
+
export interface NotebookCellsChangedEventDto {
|
|
138
|
+
readonly rawEvents: NotebookRawContentEventDto[];
|
|
139
|
+
readonly versionId: number;
|
|
140
|
+
}
|
|
141
|
+
export interface INotebookModelAddedData {
|
|
142
|
+
uri: UriComponents;
|
|
143
|
+
versionId: number;
|
|
144
|
+
cells: NotebookCellDto[];
|
|
145
|
+
viewType: string;
|
|
146
|
+
metadata?: NotebookDocumentMetadata;
|
|
147
|
+
}
|
|
148
|
+
export interface NotebookDocumentChangeDto {
|
|
149
|
+
uri: UriComponents;
|
|
150
|
+
event: NotebookCellsChangedEventDto;
|
|
151
|
+
isDirty: boolean;
|
|
152
|
+
metadata?: NotebookDocumentMetadata;
|
|
153
|
+
}
|
|
154
|
+
export declare const INotebookService: unique symbol;
|
|
155
|
+
export interface INotebookService {
|
|
156
|
+
createNotebook: (data?: NotebookDataDto) => Promise<{
|
|
157
|
+
uri: UriComponents;
|
|
158
|
+
}>;
|
|
159
|
+
openNotebook: (uriComponents: UriComponents) => Promise<{
|
|
160
|
+
uri: UriComponents;
|
|
161
|
+
}>;
|
|
162
|
+
saveNotebook: (uriComponents: UriComponents) => Promise<boolean>;
|
|
163
|
+
onDidOpenNotebookDocument: Event<INotebookModelAddedData>;
|
|
164
|
+
onDidCloseNotebookDocument: Event<UriComponents>;
|
|
165
|
+
onDidSaveNotebookDocument: Event<UriComponents>;
|
|
166
|
+
onDidChangeNotebookDocument: Event<NotebookDocumentChangeDto>;
|
|
167
|
+
}
|
|
168
|
+
export declare const notebookCellScheme = "vscode-notebook-cell";
|
|
169
|
+
//# sourceMappingURL=notebook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notebook.d.ts","sourceRoot":"","sources":["../../src/common/notebook.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAEzE,oBAAY,uBAAuB;IACjC,WAAW,IAAI;IACf,IAAI,IAAI;IACR,kBAAkB,IAAI;IACtB,UAAU,IAAI;IACd,kBAAkB,IAAI;IACtB,MAAM,IAAI;IACV,UAAU,IAAI;IACd,iBAAiB,KAAK;IACtB,sBAAsB,KAAK;IAC3B,0BAA0B,KAAK;IAC/B,cAAc,KAAK;IACnB,OAAO,MAAM;CACd;AAED,MAAM,MAAM,2BAA2B,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;AAEjG;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;AAED,oBAAY,QAAQ;IAClB,MAAM,IAAI;IACV,IAAI,IAAI;CACT;AAED,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB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AwB,CAAC;CACrC;AAED,MAAM,WAAW,yBAAyB;IACxC,GAAG,EAAE,aAAa,CAAC;IACnB,KAAK,EAAE,4BAA4B,CAAC;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,wBAAwB,CAAC;CACrC;AAED,eAAO,MAAM,gBAAgB,eAA6B,CAAC;AAE3D,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,CAAC,IAAI,CAAC,EAAE,eAAe,KAAK,OAAO,CAAC;QAAE,GAAG,EAAE,aAAa,CAAA;KAAE,CAAC,CAAC;IAC5E,YAAY,EAAE,CAAC,aAAa,EAAE,aAAa,KAAK,OAAO,CAAC;QAAE,GAAG,EAAE,aAAa,CAAA;KAAE,CAAC,CAAC;IAChF,YAAY,EAAE,CAAC,aAAa,EAAE,aAAa,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAEjE,yBAAyB,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC1D,0BAA0B,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IACjD,yBAAyB,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAChD,2BAA2B,EAAE,KAAK,CAAC,yBAAyB,CAAC,CAAC;CAC/D;AAED,eAAO,MAAM,kBAAkB,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.notebookCellScheme = exports.INotebookService = exports.CellKind = exports.NotebookCellsChangeType = void 0;
|
|
4
|
+
var NotebookCellsChangeType;
|
|
5
|
+
(function (NotebookCellsChangeType) {
|
|
6
|
+
NotebookCellsChangeType[NotebookCellsChangeType["ModelChange"] = 1] = "ModelChange";
|
|
7
|
+
NotebookCellsChangeType[NotebookCellsChangeType["Move"] = 2] = "Move";
|
|
8
|
+
NotebookCellsChangeType[NotebookCellsChangeType["ChangeCellLanguage"] = 5] = "ChangeCellLanguage";
|
|
9
|
+
NotebookCellsChangeType[NotebookCellsChangeType["Initialize"] = 6] = "Initialize";
|
|
10
|
+
NotebookCellsChangeType[NotebookCellsChangeType["ChangeCellMetadata"] = 7] = "ChangeCellMetadata";
|
|
11
|
+
NotebookCellsChangeType[NotebookCellsChangeType["Output"] = 8] = "Output";
|
|
12
|
+
NotebookCellsChangeType[NotebookCellsChangeType["OutputItem"] = 9] = "OutputItem";
|
|
13
|
+
NotebookCellsChangeType[NotebookCellsChangeType["ChangeCellContent"] = 10] = "ChangeCellContent";
|
|
14
|
+
NotebookCellsChangeType[NotebookCellsChangeType["ChangeDocumentMetadata"] = 11] = "ChangeDocumentMetadata";
|
|
15
|
+
NotebookCellsChangeType[NotebookCellsChangeType["ChangeCellInternalMetadata"] = 12] = "ChangeCellInternalMetadata";
|
|
16
|
+
NotebookCellsChangeType[NotebookCellsChangeType["ChangeCellMime"] = 13] = "ChangeCellMime";
|
|
17
|
+
NotebookCellsChangeType[NotebookCellsChangeType["Unknown"] = 100] = "Unknown";
|
|
18
|
+
})(NotebookCellsChangeType = exports.NotebookCellsChangeType || (exports.NotebookCellsChangeType = {}));
|
|
19
|
+
var CellKind;
|
|
20
|
+
(function (CellKind) {
|
|
21
|
+
CellKind[CellKind["Markup"] = 1] = "Markup";
|
|
22
|
+
CellKind[CellKind["Code"] = 2] = "Code";
|
|
23
|
+
})(CellKind = exports.CellKind || (exports.CellKind = {}));
|
|
24
|
+
exports.INotebookService = Symbol('INotebookService');
|
|
25
|
+
exports.notebookCellScheme = 'vscode-notebook-cell';
|
|
26
|
+
//# sourceMappingURL=notebook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notebook.js","sourceRoot":"","sources":["../../src/common/notebook.ts"],"names":[],"mappings":";;;AAEA,IAAY,uBAaX;AAbD,WAAY,uBAAuB;IACjC,mFAAe,CAAA;IACf,qEAAQ,CAAA;IACR,iGAAsB,CAAA;IACtB,iFAAc,CAAA;IACd,iGAAsB,CAAA;IACtB,yEAAU,CAAA;IACV,iFAAc,CAAA;IACd,gGAAsB,CAAA;IACtB,0GAA2B,CAAA;IAC3B,kHAA+B,CAAA;IAC/B,0FAAmB,CAAA;IACnB,6EAAa,CAAA;AACf,CAAC,EAbW,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAalC;AAmBD,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,2CAAU,CAAA;IACV,uCAAQ,CAAA;AACV,CAAC,EAHW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAGnB;AAiJY,QAAA,gBAAgB,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAa9C,QAAA,kBAAkB,GAAG,sBAAsB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensumi/ide-editor",
|
|
3
|
-
"version": "3.2.5-next-
|
|
3
|
+
"version": "3.2.5-next-1725356044.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"lib",
|
|
6
6
|
"src"
|
|
@@ -17,21 +17,21 @@
|
|
|
17
17
|
"url": "git@github.com:opensumi/core.git"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@opensumi/ide-core-common": "3.2.5-next-
|
|
21
|
-
"@opensumi/ide-core-node": "3.2.5-next-
|
|
22
|
-
"@opensumi/ide-file-service": "3.2.5-next-
|
|
23
|
-
"@opensumi/ide-monaco": "3.2.5-next-
|
|
24
|
-
"@opensumi/ide-utils": "3.2.5-next-
|
|
20
|
+
"@opensumi/ide-core-common": "3.2.5-next-1725356044.0",
|
|
21
|
+
"@opensumi/ide-core-node": "3.2.5-next-1725356044.0",
|
|
22
|
+
"@opensumi/ide-file-service": "3.2.5-next-1725356044.0",
|
|
23
|
+
"@opensumi/ide-monaco": "3.2.5-next-1725356044.0",
|
|
24
|
+
"@opensumi/ide-utils": "3.2.5-next-1725356044.0",
|
|
25
25
|
"vscode-oniguruma": "1.5.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@opensumi/ide-components": "3.2.5-next-
|
|
29
|
-
"@opensumi/ide-core-browser": "3.2.5-next-
|
|
30
|
-
"@opensumi/ide-dev-tool": "3.2.5-next-
|
|
31
|
-
"@opensumi/ide-overlay": "3.2.5-next-
|
|
32
|
-
"@opensumi/ide-quick-open": "3.2.5-next-
|
|
33
|
-
"@opensumi/ide-theme": "3.2.5-next-
|
|
34
|
-
"@opensumi/ide-workspace": "3.2.5-next-
|
|
28
|
+
"@opensumi/ide-components": "3.2.5-next-1725356044.0",
|
|
29
|
+
"@opensumi/ide-core-browser": "3.2.5-next-1725356044.0",
|
|
30
|
+
"@opensumi/ide-dev-tool": "3.2.5-next-1725356044.0",
|
|
31
|
+
"@opensumi/ide-overlay": "3.2.5-next-1725356044.0",
|
|
32
|
+
"@opensumi/ide-quick-open": "3.2.5-next-1725356044.0",
|
|
33
|
+
"@opensumi/ide-theme": "3.2.5-next-1725356044.0",
|
|
34
|
+
"@opensumi/ide-workspace": "3.2.5-next-1725356044.0"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "ceab3bb3c71dbd9e55cd18833b1747490715de31"
|
|
37
37
|
}
|
|
@@ -23,7 +23,7 @@ import { IHashCalculateService } from '@opensumi/ide-core-common/lib/hash-calcul
|
|
|
23
23
|
import { IFileServiceClient } from '@opensumi/ide-file-service';
|
|
24
24
|
import { EOL } from '@opensumi/ide-monaco/lib/browser/monaco-api/types';
|
|
25
25
|
|
|
26
|
-
import { IEditorDocumentModel } from '../../common/editor';
|
|
26
|
+
import { IEditorDocumentDescription, IEditorDocumentModel } from '../../common/editor';
|
|
27
27
|
|
|
28
28
|
import { EditorDocumentModel } from './editor-document-model';
|
|
29
29
|
import {
|
|
@@ -230,6 +230,30 @@ export class EditorDocumentModelServiceImpl extends WithEventBus implements IEdi
|
|
|
230
230
|
return this._modelReferenceManager.getReferenceIfHasInstance(uri.toString(), reason);
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
+
getModelDescription(uri: URI, reason?: string): IEditorDocumentDescription | null {
|
|
234
|
+
const ref = this.getModelReference(uri, reason);
|
|
235
|
+
if (!ref) {
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const instance = ref.instance;
|
|
240
|
+
const resullt = {
|
|
241
|
+
alwaysDirty: instance.alwaysDirty,
|
|
242
|
+
closeAutoSave: instance.closeAutoSave,
|
|
243
|
+
disposeEvenDirty: instance.disposeEvenDirty,
|
|
244
|
+
eol: instance.eol,
|
|
245
|
+
encoding: instance.encoding,
|
|
246
|
+
dirty: instance.dirty,
|
|
247
|
+
languageId: instance.languageId,
|
|
248
|
+
readonly: instance.readonly,
|
|
249
|
+
uri: instance.uri,
|
|
250
|
+
id: instance.id,
|
|
251
|
+
savable: instance.savable,
|
|
252
|
+
};
|
|
253
|
+
ref.dispose();
|
|
254
|
+
return resullt;
|
|
255
|
+
}
|
|
256
|
+
|
|
233
257
|
getAllModels(): IEditorDocumentModel[] {
|
|
234
258
|
return Array.from(this.editorDocModels.values());
|
|
235
259
|
}
|
|
@@ -360,7 +360,25 @@ export class EditorDocumentModel extends Disposable implements IEditorDocumentMo
|
|
|
360
360
|
return this.monacoModel;
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
+
async syncDocumentModelToExtThread() {
|
|
364
|
+
await this.eventBus.fireAndAwait(
|
|
365
|
+
new EditorDocumentModelOptionChangedEvent({
|
|
366
|
+
uri: this.uri,
|
|
367
|
+
languageId: this.languageId,
|
|
368
|
+
encoding: this.encoding,
|
|
369
|
+
eol: this.eol,
|
|
370
|
+
dirty: this.dirty,
|
|
371
|
+
}),
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
|
|
363
375
|
async save(force = false, reason: SaveReason = SaveReason.Manual): Promise<boolean> {
|
|
376
|
+
if (!this.dirty) {
|
|
377
|
+
// 如果文档内容没有变化,则只同步新状态到插件进程
|
|
378
|
+
await this.syncDocumentModelToExtThread();
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
|
|
364
382
|
const provider = await this.contentRegistry.getProvider(this.uri);
|
|
365
383
|
const isReadonly = await provider?.isReadonly(this.uri);
|
|
366
384
|
|
|
@@ -12,7 +12,7 @@ import * as monaco from '@opensumi/ide-monaco';
|
|
|
12
12
|
import { EOL, EndOfLineSequence } from '@opensumi/ide-monaco/lib/browser/monaco-api/types';
|
|
13
13
|
|
|
14
14
|
import { IEditorDocumentModelContentChange, SaveReason } from '../../common';
|
|
15
|
-
import { IEditorDocumentModel, IEditorDocumentModelRef } from '../../common/editor';
|
|
15
|
+
import { IEditorDocumentDescription, IEditorDocumentModel, IEditorDocumentModelRef } from '../../common/editor';
|
|
16
16
|
|
|
17
17
|
export interface IDocModelUpdateOptions extends monaco.editor.ITextModelUpdateOptions {
|
|
18
18
|
detectIndentation?: boolean;
|
|
@@ -130,6 +130,7 @@ export interface IEditorDocumentModelService {
|
|
|
130
130
|
* 当文档从来没有被打开过时,返回null
|
|
131
131
|
*/
|
|
132
132
|
getModelReference(uri: URI, reason?: string): IEditorDocumentModelRef | null;
|
|
133
|
+
getModelDescription(uri: URI, reason?: string): IEditorDocumentDescription | null;
|
|
133
134
|
|
|
134
135
|
/**
|
|
135
136
|
* 获得全部model
|
|
@@ -193,6 +194,7 @@ export interface IEditorDocumentModelOptionChangedEventPayload {
|
|
|
193
194
|
encoding?: string;
|
|
194
195
|
languageId?: string;
|
|
195
196
|
eol?: EOL;
|
|
197
|
+
dirty?: boolean;
|
|
196
198
|
}
|
|
197
199
|
|
|
198
200
|
export class EditorDocumentModelCreationEvent extends BasicEvent<IEditorDocumentModelCreationEventPayload> {}
|
|
@@ -808,7 +808,12 @@ export class EditorContribution
|
|
|
808
808
|
return;
|
|
809
809
|
}
|
|
810
810
|
|
|
811
|
-
|
|
811
|
+
const ref = this.editorDocumentModelService.getModelDescription(uri);
|
|
812
|
+
if (!ref) {
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
return ref.encoding;
|
|
812
817
|
},
|
|
813
818
|
});
|
|
814
819
|
|
|
@@ -832,8 +837,8 @@ export class EditorContribution
|
|
|
832
837
|
|
|
833
838
|
const provider = await this.contentRegistry.getProvider(uri);
|
|
834
839
|
const guessedEncoding = await provider?.guessEncoding?.(uri);
|
|
835
|
-
const ref = this.editorDocumentModelService.
|
|
836
|
-
const currentEncoding = documentModel?.encoding ?? ref?.
|
|
840
|
+
const ref = this.editorDocumentModelService.getModelDescription(uri);
|
|
841
|
+
const currentEncoding = documentModel?.encoding ?? ref?.encoding;
|
|
837
842
|
|
|
838
843
|
let matchIndex: number | undefined;
|
|
839
844
|
const encodingItems: QuickPickItem<string>[] = Object.keys(SUPPORTED_ENCODINGS)
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
position: absolute;
|
|
49
49
|
width: 100%;
|
|
50
50
|
height: 100%;
|
|
51
|
+
pointer-events: none;
|
|
51
52
|
}
|
|
52
53
|
.kt_editor_tabs {
|
|
53
54
|
display: flex;
|
|
@@ -132,12 +133,6 @@
|
|
|
132
133
|
}
|
|
133
134
|
}
|
|
134
135
|
|
|
135
|
-
.kt_editor_tabs_scroll_wrapper {
|
|
136
|
-
flex-grow: 1;
|
|
137
|
-
width: 100%;
|
|
138
|
-
position: relative;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
136
|
.kt_editor_tabs_scroll {
|
|
142
137
|
overflow-y: hidden;
|
|
143
138
|
:global(.loading_indicator) {
|
|
@@ -184,7 +179,7 @@
|
|
|
184
179
|
}
|
|
185
180
|
.kt_editor_tabs_content {
|
|
186
181
|
overflow-y: hidden;
|
|
187
|
-
display:
|
|
182
|
+
display: flex;
|
|
188
183
|
position: relative;
|
|
189
184
|
height: 100%;
|
|
190
185
|
&.kt_on_drag_over {
|
|
@@ -197,8 +192,6 @@
|
|
|
197
192
|
display: flex;
|
|
198
193
|
position: relative;
|
|
199
194
|
align-items: center;
|
|
200
|
-
flex-shrink: 1;
|
|
201
|
-
flex-grow: 1;
|
|
202
195
|
padding: 0 12px;
|
|
203
196
|
border-right: 1px solid var(--tab-border);
|
|
204
197
|
height: 100%;
|
|
@@ -209,7 +202,6 @@
|
|
|
209
202
|
color: var(--tab-inactiveForeground);
|
|
210
203
|
background: var(--tab-inactiveBackground);
|
|
211
204
|
border-top: 1px solid transparent;
|
|
212
|
-
box-sizing: border-box;
|
|
213
205
|
z-index: 1;
|
|
214
206
|
word-break: keep-all;
|
|
215
207
|
white-space: nowrap;
|
|
@@ -348,7 +340,7 @@
|
|
|
348
340
|
}
|
|
349
341
|
|
|
350
342
|
.editorGroupHeader {
|
|
351
|
-
z-index: var(--stacking-level-
|
|
343
|
+
z-index: var(--stacking-level-workbench, 1);
|
|
352
344
|
position: relative;
|
|
353
345
|
}
|
|
354
346
|
|
|
@@ -47,12 +47,11 @@ export class FormattingSelector implements IFormattingSelector {
|
|
|
47
47
|
mode: FormattingMode,
|
|
48
48
|
_kind: FormattingKind,
|
|
49
49
|
): Promise<T | undefined> {
|
|
50
|
-
const
|
|
51
|
-
if (!
|
|
50
|
+
const docDesc = this.modelService.getModelDescription(URI.from(document.uri.toJSON()));
|
|
51
|
+
if (!docDesc) {
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
const languageId =
|
|
55
|
-
docRef.dispose();
|
|
54
|
+
const languageId = docDesc.languageId;
|
|
56
55
|
const preferred = this.getPreferedFormatter(languageId);
|
|
57
56
|
|
|
58
57
|
const elements: { [key: string]: T } = {};
|
|
@@ -120,12 +119,11 @@ export class FormattingSelector implements IFormattingSelector {
|
|
|
120
119
|
formatters: T[],
|
|
121
120
|
document: ITextModel,
|
|
122
121
|
): Promise<T | undefined> {
|
|
123
|
-
const
|
|
124
|
-
if (!
|
|
122
|
+
const docDesc = this.modelService.getModelDescription(URI.from(document.uri.toJSON()));
|
|
123
|
+
if (!docDesc) {
|
|
125
124
|
return;
|
|
126
125
|
}
|
|
127
|
-
const languageId =
|
|
128
|
-
docRef.dispose();
|
|
126
|
+
const languageId = docDesc.languageId;
|
|
129
127
|
|
|
130
128
|
const elements: { [key: string]: T } = {};
|
|
131
129
|
formatters.forEach((provider: T) => {
|
|
@@ -181,8 +181,8 @@ export class FileSystemResourceProvider extends WithEventBus implements IResourc
|
|
|
181
181
|
this.cachedFileStat.delete(resource.uri.toString());
|
|
182
182
|
}
|
|
183
183
|
async shouldCloseResourceWithoutConfirm(resource: IResource) {
|
|
184
|
-
const documentModelRef = this.documentModelService.
|
|
185
|
-
if (documentModelRef && documentModelRef.
|
|
184
|
+
const documentModelRef = this.documentModelService.getModelDescription(resource.uri, 'close-resource-check');
|
|
185
|
+
if (documentModelRef && documentModelRef.dirty) {
|
|
186
186
|
return true;
|
|
187
187
|
}
|
|
188
188
|
return false;
|
|
@@ -204,6 +204,7 @@ export class FileSystemResourceProvider extends WithEventBus implements IResourc
|
|
|
204
204
|
documentModelRef.dispose();
|
|
205
205
|
return false;
|
|
206
206
|
} else {
|
|
207
|
+
documentModelRef.dispose();
|
|
207
208
|
return true;
|
|
208
209
|
}
|
|
209
210
|
}
|
|
@@ -222,11 +223,8 @@ export class FileSystemResourceProvider extends WithEventBus implements IResourc
|
|
|
222
223
|
}
|
|
223
224
|
}
|
|
224
225
|
}
|
|
225
|
-
const documentModelRef = this.documentModelService.
|
|
226
|
-
if (!documentModelRef || !documentModelRef.
|
|
227
|
-
if (documentModelRef) {
|
|
228
|
-
documentModelRef.dispose();
|
|
229
|
-
}
|
|
226
|
+
const documentModelRef = this.documentModelService.getModelDescription(resource.uri, 'close-resource-check');
|
|
227
|
+
if (!documentModelRef || !documentModelRef.dirty) {
|
|
230
228
|
return true;
|
|
231
229
|
}
|
|
232
230
|
|
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
|
|
3
|
-
import { URI, useInjectable } from '@opensumi/ide-core-browser';
|
|
3
|
+
import { DisposableStore, URI, useInjectable } from '@opensumi/ide-core-browser';
|
|
4
4
|
|
|
5
5
|
import { IEditorDocumentModelService } from '../doc-model/types';
|
|
6
|
-
import {
|
|
6
|
+
import { IEditorDocumentModel } from '../types';
|
|
7
7
|
|
|
8
|
-
export function
|
|
8
|
+
export function useEditorDocumentModel(uri: URI) {
|
|
9
9
|
const documentService: IEditorDocumentModelService = useInjectable(IEditorDocumentModelService);
|
|
10
|
-
const [
|
|
10
|
+
const [instance, setInstance] = useState<IEditorDocumentModel | null>(null);
|
|
11
11
|
|
|
12
12
|
useEffect(() => {
|
|
13
|
+
const toDispose = new DisposableStore();
|
|
13
14
|
const run = () => {
|
|
14
15
|
const ref = documentService.getModelReference(uri);
|
|
15
16
|
if (ref) {
|
|
16
|
-
|
|
17
|
+
setInstance(ref.instance);
|
|
18
|
+
ref.dispose();
|
|
17
19
|
}
|
|
18
20
|
};
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
toDispose.add(
|
|
23
|
+
documentService.onDocumentModelCreated(uri.toString(), () => {
|
|
24
|
+
run();
|
|
25
|
+
}),
|
|
26
|
+
);
|
|
23
27
|
|
|
24
28
|
run();
|
|
25
29
|
return () => {
|
|
26
30
|
toDispose.dispose();
|
|
27
|
-
if (ref) {
|
|
28
|
-
ref.dispose();
|
|
29
|
-
}
|
|
30
31
|
};
|
|
31
32
|
}, [uri]);
|
|
32
33
|
|
|
33
|
-
return
|
|
34
|
+
return instance;
|
|
34
35
|
}
|
package/src/browser/index.ts
CHANGED
|
@@ -52,6 +52,7 @@ import {
|
|
|
52
52
|
MonacoCommandService,
|
|
53
53
|
} from './monaco-contrib/command/command.service';
|
|
54
54
|
import { TextmateService } from './monaco-contrib/tokenizer/textmate.service';
|
|
55
|
+
import { NotebookService } from './notebook.service';
|
|
55
56
|
import { EditorPreferenceContribution } from './preference/contribution';
|
|
56
57
|
import { EditorPreferences, editorPreferenceSchema } from './preference/schema';
|
|
57
58
|
import { ResourceServiceImpl } from './resource.service';
|
|
@@ -65,6 +66,7 @@ import {
|
|
|
65
66
|
IEditorFeatureRegistry,
|
|
66
67
|
IEditorTabService,
|
|
67
68
|
ILanguageStatusService,
|
|
69
|
+
INotebookService,
|
|
68
70
|
} from './types';
|
|
69
71
|
import { WorkbenchEditorServiceImpl } from './workbench-editor.service';
|
|
70
72
|
export * from './doc-cache';
|
|
@@ -169,6 +171,10 @@ export class EditorModule extends BrowserModule {
|
|
|
169
171
|
token: IEditorTabService,
|
|
170
172
|
useClass: EditorTabService,
|
|
171
173
|
},
|
|
174
|
+
{
|
|
175
|
+
token: INotebookService,
|
|
176
|
+
useClass: NotebookService,
|
|
177
|
+
},
|
|
172
178
|
EditorPreferenceContribution,
|
|
173
179
|
DefaultDiffEditorContribution,
|
|
174
180
|
MergeEditorContribution,
|
|
@@ -4,12 +4,12 @@ import { useEffect, useMemo, useState } from 'react';
|
|
|
4
4
|
import { formatLocalize, useInjectable } from '@opensumi/ide-core-browser';
|
|
5
5
|
import { DisposableStore, URI } from '@opensumi/ide-utils';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { useEditorDocumentModel } from '../hooks/useEditor';
|
|
8
8
|
|
|
9
9
|
import { MergeConflictService } from './merge-conflict.service';
|
|
10
10
|
|
|
11
11
|
export function useMergeConflictModel(uri: URI) {
|
|
12
|
-
const editorModel =
|
|
12
|
+
const editorModel = useEditorDocumentModel(uri);
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* 如果是原来就有冲突的文件,当冲突没了之后,仍然显示冲突
|
|
@@ -28,9 +28,8 @@ export function useMergeConflictModel(uri: URI) {
|
|
|
28
28
|
const disposables = new DisposableStore();
|
|
29
29
|
|
|
30
30
|
if (editorModel) {
|
|
31
|
-
const { instance } = editorModel;
|
|
32
31
|
const run = () => {
|
|
33
|
-
const n = mergeConflictService.scanDocument(
|
|
32
|
+
const n = mergeConflictService.scanDocument(editorModel.getMonacoModel());
|
|
34
33
|
setConflictsCount(n);
|
|
35
34
|
if (n > 0) {
|
|
36
35
|
setIsInitialVisiable(true);
|
|
@@ -40,7 +39,7 @@ export function useMergeConflictModel(uri: URI) {
|
|
|
40
39
|
const debounceRun = debounce(run, 150);
|
|
41
40
|
|
|
42
41
|
disposables.add(
|
|
43
|
-
|
|
42
|
+
editorModel.getMonacoModel().onDidChangeContent(() => {
|
|
44
43
|
debounceRun();
|
|
45
44
|
}),
|
|
46
45
|
);
|
|
@@ -112,8 +112,10 @@ export class CallHierarchyService implements ICallHierarchyService {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
async prepareCallHierarchyProvider(resource: Uri, position: Position) {
|
|
115
|
-
let
|
|
116
|
-
let
|
|
115
|
+
let textModelReference = this.modelService.getModelReference(URI.parse(resource.toString()));
|
|
116
|
+
let textModel: ITextModel | undefined = textModelReference?.instance.getMonacoModel();
|
|
117
|
+
textModelReference?.dispose();
|
|
118
|
+
|
|
117
119
|
if (!textModel) {
|
|
118
120
|
const result = await this.modelService.createModelReference(URI.parse(resource.toString()));
|
|
119
121
|
textModel = result.instance.getMonacoModel();
|
|
@@ -104,8 +104,11 @@ export class TypeHierarchyService implements ITypeHierarchyService {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
async prepareTypeHierarchyProvider(resource: Uri, position: Position) {
|
|
107
|
-
let
|
|
108
|
-
|
|
107
|
+
let textModelReference = this.modelService.getModelReference(URI.parse(resource.toString()));
|
|
108
|
+
|
|
109
|
+
let textModel: ITextModel | undefined = textModelReference?.instance.getMonacoModel();
|
|
110
|
+
textModelReference?.dispose();
|
|
111
|
+
|
|
109
112
|
if (!textModel) {
|
|
110
113
|
const result = await this.modelService.createModelReference(URI.parse(resource.toString()));
|
|
111
114
|
textModel = result.instance.getMonacoModel();
|