@codingame/monaco-vscode-welcome-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/package.json +2 -2
- package/welcome.js +4 -4
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
- package/external/tslib/tslib.es6.js +0 -11
- package/external/vscode-marked/lib/marked.esm.js +0 -2200
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.js +0 -382
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.js +0 -1528
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedColors.js +0 -48
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedDetailsRenderer.js +0 -263
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedIcons.js +0 -16
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedInput.js +0 -53
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedList.js +0 -97
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/media/gettingStarted.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/startupPage.js +0 -218
- package/vscode/src/vs/workbench/contrib/welcomeViews/common/newFile.contribution.js +0 -238
- package/vscode/src/vs/workbench/contrib/welcomeViews/common/viewsWelcome.contribution.js +0 -19
- package/vscode/src/vs/workbench/contrib/welcomeViews/common/viewsWelcomeContribution.js +0 -75
- package/vscode/src/vs/workbench/contrib/welcomeViews/common/viewsWelcomeExtensionPoint.js +0 -99
- package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/browser/editor/editorWalkThrough.js +0 -63
- package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/browser/media/walkThroughPart.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/browser/walkThrough.contribution.js +0 -39
- package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/browser/walkThroughActions.js +0 -59
- package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/browser/walkThroughInput.js +0 -115
- package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/browser/walkThroughPart.js +0 -431
- package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/common/walkThroughContentProvider.js +0 -76
- package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/common/walkThroughUtils.js +0 -19
|
@@ -1,431 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import '../common/walkThroughUtils.js';
|
|
3
|
-
import './media/walkThroughPart.css.js';
|
|
4
|
-
import { DomScrollableElement } from 'vscode/vscode/vs/base/browser/ui/scrollbar/scrollableElement';
|
|
5
|
-
import { Gesture, EventType } from 'vscode/vscode/vs/base/browser/touch';
|
|
6
|
-
import { escape } from 'vscode/vscode/vs/base/common/strings';
|
|
7
|
-
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
8
|
-
import { DisposableStore, toDisposable, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
9
|
-
import { EditorPane } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorPane';
|
|
10
|
-
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
|
|
11
|
-
import { WalkThroughInput } from './walkThroughInput.js';
|
|
12
|
-
import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
|
|
13
|
-
import { ITextResourceConfigurationService } from 'vscode/vscode/vs/editor/common/services/textResourceConfiguration';
|
|
14
|
-
import { CodeEditorWidget } from 'vscode/vscode/vs/editor/browser/widget/codeEditor/codeEditorWidget';
|
|
15
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
16
|
-
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
|
|
17
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
18
|
-
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
19
|
-
import { RawContextKey, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
20
|
-
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
21
|
-
import { isObject } from 'vscode/vscode/vs/base/common/types';
|
|
22
|
-
import { CommandsRegistry } from 'vscode/vscode/vs/platform/commands/common/commands';
|
|
23
|
-
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
|
|
24
|
-
import { UILabelProvider } from 'vscode/vscode/vs/base/common/keybindingLabels';
|
|
25
|
-
import { OS } from 'vscode/vscode/vs/base/common/platform';
|
|
26
|
-
import { deepClone } from 'vscode/vscode/vs/base/common/objects';
|
|
27
|
-
import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification';
|
|
28
|
-
import { size, safeInnerHtml, addDisposableListener } from 'vscode/vscode/vs/base/browser/dom';
|
|
29
|
-
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
30
|
-
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
|
|
31
|
-
|
|
32
|
-
var WalkThroughPart_1;
|
|
33
|
-
const WALK_THROUGH_FOCUS = ( new RawContextKey('interactivePlaygroundFocus', false));
|
|
34
|
-
const UNBOUND_COMMAND = ( localizeWithPath(
|
|
35
|
-
'vs/workbench/contrib/welcomeWalkthrough/browser/walkThroughPart',
|
|
36
|
-
'walkThrough.unboundCommand',
|
|
37
|
-
"unbound"
|
|
38
|
-
));
|
|
39
|
-
const WALK_THROUGH_EDITOR_VIEW_STATE_PREFERENCE_KEY = 'walkThroughEditorViewState';
|
|
40
|
-
let WalkThroughPart = class WalkThroughPart extends EditorPane {
|
|
41
|
-
static { WalkThroughPart_1 = this; }
|
|
42
|
-
static { this.ID = 'workbench.editor.walkThroughPart'; }
|
|
43
|
-
constructor(group, telemetryService, themeService, textResourceConfigurationService, instantiationService, openerService, keybindingService, storageService, contextKeyService, configurationService, notificationService, extensionService, editorGroupService) {
|
|
44
|
-
super(WalkThroughPart_1.ID, group, telemetryService, themeService, storageService);
|
|
45
|
-
this.instantiationService = instantiationService;
|
|
46
|
-
this.openerService = openerService;
|
|
47
|
-
this.keybindingService = keybindingService;
|
|
48
|
-
this.contextKeyService = contextKeyService;
|
|
49
|
-
this.configurationService = configurationService;
|
|
50
|
-
this.notificationService = notificationService;
|
|
51
|
-
this.extensionService = extensionService;
|
|
52
|
-
this.disposables = ( new DisposableStore());
|
|
53
|
-
this.contentDisposables = [];
|
|
54
|
-
this.editorFocus = WALK_THROUGH_FOCUS.bindTo(this.contextKeyService);
|
|
55
|
-
this.editorMemento = this.getEditorMemento(editorGroupService, textResourceConfigurationService, WALK_THROUGH_EDITOR_VIEW_STATE_PREFERENCE_KEY);
|
|
56
|
-
}
|
|
57
|
-
createEditor(container) {
|
|
58
|
-
this.content = document.createElement('div');
|
|
59
|
-
this.content.classList.add('welcomePageFocusElement');
|
|
60
|
-
this.content.tabIndex = 0;
|
|
61
|
-
this.content.style.outlineStyle = 'none';
|
|
62
|
-
this.scrollbar = ( new DomScrollableElement(this.content, {
|
|
63
|
-
horizontal: 1 ,
|
|
64
|
-
vertical: 1
|
|
65
|
-
}));
|
|
66
|
-
this.disposables.add(this.scrollbar);
|
|
67
|
-
container.appendChild(this.scrollbar.getDomNode());
|
|
68
|
-
this.registerFocusHandlers();
|
|
69
|
-
this.registerClickHandler();
|
|
70
|
-
this.disposables.add(this.scrollbar.onScroll(e => this.updatedScrollPosition()));
|
|
71
|
-
}
|
|
72
|
-
updatedScrollPosition() {
|
|
73
|
-
const scrollDimensions = this.scrollbar.getScrollDimensions();
|
|
74
|
-
const scrollPosition = this.scrollbar.getScrollPosition();
|
|
75
|
-
const scrollHeight = scrollDimensions.scrollHeight;
|
|
76
|
-
if (scrollHeight && this.input instanceof WalkThroughInput) {
|
|
77
|
-
const scrollTop = scrollPosition.scrollTop;
|
|
78
|
-
const height = scrollDimensions.height;
|
|
79
|
-
this.input.relativeScrollPosition(scrollTop / scrollHeight, (scrollTop + height) / scrollHeight);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
onTouchChange(event) {
|
|
83
|
-
event.preventDefault();
|
|
84
|
-
event.stopPropagation();
|
|
85
|
-
const scrollPosition = this.scrollbar.getScrollPosition();
|
|
86
|
-
this.scrollbar.setScrollPosition({ scrollTop: scrollPosition.scrollTop - event.translationY });
|
|
87
|
-
}
|
|
88
|
-
addEventListener(element, type, listener, useCapture) {
|
|
89
|
-
element.addEventListener(type, listener, useCapture);
|
|
90
|
-
return toDisposable(() => { element.removeEventListener(type, listener, useCapture); });
|
|
91
|
-
}
|
|
92
|
-
registerFocusHandlers() {
|
|
93
|
-
this.disposables.add(this.addEventListener(this.content, 'mousedown', e => {
|
|
94
|
-
this.focus();
|
|
95
|
-
}));
|
|
96
|
-
this.disposables.add(this.addEventListener(this.content, 'focus', e => {
|
|
97
|
-
this.editorFocus.set(true);
|
|
98
|
-
}));
|
|
99
|
-
this.disposables.add(this.addEventListener(this.content, 'blur', e => {
|
|
100
|
-
this.editorFocus.reset();
|
|
101
|
-
}));
|
|
102
|
-
this.disposables.add(this.addEventListener(this.content, 'focusin', (e) => {
|
|
103
|
-
if (e.target instanceof HTMLElement && e.target.classList.contains('zone-widget-container')) {
|
|
104
|
-
const scrollPosition = this.scrollbar.getScrollPosition();
|
|
105
|
-
this.content.scrollTop = scrollPosition.scrollTop;
|
|
106
|
-
this.content.scrollLeft = scrollPosition.scrollLeft;
|
|
107
|
-
}
|
|
108
|
-
if (e.target instanceof HTMLElement) {
|
|
109
|
-
this.lastFocus = e.target;
|
|
110
|
-
}
|
|
111
|
-
}));
|
|
112
|
-
}
|
|
113
|
-
registerClickHandler() {
|
|
114
|
-
this.content.addEventListener('click', event => {
|
|
115
|
-
for (let node = event.target; node; node = node.parentNode) {
|
|
116
|
-
if (node instanceof HTMLAnchorElement && node.href) {
|
|
117
|
-
const baseElement = node.ownerDocument.getElementsByTagName('base')[0] || this.window.location;
|
|
118
|
-
if (baseElement && node.href.indexOf(baseElement.href) >= 0 && node.hash) {
|
|
119
|
-
const scrollTarget = this.content.querySelector(node.hash);
|
|
120
|
-
const innerContent = this.content.firstElementChild;
|
|
121
|
-
if (scrollTarget && innerContent) {
|
|
122
|
-
const targetTop = scrollTarget.getBoundingClientRect().top - 20;
|
|
123
|
-
const containerTop = innerContent.getBoundingClientRect().top;
|
|
124
|
-
this.scrollbar.setScrollPosition({ scrollTop: targetTop - containerTop });
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
this.open(( URI.parse(node.href)));
|
|
129
|
-
}
|
|
130
|
-
event.preventDefault();
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
else if (node instanceof HTMLButtonElement) {
|
|
134
|
-
const href = node.getAttribute('data-href');
|
|
135
|
-
if (href) {
|
|
136
|
-
this.open(( URI.parse(href)));
|
|
137
|
-
}
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
else if (node === event.currentTarget) {
|
|
141
|
-
break;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
open(uri) {
|
|
147
|
-
if (uri.scheme === 'command' && uri.path === 'git.clone' && !CommandsRegistry.getCommand('git.clone')) {
|
|
148
|
-
this.notificationService.info(( localizeWithPath(
|
|
149
|
-
'vs/workbench/contrib/welcomeWalkthrough/browser/walkThroughPart',
|
|
150
|
-
'walkThrough.gitNotFound',
|
|
151
|
-
"It looks like Git is not installed on your system."
|
|
152
|
-
)));
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
this.openerService.open(this.addFrom(uri), { allowCommands: true });
|
|
156
|
-
}
|
|
157
|
-
addFrom(uri) {
|
|
158
|
-
if (uri.scheme !== 'command' || !(this.input instanceof WalkThroughInput)) {
|
|
159
|
-
return uri;
|
|
160
|
-
}
|
|
161
|
-
const query = uri.query ? JSON.parse(uri.query) : {};
|
|
162
|
-
query.from = this.input.getTelemetryFrom();
|
|
163
|
-
return uri.with({ query: JSON.stringify(query) });
|
|
164
|
-
}
|
|
165
|
-
layout(dimension) {
|
|
166
|
-
this.size = dimension;
|
|
167
|
-
size(this.content, dimension.width, dimension.height);
|
|
168
|
-
this.updateSizeClasses();
|
|
169
|
-
this.contentDisposables.forEach(disposable => {
|
|
170
|
-
if (disposable instanceof CodeEditorWidget) {
|
|
171
|
-
disposable.layout();
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
const walkthroughInput = this.input instanceof WalkThroughInput && this.input;
|
|
175
|
-
if (walkthroughInput && walkthroughInput.layout) {
|
|
176
|
-
walkthroughInput.layout(dimension);
|
|
177
|
-
}
|
|
178
|
-
this.scrollbar.scanDomNode();
|
|
179
|
-
}
|
|
180
|
-
updateSizeClasses() {
|
|
181
|
-
const innerContent = this.content.firstElementChild;
|
|
182
|
-
if (this.size && innerContent) {
|
|
183
|
-
innerContent.classList.toggle('max-height-685px', this.size.height <= 685);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
focus() {
|
|
187
|
-
super.focus();
|
|
188
|
-
let active = this.content.ownerDocument.activeElement;
|
|
189
|
-
while (active && active !== this.content) {
|
|
190
|
-
active = active.parentElement;
|
|
191
|
-
}
|
|
192
|
-
if (!active) {
|
|
193
|
-
(this.lastFocus || this.content).focus();
|
|
194
|
-
}
|
|
195
|
-
this.editorFocus.set(true);
|
|
196
|
-
}
|
|
197
|
-
arrowUp() {
|
|
198
|
-
const scrollPosition = this.scrollbar.getScrollPosition();
|
|
199
|
-
this.scrollbar.setScrollPosition({ scrollTop: scrollPosition.scrollTop - this.getArrowScrollHeight() });
|
|
200
|
-
}
|
|
201
|
-
arrowDown() {
|
|
202
|
-
const scrollPosition = this.scrollbar.getScrollPosition();
|
|
203
|
-
this.scrollbar.setScrollPosition({ scrollTop: scrollPosition.scrollTop + this.getArrowScrollHeight() });
|
|
204
|
-
}
|
|
205
|
-
getArrowScrollHeight() {
|
|
206
|
-
let fontSize = this.configurationService.getValue('editor.fontSize');
|
|
207
|
-
if (typeof fontSize !== 'number' || fontSize < 1) {
|
|
208
|
-
fontSize = 12;
|
|
209
|
-
}
|
|
210
|
-
return 3 * fontSize;
|
|
211
|
-
}
|
|
212
|
-
pageUp() {
|
|
213
|
-
const scrollDimensions = this.scrollbar.getScrollDimensions();
|
|
214
|
-
const scrollPosition = this.scrollbar.getScrollPosition();
|
|
215
|
-
this.scrollbar.setScrollPosition({ scrollTop: scrollPosition.scrollTop - scrollDimensions.height });
|
|
216
|
-
}
|
|
217
|
-
pageDown() {
|
|
218
|
-
const scrollDimensions = this.scrollbar.getScrollDimensions();
|
|
219
|
-
const scrollPosition = this.scrollbar.getScrollPosition();
|
|
220
|
-
this.scrollbar.setScrollPosition({ scrollTop: scrollPosition.scrollTop + scrollDimensions.height });
|
|
221
|
-
}
|
|
222
|
-
setInput(input, options, context, token) {
|
|
223
|
-
const store = ( new DisposableStore());
|
|
224
|
-
this.contentDisposables.push(store);
|
|
225
|
-
this.content.innerText = '';
|
|
226
|
-
return super.setInput(input, options, context, token)
|
|
227
|
-
.then(async () => {
|
|
228
|
-
if (input.resource.path.endsWith('.md')) {
|
|
229
|
-
await this.extensionService.whenInstalledExtensionsRegistered();
|
|
230
|
-
}
|
|
231
|
-
return input.resolve();
|
|
232
|
-
})
|
|
233
|
-
.then(model => {
|
|
234
|
-
if (token.isCancellationRequested) {
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
const content = model.main;
|
|
238
|
-
if (!input.resource.path.endsWith('.md')) {
|
|
239
|
-
safeInnerHtml(this.content, content);
|
|
240
|
-
this.updateSizeClasses();
|
|
241
|
-
this.decorateContent();
|
|
242
|
-
this.contentDisposables.push(this.keybindingService.onDidUpdateKeybindings(() => this.decorateContent()));
|
|
243
|
-
input.onReady?.(this.content.firstElementChild, store);
|
|
244
|
-
this.scrollbar.scanDomNode();
|
|
245
|
-
this.loadTextEditorViewState(input);
|
|
246
|
-
this.updatedScrollPosition();
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
const innerContent = document.createElement('div');
|
|
250
|
-
innerContent.classList.add('walkThroughContent');
|
|
251
|
-
const markdown = this.expandMacros(content);
|
|
252
|
-
safeInnerHtml(innerContent, markdown);
|
|
253
|
-
this.content.appendChild(innerContent);
|
|
254
|
-
model.snippets.forEach((snippet, i) => {
|
|
255
|
-
const model = snippet.textEditorModel;
|
|
256
|
-
if (!model) {
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
const id = `snippet-${model.uri.fragment}`;
|
|
260
|
-
const div = innerContent.querySelector(`#${id.replace(/[\\.]/g, '\\$&')}`);
|
|
261
|
-
const options = this.getEditorOptions(model.getLanguageId());
|
|
262
|
-
const telemetryData = {
|
|
263
|
-
target: this.input instanceof WalkThroughInput ? this.input.getTelemetryFrom() : undefined,
|
|
264
|
-
snippet: i
|
|
265
|
-
};
|
|
266
|
-
const editor = this.instantiationService.createInstance(CodeEditorWidget, div, options, {
|
|
267
|
-
telemetryData: telemetryData
|
|
268
|
-
});
|
|
269
|
-
editor.setModel(model);
|
|
270
|
-
this.contentDisposables.push(editor);
|
|
271
|
-
const updateHeight = (initial) => {
|
|
272
|
-
const lineHeight = editor.getOption(67 );
|
|
273
|
-
const height = `${Math.max(model.getLineCount() + 1, 4) * lineHeight}px`;
|
|
274
|
-
if (div.style.height !== height) {
|
|
275
|
-
div.style.height = height;
|
|
276
|
-
editor.layout();
|
|
277
|
-
if (!initial) {
|
|
278
|
-
this.scrollbar.scanDomNode();
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
updateHeight(true);
|
|
283
|
-
this.contentDisposables.push(editor.onDidChangeModelContent(() => updateHeight(false)));
|
|
284
|
-
this.contentDisposables.push(editor.onDidChangeCursorPosition(e => {
|
|
285
|
-
const innerContent = this.content.firstElementChild;
|
|
286
|
-
if (innerContent) {
|
|
287
|
-
const targetTop = div.getBoundingClientRect().top;
|
|
288
|
-
const containerTop = innerContent.getBoundingClientRect().top;
|
|
289
|
-
const lineHeight = editor.getOption(67 );
|
|
290
|
-
const lineTop = (targetTop + (e.position.lineNumber - 1) * lineHeight) - containerTop;
|
|
291
|
-
const lineBottom = lineTop + lineHeight;
|
|
292
|
-
const scrollDimensions = this.scrollbar.getScrollDimensions();
|
|
293
|
-
const scrollPosition = this.scrollbar.getScrollPosition();
|
|
294
|
-
const scrollTop = scrollPosition.scrollTop;
|
|
295
|
-
const height = scrollDimensions.height;
|
|
296
|
-
if (scrollTop > lineTop) {
|
|
297
|
-
this.scrollbar.setScrollPosition({ scrollTop: lineTop });
|
|
298
|
-
}
|
|
299
|
-
else if (scrollTop < lineBottom - height) {
|
|
300
|
-
this.scrollbar.setScrollPosition({ scrollTop: lineBottom - height });
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
}));
|
|
304
|
-
this.contentDisposables.push(this.configurationService.onDidChangeConfiguration(e => {
|
|
305
|
-
if (e.affectsConfiguration('editor') && snippet.textEditorModel) {
|
|
306
|
-
editor.updateOptions(this.getEditorOptions(snippet.textEditorModel.getLanguageId()));
|
|
307
|
-
}
|
|
308
|
-
}));
|
|
309
|
-
});
|
|
310
|
-
this.updateSizeClasses();
|
|
311
|
-
this.multiCursorModifier();
|
|
312
|
-
this.contentDisposables.push(this.configurationService.onDidChangeConfiguration(e => {
|
|
313
|
-
if (e.affectsConfiguration('editor.multiCursorModifier')) {
|
|
314
|
-
this.multiCursorModifier();
|
|
315
|
-
}
|
|
316
|
-
}));
|
|
317
|
-
input.onReady?.(innerContent, store);
|
|
318
|
-
this.scrollbar.scanDomNode();
|
|
319
|
-
this.loadTextEditorViewState(input);
|
|
320
|
-
this.updatedScrollPosition();
|
|
321
|
-
this.contentDisposables.push(Gesture.addTarget(innerContent));
|
|
322
|
-
this.contentDisposables.push(addDisposableListener(innerContent, EventType.Change, e => this.onTouchChange(e)));
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
getEditorOptions(language) {
|
|
326
|
-
const config = deepClone(this.configurationService.getValue('editor', { overrideIdentifier: language }));
|
|
327
|
-
return {
|
|
328
|
-
...(isObject(config) ? config : Object.create(null)),
|
|
329
|
-
scrollBeyondLastLine: false,
|
|
330
|
-
scrollbar: {
|
|
331
|
-
verticalScrollbarSize: 14,
|
|
332
|
-
horizontal: 'auto',
|
|
333
|
-
useShadows: true,
|
|
334
|
-
verticalHasArrows: false,
|
|
335
|
-
horizontalHasArrows: false,
|
|
336
|
-
alwaysConsumeMouseWheel: false
|
|
337
|
-
},
|
|
338
|
-
overviewRulerLanes: 3,
|
|
339
|
-
fixedOverflowWidgets: false,
|
|
340
|
-
lineNumbersMinChars: 1,
|
|
341
|
-
minimap: { enabled: false },
|
|
342
|
-
};
|
|
343
|
-
}
|
|
344
|
-
expandMacros(input) {
|
|
345
|
-
return input.replace(/kb\(([a-z.\d\-]+)\)/gi, (match, kb) => {
|
|
346
|
-
const keybinding = this.keybindingService.lookupKeybinding(kb);
|
|
347
|
-
const shortcut = keybinding ? keybinding.getLabel() || '' : UNBOUND_COMMAND;
|
|
348
|
-
return `<span class="shortcut">${escape(shortcut)}</span>`;
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
decorateContent() {
|
|
352
|
-
const keys = this.content.querySelectorAll('.shortcut[data-command]');
|
|
353
|
-
Array.prototype.forEach.call(keys, (key) => {
|
|
354
|
-
const command = key.getAttribute('data-command');
|
|
355
|
-
const keybinding = command && this.keybindingService.lookupKeybinding(command);
|
|
356
|
-
const label = keybinding ? keybinding.getLabel() || '' : UNBOUND_COMMAND;
|
|
357
|
-
while (key.firstChild) {
|
|
358
|
-
key.removeChild(key.firstChild);
|
|
359
|
-
}
|
|
360
|
-
key.appendChild(document.createTextNode(label));
|
|
361
|
-
});
|
|
362
|
-
const ifkeys = this.content.querySelectorAll('.if_shortcut[data-command]');
|
|
363
|
-
Array.prototype.forEach.call(ifkeys, (key) => {
|
|
364
|
-
const command = key.getAttribute('data-command');
|
|
365
|
-
const keybinding = command && this.keybindingService.lookupKeybinding(command);
|
|
366
|
-
key.style.display = !keybinding ? 'none' : '';
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
multiCursorModifier() {
|
|
370
|
-
const labels = UILabelProvider.modifierLabels[OS];
|
|
371
|
-
const value = this.configurationService.getValue('editor.multiCursorModifier');
|
|
372
|
-
const modifier = labels[value === 'ctrlCmd' ? (OS === 2 ? 'metaKey' : 'ctrlKey') : 'altKey'];
|
|
373
|
-
const keys = this.content.querySelectorAll('.multi-cursor-modifier');
|
|
374
|
-
Array.prototype.forEach.call(keys, (key) => {
|
|
375
|
-
while (key.firstChild) {
|
|
376
|
-
key.removeChild(key.firstChild);
|
|
377
|
-
}
|
|
378
|
-
key.appendChild(document.createTextNode(modifier));
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
saveTextEditorViewState(input) {
|
|
382
|
-
const scrollPosition = this.scrollbar.getScrollPosition();
|
|
383
|
-
this.editorMemento.saveEditorState(this.group, input, {
|
|
384
|
-
viewState: {
|
|
385
|
-
scrollTop: scrollPosition.scrollTop,
|
|
386
|
-
scrollLeft: scrollPosition.scrollLeft
|
|
387
|
-
}
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
loadTextEditorViewState(input) {
|
|
391
|
-
const state = this.editorMemento.loadEditorState(this.group, input);
|
|
392
|
-
if (state) {
|
|
393
|
-
this.scrollbar.setScrollPosition(state.viewState);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
clearInput() {
|
|
397
|
-
if (this.input instanceof WalkThroughInput) {
|
|
398
|
-
this.saveTextEditorViewState(this.input);
|
|
399
|
-
}
|
|
400
|
-
this.contentDisposables = dispose(this.contentDisposables);
|
|
401
|
-
super.clearInput();
|
|
402
|
-
}
|
|
403
|
-
saveState() {
|
|
404
|
-
if (this.input instanceof WalkThroughInput) {
|
|
405
|
-
this.saveTextEditorViewState(this.input);
|
|
406
|
-
}
|
|
407
|
-
super.saveState();
|
|
408
|
-
}
|
|
409
|
-
dispose() {
|
|
410
|
-
this.editorFocus.reset();
|
|
411
|
-
this.contentDisposables = dispose(this.contentDisposables);
|
|
412
|
-
this.disposables.dispose();
|
|
413
|
-
super.dispose();
|
|
414
|
-
}
|
|
415
|
-
};
|
|
416
|
-
WalkThroughPart = WalkThroughPart_1 = ( __decorate([
|
|
417
|
-
( __param(1, ITelemetryService)),
|
|
418
|
-
( __param(2, IThemeService)),
|
|
419
|
-
( __param(3, ITextResourceConfigurationService)),
|
|
420
|
-
( __param(4, IInstantiationService)),
|
|
421
|
-
( __param(5, IOpenerService)),
|
|
422
|
-
( __param(6, IKeybindingService)),
|
|
423
|
-
( __param(7, IStorageService)),
|
|
424
|
-
( __param(8, IContextKeyService)),
|
|
425
|
-
( __param(9, IConfigurationService)),
|
|
426
|
-
( __param(10, INotificationService)),
|
|
427
|
-
( __param(11, IExtensionService)),
|
|
428
|
-
( __param(12, IEditorGroupsService))
|
|
429
|
-
], WalkThroughPart));
|
|
430
|
-
|
|
431
|
-
export { WALK_THROUGH_FOCUS, WalkThroughPart };
|
package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/common/walkThroughContentProvider.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
|
|
3
|
-
import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
|
|
4
|
-
import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
|
|
5
|
-
import marked_1 from '../../../../../../../external/vscode-marked/lib/marked.esm.js';
|
|
6
|
-
import { Schemas, FileAccess } from 'vscode/vscode/vs/base/common/network';
|
|
7
|
-
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
8
|
-
import { createTextBufferFactory } from 'vscode/vscode/vs/editor/common/model/textModel';
|
|
9
|
-
import { assertIsDefined } from 'vscode/vscode/vs/base/common/types';
|
|
10
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
11
|
-
|
|
12
|
-
async function requireToContent(instantiationService, resource) {
|
|
13
|
-
if (!resource.query) {
|
|
14
|
-
throw new Error('Welcome: invalid resource');
|
|
15
|
-
}
|
|
16
|
-
const query = JSON.parse(resource.query);
|
|
17
|
-
if (!query.moduleId) {
|
|
18
|
-
throw new Error('Welcome: invalid resource');
|
|
19
|
-
}
|
|
20
|
-
const content = await FileAccess.toModuleContent(query.moduleId);
|
|
21
|
-
return instantiationService.invokeFunction(content);
|
|
22
|
-
}
|
|
23
|
-
let WalkThroughSnippetContentProvider = class WalkThroughSnippetContentProvider {
|
|
24
|
-
static { this.ID = 'workbench.contrib.walkThroughSnippetContentProvider'; }
|
|
25
|
-
constructor(textModelResolverService, languageService, modelService, instantiationService) {
|
|
26
|
-
this.textModelResolverService = textModelResolverService;
|
|
27
|
-
this.languageService = languageService;
|
|
28
|
-
this.modelService = modelService;
|
|
29
|
-
this.instantiationService = instantiationService;
|
|
30
|
-
this.loads = ( new Map());
|
|
31
|
-
this.textModelResolverService.registerTextModelContentProvider(Schemas.walkThroughSnippet, this);
|
|
32
|
-
}
|
|
33
|
-
async textBufferFactoryFromResource(resource) {
|
|
34
|
-
let ongoing = this.loads.get(( resource.toString()));
|
|
35
|
-
if (!ongoing) {
|
|
36
|
-
ongoing = requireToContent(this.instantiationService, resource)
|
|
37
|
-
.then(content => createTextBufferFactory(content))
|
|
38
|
-
.finally(() => this.loads.delete(( resource.toString())));
|
|
39
|
-
this.loads.set(( resource.toString()), ongoing);
|
|
40
|
-
}
|
|
41
|
-
return ongoing;
|
|
42
|
-
}
|
|
43
|
-
async provideTextContent(resource) {
|
|
44
|
-
const factory = await this.textBufferFactoryFromResource(resource.with({ fragment: '' }));
|
|
45
|
-
let codeEditorModel = this.modelService.getModel(resource);
|
|
46
|
-
if (!codeEditorModel) {
|
|
47
|
-
const j = parseInt(resource.fragment);
|
|
48
|
-
let i = 0;
|
|
49
|
-
const renderer = new marked_1.Renderer();
|
|
50
|
-
renderer.code = (code, lang) => {
|
|
51
|
-
i++;
|
|
52
|
-
const languageId = typeof lang === 'string' ? this.languageService.getLanguageIdByLanguageName(lang) || '' : '';
|
|
53
|
-
const languageSelection = this.languageService.createById(languageId);
|
|
54
|
-
const model = this.modelService.createModel(code, languageSelection, resource.with({ fragment: `${i}.${lang}` }));
|
|
55
|
-
if (i === j) {
|
|
56
|
-
codeEditorModel = model;
|
|
57
|
-
}
|
|
58
|
-
return '';
|
|
59
|
-
};
|
|
60
|
-
const textBuffer = factory.create(1 ).textBuffer;
|
|
61
|
-
const lineCount = textBuffer.getLineCount();
|
|
62
|
-
const range = ( new Range(1, 1, lineCount, textBuffer.getLineLength(lineCount) + 1));
|
|
63
|
-
const markdown = textBuffer.getValueInRange(range, 0 );
|
|
64
|
-
marked_1(markdown, { renderer });
|
|
65
|
-
}
|
|
66
|
-
return assertIsDefined(codeEditorModel);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
WalkThroughSnippetContentProvider = ( __decorate([
|
|
70
|
-
( __param(0, ITextModelService)),
|
|
71
|
-
( __param(1, ILanguageService)),
|
|
72
|
-
( __param(2, IModelService)),
|
|
73
|
-
( __param(3, IInstantiationService))
|
|
74
|
-
], WalkThroughSnippetContentProvider));
|
|
75
|
-
|
|
76
|
-
export { WalkThroughSnippetContentProvider, requireToContent };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { registerColor } from 'vscode/vscode/vs/platform/theme/common/colorUtils';
|
|
2
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
|
|
3
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/chartsColors';
|
|
4
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
|
|
5
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
|
|
6
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/listColors';
|
|
7
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/menuColors';
|
|
8
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
|
|
9
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
|
|
10
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
|
|
11
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
|
|
12
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
13
|
-
import { Color, RGBA } from 'vscode/vscode/vs/base/common/color';
|
|
14
|
-
|
|
15
|
-
registerColor('walkThrough.embeddedEditorBackground', { dark: ( new Color(( new RGBA(0, 0, 0, .4)))), light: '#f4f4f4', hcDark: null, hcLight: null }, ( localizeWithPath(
|
|
16
|
-
'vs/workbench/contrib/welcomeWalkthrough/common/walkThroughUtils',
|
|
17
|
-
'walkThrough.embeddedEditorBackground',
|
|
18
|
-
'Background color for the embedded editors on the Interactive Playground.'
|
|
19
|
-
)));
|