@codingame/monaco-vscode-extensions-service-override 4.0.0 → 4.1.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/extensions.js +6 -6
- package/package.json +9 -9
- package/_virtual/semver.js +0 -3
- package/external/vscode-semver/semver.js +0 -985
- package/override/vs/workbench/browser/parts/editor/textEditor.weak.js +0 -8
- package/vscode/src/vs/base/common/console.js +0 -62
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagementCLI.js +0 -497
- package/vscode/src/vs/platform/extensionResourceLoader/browser/extensionResourceLoaderService.js +0 -44
- package/vscode/src/vs/platform/lifecycle/common/lifecycle.js +0 -27
- package/vscode/src/vs/platform/remote/common/managedSocket.js +0 -98
- package/vscode/src/vs/workbench/api/browser/extensionHost.contribution.js +0 -104
- package/vscode/src/vs/workbench/api/browser/mainThreadAiEmbeddingVector.js +0 -31
- package/vscode/src/vs/workbench/api/browser/mainThreadAiRelatedInformation.js +0 -35
- package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.js +0 -254
- package/vscode/src/vs/workbench/api/browser/mainThreadBulkEdits.js +0 -68
- package/vscode/src/vs/workbench/api/browser/mainThreadCLICommands.js +0 -103
- package/vscode/src/vs/workbench/api/browser/mainThreadChat.js +0 -70
- package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +0 -207
- package/vscode/src/vs/workbench/api/browser/mainThreadChatVariables.js +0 -41
- package/vscode/src/vs/workbench/api/browser/mainThreadClipboard.js +0 -24
- package/vscode/src/vs/workbench/api/browser/mainThreadCodeInsets.js +0 -108
- package/vscode/src/vs/workbench/api/browser/mainThreadCommands.js +0 -98
- package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +0 -560
- package/vscode/src/vs/workbench/api/browser/mainThreadConfiguration.js +0 -80
- package/vscode/src/vs/workbench/api/browser/mainThreadConsole.js +0 -35
- package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +0 -579
- package/vscode/src/vs/workbench/api/browser/mainThreadDebugService.js +0 -435
- package/vscode/src/vs/workbench/api/browser/mainThreadDecorations.js +0 -102
- package/vscode/src/vs/workbench/api/browser/mainThreadDiagnostics.js +0 -69
- package/vscode/src/vs/workbench/api/browser/mainThreadDialogs.js +0 -68
- package/vscode/src/vs/workbench/api/browser/mainThreadDocumentContentProviders.js +0 -79
- package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.js +0 -253
- package/vscode/src/vs/workbench/api/browser/mainThreadDocumentsAndEditors.js +0 -370
- package/vscode/src/vs/workbench/api/browser/mainThreadDownloadService.js +0 -22
- package/vscode/src/vs/workbench/api/browser/mainThreadEditSessionIdentityParticipant.js +0 -41
- package/vscode/src/vs/workbench/api/browser/mainThreadEditor.js +0 -414
- package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +0 -501
- package/vscode/src/vs/workbench/api/browser/mainThreadEditors.js +0 -227
- package/vscode/src/vs/workbench/api/browser/mainThreadErrors.js +0 -24
- package/vscode/src/vs/workbench/api/browser/mainThreadExtensionService.js +0 -317
- package/vscode/src/vs/workbench/api/browser/mainThreadFileSystem.js +0 -208
- package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +0 -369
- package/vscode/src/vs/workbench/api/browser/mainThreadInlineChat.js +0 -72
- package/vscode/src/vs/workbench/api/browser/mainThreadInteractive.js +0 -28
- package/vscode/src/vs/workbench/api/browser/mainThreadIssueReporter.js +0 -50
- package/vscode/src/vs/workbench/api/browser/mainThreadLabelService.js +0 -27
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +0 -1016
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModels.js +0 -185
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguages.js +0 -78
- package/vscode/src/vs/workbench/api/browser/mainThreadLocalization.js +0 -35
- package/vscode/src/vs/workbench/api/browser/mainThreadLogService.js +0 -78
- package/vscode/src/vs/workbench/api/browser/mainThreadManagedSockets.js +0 -93
- package/vscode/src/vs/workbench/api/browser/mainThreadMessageService.js +0 -137
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.js +0 -194
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.js +0 -123
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.js +0 -188
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDto.js +0 -129
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.js +0 -131
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +0 -374
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookRenderers.js +0 -25
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +0 -48
- package/vscode/src/vs/workbench/api/browser/mainThreadOutputService.js +0 -76
- package/vscode/src/vs/workbench/api/browser/mainThreadProfileContentHandlers.js +0 -38
- package/vscode/src/vs/workbench/api/browser/mainThreadProgress.js +0 -68
- package/vscode/src/vs/workbench/api/browser/mainThreadQuickDiff.js +0 -42
- package/vscode/src/vs/workbench/api/browser/mainThreadQuickOpen.js +0 -185
- package/vscode/src/vs/workbench/api/browser/mainThreadRemoteConnectionData.js +0 -30
- package/vscode/src/vs/workbench/api/browser/mainThreadSCM.js +0 -493
- package/vscode/src/vs/workbench/api/browser/mainThreadSaveParticipant.js +0 -49
- package/vscode/src/vs/workbench/api/browser/mainThreadSearch.js +0 -168
- package/vscode/src/vs/workbench/api/browser/mainThreadSecretState.js +0 -70
- package/vscode/src/vs/workbench/api/browser/mainThreadShare.js +0 -50
- package/vscode/src/vs/workbench/api/browser/mainThreadSpeech.js +0 -99
- package/vscode/src/vs/workbench/api/browser/mainThreadStatusBar.js +0 -53
- package/vscode/src/vs/workbench/api/browser/mainThreadStorage.js +0 -72
- package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +0 -731
- package/vscode/src/vs/workbench/api/browser/mainThreadTelemetry.js +0 -53
- package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +0 -409
- package/vscode/src/vs/workbench/api/browser/mainThreadTerminalShellIntegration.js +0 -51
- package/vscode/src/vs/workbench/api/browser/mainThreadTesting.js +0 -219
- package/vscode/src/vs/workbench/api/browser/mainThreadTheming.js +0 -24
- package/vscode/src/vs/workbench/api/browser/mainThreadTimeline.js +0 -55
- package/vscode/src/vs/workbench/api/browser/mainThreadTreeViews.js +0 -312
- package/vscode/src/vs/workbench/api/browser/mainThreadTunnelService.js +0 -223
- package/vscode/src/vs/workbench/api/browser/mainThreadUriOpeners.js +0 -110
- package/vscode/src/vs/workbench/api/browser/mainThreadUrls.js +0 -61
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviewManager.js +0 -29
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviewPanels.js +0 -283
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviewViews.js +0 -100
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviews.js +0 -135
- package/vscode/src/vs/workbench/api/browser/mainThreadWindow.js +0 -57
- package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.js +0 -268
- package/vscode/src/vs/workbench/api/common/shared/dataTransferCache.js +0 -35
- package/vscode/src/vs/workbench/contrib/customEditor/common/customTextEditorModel.js +0 -76
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/contributedOpeners.js +0 -83
- package/vscode/src/vs/workbench/services/extensions/browser/extensionService.js +0 -285
- package/vscode/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.js +0 -276
- package/vscode/src/vs/workbench/services/extensions/browser/webWorkerFileSystemProvider.js +0 -52
- package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +0 -1149
- package/vscode/src/vs/workbench/services/extensions/common/extHostCustomers.js +0 -41
- package/vscode/src/vs/workbench/services/extensions/common/extensionDevOptions.js +0 -25
- package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +0 -512
- package/vscode/src/vs/workbench/services/extensions/common/extensionRunningLocationTracker.js +0 -274
- package/vscode/src/vs/workbench/services/extensions/common/extensionStorageMigration.js +0 -58
- package/vscode/src/vs/workbench/services/extensions/common/extensionsProposedApi.js +0 -80
- package/vscode/src/vs/workbench/services/extensions/common/extensionsUtil.js +0 -64
- package/vscode/src/vs/workbench/services/extensions/common/lazyCreateExtensionHostManager.js +0 -161
- package/vscode/src/vs/workbench/services/extensions/common/remoteConsoleUtil.js +0 -49
- package/vscode/src/vs/workbench/services/extensions/common/remoteExtensionHost.js +0 -222
|
@@ -1,414 +0,0 @@
|
|
|
1
|
-
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
2
|
-
import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
|
-
import { cursorStyleToString, TextEditorCursorStyle } from 'vscode/vscode/vs/editor/common/config/editorOptions';
|
|
4
|
-
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
5
|
-
import { Selection } from 'vscode/vscode/vs/editor/common/core/selection';
|
|
6
|
-
import { SnippetController2 } from 'vscode/vscode/vs/editor/contrib/snippet/browser/snippetController2';
|
|
7
|
-
import { TextEditorRevealType } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
|
|
8
|
-
import { equals } from 'vscode/vscode/vs/base/common/arrays';
|
|
9
|
-
import { EditorState } from 'vscode/vscode/vs/editor/contrib/editorState/browser/editorState';
|
|
10
|
-
import { SnippetParser } from 'vscode/vscode/vs/editor/contrib/snippet/browser/snippetParser';
|
|
11
|
-
|
|
12
|
-
class MainThreadTextEditorProperties {
|
|
13
|
-
static readFromEditor(previousProperties, model, codeEditor) {
|
|
14
|
-
const selections = MainThreadTextEditorProperties._readSelectionsFromCodeEditor(previousProperties, codeEditor);
|
|
15
|
-
const options = MainThreadTextEditorProperties._readOptionsFromCodeEditor(previousProperties, model, codeEditor);
|
|
16
|
-
const visibleRanges = MainThreadTextEditorProperties._readVisibleRangesFromCodeEditor(previousProperties, codeEditor);
|
|
17
|
-
return ( new MainThreadTextEditorProperties(selections, options, visibleRanges));
|
|
18
|
-
}
|
|
19
|
-
static _readSelectionsFromCodeEditor(previousProperties, codeEditor) {
|
|
20
|
-
let result = null;
|
|
21
|
-
if (codeEditor) {
|
|
22
|
-
result = codeEditor.getSelections();
|
|
23
|
-
}
|
|
24
|
-
if (!result && previousProperties) {
|
|
25
|
-
result = previousProperties.selections;
|
|
26
|
-
}
|
|
27
|
-
if (!result) {
|
|
28
|
-
result = [( new Selection(1, 1, 1, 1))];
|
|
29
|
-
}
|
|
30
|
-
return result;
|
|
31
|
-
}
|
|
32
|
-
static _readOptionsFromCodeEditor(previousProperties, model, codeEditor) {
|
|
33
|
-
if (model.isDisposed()) {
|
|
34
|
-
if (previousProperties) {
|
|
35
|
-
return previousProperties.options;
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
throw new Error('No valid properties');
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
let cursorStyle;
|
|
42
|
-
let lineNumbers;
|
|
43
|
-
if (codeEditor) {
|
|
44
|
-
const options = codeEditor.getOptions();
|
|
45
|
-
const lineNumbersOpts = options.get(68 );
|
|
46
|
-
cursorStyle = options.get(28 );
|
|
47
|
-
lineNumbers = lineNumbersOpts.renderType;
|
|
48
|
-
}
|
|
49
|
-
else if (previousProperties) {
|
|
50
|
-
cursorStyle = previousProperties.options.cursorStyle;
|
|
51
|
-
lineNumbers = previousProperties.options.lineNumbers;
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
cursorStyle = TextEditorCursorStyle.Line;
|
|
55
|
-
lineNumbers = 1 ;
|
|
56
|
-
}
|
|
57
|
-
const modelOptions = model.getOptions();
|
|
58
|
-
return {
|
|
59
|
-
insertSpaces: modelOptions.insertSpaces,
|
|
60
|
-
tabSize: modelOptions.tabSize,
|
|
61
|
-
indentSize: modelOptions.indentSize,
|
|
62
|
-
originalIndentSize: modelOptions.originalIndentSize,
|
|
63
|
-
cursorStyle: cursorStyle,
|
|
64
|
-
lineNumbers: lineNumbers
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
static _readVisibleRangesFromCodeEditor(previousProperties, codeEditor) {
|
|
68
|
-
if (codeEditor) {
|
|
69
|
-
return codeEditor.getVisibleRanges();
|
|
70
|
-
}
|
|
71
|
-
return [];
|
|
72
|
-
}
|
|
73
|
-
constructor(selections, options, visibleRanges) {
|
|
74
|
-
this.selections = selections;
|
|
75
|
-
this.options = options;
|
|
76
|
-
this.visibleRanges = visibleRanges;
|
|
77
|
-
}
|
|
78
|
-
generateDelta(oldProps, selectionChangeSource) {
|
|
79
|
-
const delta = {
|
|
80
|
-
options: null,
|
|
81
|
-
selections: null,
|
|
82
|
-
visibleRanges: null
|
|
83
|
-
};
|
|
84
|
-
if (!oldProps || !MainThreadTextEditorProperties._selectionsEqual(oldProps.selections, this.selections)) {
|
|
85
|
-
delta.selections = {
|
|
86
|
-
selections: this.selections,
|
|
87
|
-
source: selectionChangeSource ?? undefined,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
if (!oldProps || !MainThreadTextEditorProperties._optionsEqual(oldProps.options, this.options)) {
|
|
91
|
-
delta.options = this.options;
|
|
92
|
-
}
|
|
93
|
-
if (!oldProps || !MainThreadTextEditorProperties._rangesEqual(oldProps.visibleRanges, this.visibleRanges)) {
|
|
94
|
-
delta.visibleRanges = this.visibleRanges;
|
|
95
|
-
}
|
|
96
|
-
if (delta.selections || delta.options || delta.visibleRanges) {
|
|
97
|
-
return delta;
|
|
98
|
-
}
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
static _selectionsEqual(a, b) {
|
|
102
|
-
return equals(a, b, (aValue, bValue) => aValue.equalsSelection(bValue));
|
|
103
|
-
}
|
|
104
|
-
static _rangesEqual(a, b) {
|
|
105
|
-
return equals(a, b, (aValue, bValue) => aValue.equalsRange(bValue));
|
|
106
|
-
}
|
|
107
|
-
static _optionsEqual(a, b) {
|
|
108
|
-
if (a && !b || !a && b) {
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
if (!a && !b) {
|
|
112
|
-
return true;
|
|
113
|
-
}
|
|
114
|
-
return (a.tabSize === b.tabSize
|
|
115
|
-
&& a.indentSize === b.indentSize
|
|
116
|
-
&& a.insertSpaces === b.insertSpaces
|
|
117
|
-
&& a.cursorStyle === b.cursorStyle
|
|
118
|
-
&& a.lineNumbers === b.lineNumbers);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
class MainThreadTextEditor {
|
|
122
|
-
constructor(id, model, codeEditor, focusTracker, mainThreadDocuments, modelService, clipboardService) {
|
|
123
|
-
this._modelListeners = ( new DisposableStore());
|
|
124
|
-
this._codeEditorListeners = ( new DisposableStore());
|
|
125
|
-
this._id = id;
|
|
126
|
-
this._model = model;
|
|
127
|
-
this._codeEditor = null;
|
|
128
|
-
this._properties = null;
|
|
129
|
-
this._focusTracker = focusTracker;
|
|
130
|
-
this._mainThreadDocuments = mainThreadDocuments;
|
|
131
|
-
this._modelService = modelService;
|
|
132
|
-
this._clipboardService = clipboardService;
|
|
133
|
-
this._onPropertiesChanged = ( new Emitter());
|
|
134
|
-
this._modelListeners.add(this._model.onDidChangeOptions((e) => {
|
|
135
|
-
this._updatePropertiesNow(null);
|
|
136
|
-
}));
|
|
137
|
-
this.setCodeEditor(codeEditor);
|
|
138
|
-
this._updatePropertiesNow(null);
|
|
139
|
-
}
|
|
140
|
-
dispose() {
|
|
141
|
-
this._modelListeners.dispose();
|
|
142
|
-
this._codeEditor = null;
|
|
143
|
-
this._codeEditorListeners.dispose();
|
|
144
|
-
}
|
|
145
|
-
_updatePropertiesNow(selectionChangeSource) {
|
|
146
|
-
this._setProperties(MainThreadTextEditorProperties.readFromEditor(this._properties, this._model, this._codeEditor), selectionChangeSource);
|
|
147
|
-
}
|
|
148
|
-
_setProperties(newProperties, selectionChangeSource) {
|
|
149
|
-
const delta = newProperties.generateDelta(this._properties, selectionChangeSource);
|
|
150
|
-
this._properties = newProperties;
|
|
151
|
-
if (delta) {
|
|
152
|
-
this._onPropertiesChanged.fire(delta);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
getId() {
|
|
156
|
-
return this._id;
|
|
157
|
-
}
|
|
158
|
-
getModel() {
|
|
159
|
-
return this._model;
|
|
160
|
-
}
|
|
161
|
-
getCodeEditor() {
|
|
162
|
-
return this._codeEditor;
|
|
163
|
-
}
|
|
164
|
-
hasCodeEditor(codeEditor) {
|
|
165
|
-
return (this._codeEditor === codeEditor);
|
|
166
|
-
}
|
|
167
|
-
setCodeEditor(codeEditor) {
|
|
168
|
-
if (this.hasCodeEditor(codeEditor)) {
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
this._codeEditorListeners.clear();
|
|
172
|
-
this._codeEditor = codeEditor;
|
|
173
|
-
if (this._codeEditor) {
|
|
174
|
-
this._codeEditorListeners.add(this._codeEditor.onDidChangeModel(() => {
|
|
175
|
-
this.setCodeEditor(null);
|
|
176
|
-
}));
|
|
177
|
-
this._codeEditorListeners.add(this._codeEditor.onDidFocusEditorWidget(() => {
|
|
178
|
-
this._focusTracker.onGainedFocus();
|
|
179
|
-
}));
|
|
180
|
-
this._codeEditorListeners.add(this._codeEditor.onDidBlurEditorWidget(() => {
|
|
181
|
-
this._focusTracker.onLostFocus();
|
|
182
|
-
}));
|
|
183
|
-
let nextSelectionChangeSource = null;
|
|
184
|
-
this._codeEditorListeners.add(this._mainThreadDocuments.onIsCaughtUpWithContentChanges((uri) => {
|
|
185
|
-
if (( uri.toString()) === ( this._model.uri.toString())) {
|
|
186
|
-
const selectionChangeSource = nextSelectionChangeSource;
|
|
187
|
-
nextSelectionChangeSource = null;
|
|
188
|
-
this._updatePropertiesNow(selectionChangeSource);
|
|
189
|
-
}
|
|
190
|
-
}));
|
|
191
|
-
const isValidCodeEditor = () => {
|
|
192
|
-
return (this._codeEditor && this._codeEditor.getModel() === this._model);
|
|
193
|
-
};
|
|
194
|
-
const updateProperties = (selectionChangeSource) => {
|
|
195
|
-
if (this._mainThreadDocuments.isCaughtUpWithContentChanges(this._model.uri)) {
|
|
196
|
-
nextSelectionChangeSource = null;
|
|
197
|
-
this._updatePropertiesNow(selectionChangeSource);
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
nextSelectionChangeSource = selectionChangeSource;
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
this._codeEditorListeners.add(this._codeEditor.onDidChangeCursorSelection((e) => {
|
|
204
|
-
if (!isValidCodeEditor()) {
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
updateProperties(e.source);
|
|
208
|
-
}));
|
|
209
|
-
this._codeEditorListeners.add(this._codeEditor.onDidChangeConfiguration((e) => {
|
|
210
|
-
if (!isValidCodeEditor()) {
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
updateProperties(null);
|
|
214
|
-
}));
|
|
215
|
-
this._codeEditorListeners.add(this._codeEditor.onDidLayoutChange(() => {
|
|
216
|
-
if (!isValidCodeEditor()) {
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
updateProperties(null);
|
|
220
|
-
}));
|
|
221
|
-
this._codeEditorListeners.add(this._codeEditor.onDidScrollChange(() => {
|
|
222
|
-
if (!isValidCodeEditor()) {
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
updateProperties(null);
|
|
226
|
-
}));
|
|
227
|
-
this._updatePropertiesNow(null);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
isVisible() {
|
|
231
|
-
return !!this._codeEditor;
|
|
232
|
-
}
|
|
233
|
-
getProperties() {
|
|
234
|
-
return this._properties;
|
|
235
|
-
}
|
|
236
|
-
get onPropertiesChanged() {
|
|
237
|
-
return this._onPropertiesChanged.event;
|
|
238
|
-
}
|
|
239
|
-
setSelections(selections) {
|
|
240
|
-
if (this._codeEditor) {
|
|
241
|
-
this._codeEditor.setSelections(selections);
|
|
242
|
-
return;
|
|
243
|
-
}
|
|
244
|
-
const newSelections = ( selections.map(Selection.liftSelection));
|
|
245
|
-
this._setProperties(( new MainThreadTextEditorProperties(newSelections, this._properties.options, this._properties.visibleRanges)), null);
|
|
246
|
-
}
|
|
247
|
-
_setIndentConfiguration(newConfiguration) {
|
|
248
|
-
const creationOpts = this._modelService.getCreationOptions(this._model.getLanguageId(), this._model.uri, this._model.isForSimpleWidget);
|
|
249
|
-
if (newConfiguration.tabSize === 'auto' || newConfiguration.insertSpaces === 'auto') {
|
|
250
|
-
let insertSpaces = creationOpts.insertSpaces;
|
|
251
|
-
let tabSize = creationOpts.tabSize;
|
|
252
|
-
if (newConfiguration.insertSpaces !== 'auto' && typeof newConfiguration.insertSpaces !== 'undefined') {
|
|
253
|
-
insertSpaces = newConfiguration.insertSpaces;
|
|
254
|
-
}
|
|
255
|
-
if (newConfiguration.tabSize !== 'auto' && typeof newConfiguration.tabSize !== 'undefined') {
|
|
256
|
-
tabSize = newConfiguration.tabSize;
|
|
257
|
-
}
|
|
258
|
-
this._model.detectIndentation(insertSpaces, tabSize);
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
261
|
-
const newOpts = {};
|
|
262
|
-
if (typeof newConfiguration.insertSpaces !== 'undefined') {
|
|
263
|
-
newOpts.insertSpaces = newConfiguration.insertSpaces;
|
|
264
|
-
}
|
|
265
|
-
if (typeof newConfiguration.tabSize !== 'undefined') {
|
|
266
|
-
newOpts.tabSize = newConfiguration.tabSize;
|
|
267
|
-
}
|
|
268
|
-
if (typeof newConfiguration.indentSize !== 'undefined') {
|
|
269
|
-
newOpts.indentSize = newConfiguration.indentSize;
|
|
270
|
-
}
|
|
271
|
-
this._model.updateOptions(newOpts);
|
|
272
|
-
}
|
|
273
|
-
setConfiguration(newConfiguration) {
|
|
274
|
-
this._setIndentConfiguration(newConfiguration);
|
|
275
|
-
if (!this._codeEditor) {
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
if (newConfiguration.cursorStyle) {
|
|
279
|
-
const newCursorStyle = cursorStyleToString(newConfiguration.cursorStyle);
|
|
280
|
-
this._codeEditor.updateOptions({
|
|
281
|
-
cursorStyle: newCursorStyle
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
if (typeof newConfiguration.lineNumbers !== 'undefined') {
|
|
285
|
-
let lineNumbers;
|
|
286
|
-
switch (newConfiguration.lineNumbers) {
|
|
287
|
-
case 1 :
|
|
288
|
-
lineNumbers = 'on';
|
|
289
|
-
break;
|
|
290
|
-
case 2 :
|
|
291
|
-
lineNumbers = 'relative';
|
|
292
|
-
break;
|
|
293
|
-
case 3 :
|
|
294
|
-
lineNumbers = 'interval';
|
|
295
|
-
break;
|
|
296
|
-
default:
|
|
297
|
-
lineNumbers = 'off';
|
|
298
|
-
}
|
|
299
|
-
this._codeEditor.updateOptions({
|
|
300
|
-
lineNumbers: lineNumbers
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
setDecorations(key, ranges) {
|
|
305
|
-
if (!this._codeEditor) {
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
this._codeEditor.setDecorationsByType('exthost-api', key, ranges);
|
|
309
|
-
}
|
|
310
|
-
setDecorationsFast(key, _ranges) {
|
|
311
|
-
if (!this._codeEditor) {
|
|
312
|
-
return;
|
|
313
|
-
}
|
|
314
|
-
const ranges = [];
|
|
315
|
-
for (let i = 0, len = Math.floor(_ranges.length / 4); i < len; i++) {
|
|
316
|
-
ranges[i] = ( new Range(_ranges[4 * i], _ranges[4 * i + 1], _ranges[4 * i + 2], _ranges[4 * i + 3]));
|
|
317
|
-
}
|
|
318
|
-
this._codeEditor.setDecorationsByTypeFast(key, ranges);
|
|
319
|
-
}
|
|
320
|
-
revealRange(range, revealType) {
|
|
321
|
-
if (!this._codeEditor) {
|
|
322
|
-
return;
|
|
323
|
-
}
|
|
324
|
-
switch (revealType) {
|
|
325
|
-
case TextEditorRevealType.Default:
|
|
326
|
-
this._codeEditor.revealRange(range, 0 );
|
|
327
|
-
break;
|
|
328
|
-
case TextEditorRevealType.InCenter:
|
|
329
|
-
this._codeEditor.revealRangeInCenter(range, 0 );
|
|
330
|
-
break;
|
|
331
|
-
case TextEditorRevealType.InCenterIfOutsideViewport:
|
|
332
|
-
this._codeEditor.revealRangeInCenterIfOutsideViewport(range, 0 );
|
|
333
|
-
break;
|
|
334
|
-
case TextEditorRevealType.AtTop:
|
|
335
|
-
this._codeEditor.revealRangeAtTop(range, 0 );
|
|
336
|
-
break;
|
|
337
|
-
default:
|
|
338
|
-
console.warn(`Unknown revealType: ${revealType}`);
|
|
339
|
-
break;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
isFocused() {
|
|
343
|
-
if (this._codeEditor) {
|
|
344
|
-
return this._codeEditor.hasTextFocus();
|
|
345
|
-
}
|
|
346
|
-
return false;
|
|
347
|
-
}
|
|
348
|
-
matches(editor) {
|
|
349
|
-
if (!editor) {
|
|
350
|
-
return false;
|
|
351
|
-
}
|
|
352
|
-
return editor.getControl() === this._codeEditor;
|
|
353
|
-
}
|
|
354
|
-
applyEdits(versionIdCheck, edits, opts) {
|
|
355
|
-
if (this._model.getVersionId() !== versionIdCheck) {
|
|
356
|
-
return false;
|
|
357
|
-
}
|
|
358
|
-
if (!this._codeEditor) {
|
|
359
|
-
return false;
|
|
360
|
-
}
|
|
361
|
-
if (typeof opts.setEndOfLine !== 'undefined') {
|
|
362
|
-
this._model.pushEOL(opts.setEndOfLine);
|
|
363
|
-
}
|
|
364
|
-
const transformedEdits = ( edits.map((edit) => {
|
|
365
|
-
return {
|
|
366
|
-
range: Range.lift(edit.range),
|
|
367
|
-
text: edit.text,
|
|
368
|
-
forceMoveMarkers: edit.forceMoveMarkers
|
|
369
|
-
};
|
|
370
|
-
}));
|
|
371
|
-
if (opts.undoStopBefore) {
|
|
372
|
-
this._codeEditor.pushUndoStop();
|
|
373
|
-
}
|
|
374
|
-
this._codeEditor.executeEdits('MainThreadTextEditor', transformedEdits);
|
|
375
|
-
if (opts.undoStopAfter) {
|
|
376
|
-
this._codeEditor.pushUndoStop();
|
|
377
|
-
}
|
|
378
|
-
return true;
|
|
379
|
-
}
|
|
380
|
-
async insertSnippet(modelVersionId, template, ranges, opts) {
|
|
381
|
-
if (!this._codeEditor || !this._codeEditor.hasModel()) {
|
|
382
|
-
return false;
|
|
383
|
-
}
|
|
384
|
-
let clipboardText;
|
|
385
|
-
const needsTemplate = SnippetParser.guessNeedsClipboard(template);
|
|
386
|
-
if (needsTemplate) {
|
|
387
|
-
const state = ( new EditorState(
|
|
388
|
-
this._codeEditor,
|
|
389
|
-
1 | 4
|
|
390
|
-
));
|
|
391
|
-
clipboardText = await this._clipboardService.readText();
|
|
392
|
-
if (!state.validate(this._codeEditor)) {
|
|
393
|
-
return false;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
if (this._codeEditor.getModel().getVersionId() !== modelVersionId) {
|
|
397
|
-
return false;
|
|
398
|
-
}
|
|
399
|
-
const snippetController = SnippetController2.get(this._codeEditor);
|
|
400
|
-
if (!snippetController) {
|
|
401
|
-
return false;
|
|
402
|
-
}
|
|
403
|
-
this._codeEditor.focus();
|
|
404
|
-
const edits = ( ranges.map(range => ({ range: Range.lift(range), template })));
|
|
405
|
-
snippetController.apply(edits, {
|
|
406
|
-
overwriteBefore: 0, overwriteAfter: 0,
|
|
407
|
-
undoStopBefore: opts.undoStopBefore, undoStopAfter: opts.undoStopAfter,
|
|
408
|
-
clipboardText
|
|
409
|
-
});
|
|
410
|
-
return true;
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
export { MainThreadTextEditor, MainThreadTextEditorProperties };
|