@codingame/monaco-vscode-view-common-service-override 4.5.0-improve-code-splitting.1
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/assets/fake.html +10 -0
- package/assets/index-no-csp.html +1230 -0
- package/assets/index.html +1231 -0
- package/assets/service-worker.js +457 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/override/vs/workbench/browser/parts/editor/textEditor.js +5 -0
- package/override/vs/workbench/browser/parts/editor/textEditor.weak.js +11 -0
- package/package.json +32 -0
- package/tools/editorAssets.js +4 -0
- package/tools/url.js +10 -0
- package/viewCommon.d.ts +5 -0
- package/viewCommon.js +105 -0
- package/vscode/src/vs/base/browser/deviceAccess.js +61 -0
- package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +180 -0
- package/vscode/src/vs/base/browser/ui/grid/grid.js +494 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +6 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.js +1113 -0
- package/vscode/src/vs/platform/languagePacks/common/localizedStrings.js +12 -0
- package/vscode/src/vs/platform/webview/common/mimeTypes.js +24 -0
- package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +64 -0
- package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +907 -0
- package/vscode/src/vs/workbench/browser/actions/listCommands.js +764 -0
- package/vscode/src/vs/workbench/browser/actions/navigationActions.js +301 -0
- package/vscode/src/vs/workbench/browser/media/style.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +671 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +229 -0
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/compositeBar.js +606 -0
- package/vscode/src/vs/workbench/browser/parts/compositePart.js +346 -0
- package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +246 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +1403 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +188 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +523 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +1030 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +391 -0
- package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +643 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +472 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +68 -0
- package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +160 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarActions.js +39 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +238 -0
- package/vscode/src/vs/workbench/browser/style.js +54 -0
- package/vscode/src/vs/workbench/browser/window.js +381 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +300 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +367 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +135 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +18 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +146 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +215 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +78 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/customEditor.js +56 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +63 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +183 -0
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +8 -0
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +408 -0
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/limitIndicator/browser/limitIndicator.contribution.js +147 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +635 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +230 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +75 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +42 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +81 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +350 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +100 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +148 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +106 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +403 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +199 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +41 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +128 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +619 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +161 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +266 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +173 -0
- package/vscode/src/vs/workbench/contrib/preferences/browser/keyboardLayoutPicker.js +195 -0
- package/vscode/src/vs/workbench/contrib/sash/browser/sash.contribution.js +38 -0
- package/vscode/src/vs/workbench/contrib/sash/browser/sash.js +41 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +283 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +362 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +133 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +314 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +96 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +98 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +656 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +65 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +59 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +143 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +121 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +67 -0
- package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +234 -0
- package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewService.js +45 -0
- package/vscode/src/vs/workbench/services/activity/browser/activityService.js +145 -0
- package/vscode/src/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.js +341 -0
- package/vscode/src/vs/workbench/services/driver/browser/driver.js +186 -0
- package/vscode/src/vs/workbench/services/editor/browser/editorPaneService.js +13 -0
- package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +676 -0
- package/vscode/src/vs/workbench/services/history/browser/historyService.js +1516 -0
- package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +6 -0
- package/vscode/src/vs/workbench/services/progress/browser/progressService.js +527 -0
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +102 -0
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorService.js +133 -0
- package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +711 -0
- package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +603 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
3
|
+
import { IContextViewService } from 'vscode/vscode/vs/platform/contextview/browser/contextView.service';
|
|
4
|
+
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding.service';
|
|
5
|
+
import { SimpleFindWidget } from 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget';
|
|
6
|
+
import { KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED } from 'vscode/vscode/vs/workbench/contrib/webview/browser/webview';
|
|
7
|
+
|
|
8
|
+
let WebviewFindWidget = class WebviewFindWidget extends SimpleFindWidget {
|
|
9
|
+
async _getResultCount(dataChanged) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
constructor(_delegate, contextViewService, contextKeyService, keybindingService) {
|
|
13
|
+
super({
|
|
14
|
+
showCommonFindToggles: false,
|
|
15
|
+
checkImeCompletionState: _delegate.checkImeCompletionState,
|
|
16
|
+
enableSash: true,
|
|
17
|
+
}, contextViewService, contextKeyService, keybindingService);
|
|
18
|
+
this._delegate = _delegate;
|
|
19
|
+
this._findWidgetFocused = KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED.bindTo(contextKeyService);
|
|
20
|
+
this._register(_delegate.hasFindResult(hasResult => {
|
|
21
|
+
this.updateButtons(hasResult);
|
|
22
|
+
this.focusFindBox();
|
|
23
|
+
}));
|
|
24
|
+
this._register(_delegate.onDidStopFind(() => {
|
|
25
|
+
this.updateButtons(false);
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
find(previous) {
|
|
29
|
+
const val = this.inputValue;
|
|
30
|
+
if (val) {
|
|
31
|
+
this._delegate.find(val, previous);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
hide(animated = true) {
|
|
35
|
+
super.hide(animated);
|
|
36
|
+
this._delegate.stopFind(true);
|
|
37
|
+
this._delegate.focus();
|
|
38
|
+
}
|
|
39
|
+
_onInputChanged() {
|
|
40
|
+
const val = this.inputValue;
|
|
41
|
+
if (val) {
|
|
42
|
+
this._delegate.updateFind(val);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
this._delegate.stopFind(false);
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
_onFocusTrackerFocus() {
|
|
50
|
+
this._findWidgetFocused.set(true);
|
|
51
|
+
}
|
|
52
|
+
_onFocusTrackerBlur() {
|
|
53
|
+
this._findWidgetFocused.reset();
|
|
54
|
+
}
|
|
55
|
+
_onFindInputFocusTrackerFocus() { }
|
|
56
|
+
_onFindInputFocusTrackerBlur() { }
|
|
57
|
+
findFirst() { }
|
|
58
|
+
};
|
|
59
|
+
WebviewFindWidget = ( __decorate([
|
|
60
|
+
( __param(1, IContextViewService)),
|
|
61
|
+
( __param(2, IContextKeyService)),
|
|
62
|
+
( __param(3, IKeybindingService))
|
|
63
|
+
], WebviewFindWidget));
|
|
64
|
+
|
|
65
|
+
export { WebviewFindWidget };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
3
|
+
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
5
|
+
import { WebviewThemeDataProvider } from './themeing.js';
|
|
6
|
+
import { WebviewElement } from './webviewElement.js';
|
|
7
|
+
import { OverlayWebview } from './overlayWebview.js';
|
|
8
|
+
|
|
9
|
+
let WebviewService = class WebviewService extends Disposable {
|
|
10
|
+
constructor(_instantiationService) {
|
|
11
|
+
super();
|
|
12
|
+
this._instantiationService = _instantiationService;
|
|
13
|
+
this._webviews = ( new Set());
|
|
14
|
+
this._onDidChangeActiveWebview = this._register(( new Emitter()));
|
|
15
|
+
this.onDidChangeActiveWebview = this._onDidChangeActiveWebview.event;
|
|
16
|
+
this._webviewThemeDataProvider = this._instantiationService.createInstance(WebviewThemeDataProvider);
|
|
17
|
+
}
|
|
18
|
+
get activeWebview() { return this._activeWebview; }
|
|
19
|
+
_updateActiveWebview(value) {
|
|
20
|
+
if (value !== this._activeWebview) {
|
|
21
|
+
this._activeWebview = value;
|
|
22
|
+
this._onDidChangeActiveWebview.fire(value);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
get webviews() {
|
|
26
|
+
return ( this._webviews.values());
|
|
27
|
+
}
|
|
28
|
+
createWebviewElement(initInfo) {
|
|
29
|
+
const webview = this._instantiationService.createInstance(WebviewElement, initInfo, this._webviewThemeDataProvider);
|
|
30
|
+
this.registerNewWebview(webview);
|
|
31
|
+
return webview;
|
|
32
|
+
}
|
|
33
|
+
createWebviewOverlay(initInfo) {
|
|
34
|
+
const webview = this._instantiationService.createInstance(OverlayWebview, initInfo);
|
|
35
|
+
this.registerNewWebview(webview);
|
|
36
|
+
return webview;
|
|
37
|
+
}
|
|
38
|
+
registerNewWebview(webview) {
|
|
39
|
+
this._webviews.add(webview);
|
|
40
|
+
webview.onDidFocus(() => {
|
|
41
|
+
this._updateActiveWebview(webview);
|
|
42
|
+
});
|
|
43
|
+
const onBlur = () => {
|
|
44
|
+
if (this._activeWebview === webview) {
|
|
45
|
+
this._updateActiveWebview(undefined);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
webview.onDidBlur(onBlur);
|
|
49
|
+
webview.onDidDispose(() => {
|
|
50
|
+
onBlur();
|
|
51
|
+
this._webviews.delete(webview);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
WebviewService = ( __decorate([
|
|
56
|
+
( __param(0, IInstantiationService))
|
|
57
|
+
], WebviewService));
|
|
58
|
+
|
|
59
|
+
export { WebviewService };
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { EditorContextKeys } from 'vscode/vscode/vs/editor/common/editorContextKeys';
|
|
2
|
+
import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
3
|
+
import { Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
4
|
+
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
5
|
+
import { Categories } from 'vscode/vscode/vs/platform/action/common/actionCommonCategories';
|
|
6
|
+
import { KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_ENABLED, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED } from 'vscode/vscode/vs/workbench/contrib/webview/browser/webview';
|
|
7
|
+
import { IWebviewService } from 'vscode/vscode/vs/workbench/contrib/webview/browser/webview.service';
|
|
8
|
+
import { WebviewEditor } from 'vscode/vscode/vs/workbench/contrib/webviewPanel/browser/webviewEditor';
|
|
9
|
+
import { WebviewInput } from 'vscode/vscode/vs/workbench/contrib/webviewPanel/browser/webviewEditorInput';
|
|
10
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
11
|
+
|
|
12
|
+
const webviewActiveContextKeyExpr = ( ContextKeyExpr.and(( ContextKeyExpr.equals('activeEditor', WebviewEditor.ID)), ( EditorContextKeys.focus.toNegated() )));
|
|
13
|
+
class ShowWebViewEditorFindWidgetAction extends Action2 {
|
|
14
|
+
static { this.ID = 'editor.action.webvieweditor.showFind'; }
|
|
15
|
+
static { this.LABEL = ( localizeWithPath(
|
|
16
|
+
'vs/workbench/contrib/webviewPanel/browser/webviewCommands',
|
|
17
|
+
'editor.action.webvieweditor.showFind',
|
|
18
|
+
"Show find"
|
|
19
|
+
)); }
|
|
20
|
+
constructor() {
|
|
21
|
+
super({
|
|
22
|
+
id: ShowWebViewEditorFindWidgetAction.ID,
|
|
23
|
+
title: ShowWebViewEditorFindWidgetAction.LABEL,
|
|
24
|
+
keybinding: {
|
|
25
|
+
when: ( ContextKeyExpr.and(
|
|
26
|
+
webviewActiveContextKeyExpr,
|
|
27
|
+
KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_ENABLED
|
|
28
|
+
)),
|
|
29
|
+
primary: 2048 | 36 ,
|
|
30
|
+
weight: 100
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
run(accessor) {
|
|
35
|
+
getActiveWebviewEditor(accessor)?.showFind();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
class HideWebViewEditorFindCommand extends Action2 {
|
|
39
|
+
static { this.ID = 'editor.action.webvieweditor.hideFind'; }
|
|
40
|
+
static { this.LABEL = ( localizeWithPath(
|
|
41
|
+
'vs/workbench/contrib/webviewPanel/browser/webviewCommands',
|
|
42
|
+
'editor.action.webvieweditor.hideFind',
|
|
43
|
+
"Stop find"
|
|
44
|
+
)); }
|
|
45
|
+
constructor() {
|
|
46
|
+
super({
|
|
47
|
+
id: HideWebViewEditorFindCommand.ID,
|
|
48
|
+
title: HideWebViewEditorFindCommand.LABEL,
|
|
49
|
+
keybinding: {
|
|
50
|
+
when: ( ContextKeyExpr.and(
|
|
51
|
+
webviewActiveContextKeyExpr,
|
|
52
|
+
KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE
|
|
53
|
+
)),
|
|
54
|
+
primary: 9 ,
|
|
55
|
+
weight: 100
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
run(accessor) {
|
|
60
|
+
getActiveWebviewEditor(accessor)?.hideFind();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
class WebViewEditorFindNextCommand extends Action2 {
|
|
64
|
+
static { this.ID = 'editor.action.webvieweditor.findNext'; }
|
|
65
|
+
static { this.LABEL = ( localizeWithPath(
|
|
66
|
+
'vs/workbench/contrib/webviewPanel/browser/webviewCommands',
|
|
67
|
+
'editor.action.webvieweditor.findNext',
|
|
68
|
+
'Find next'
|
|
69
|
+
)); }
|
|
70
|
+
constructor() {
|
|
71
|
+
super({
|
|
72
|
+
id: WebViewEditorFindNextCommand.ID,
|
|
73
|
+
title: WebViewEditorFindNextCommand.LABEL,
|
|
74
|
+
keybinding: {
|
|
75
|
+
when: ( ContextKeyExpr.and(
|
|
76
|
+
webviewActiveContextKeyExpr,
|
|
77
|
+
KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED
|
|
78
|
+
)),
|
|
79
|
+
primary: 3 ,
|
|
80
|
+
weight: 100
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
run(accessor) {
|
|
85
|
+
getActiveWebviewEditor(accessor)?.runFindAction(false);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
class WebViewEditorFindPreviousCommand extends Action2 {
|
|
89
|
+
static { this.ID = 'editor.action.webvieweditor.findPrevious'; }
|
|
90
|
+
static { this.LABEL = ( localizeWithPath(
|
|
91
|
+
'vs/workbench/contrib/webviewPanel/browser/webviewCommands',
|
|
92
|
+
'editor.action.webvieweditor.findPrevious',
|
|
93
|
+
'Find previous'
|
|
94
|
+
)); }
|
|
95
|
+
constructor() {
|
|
96
|
+
super({
|
|
97
|
+
id: WebViewEditorFindPreviousCommand.ID,
|
|
98
|
+
title: WebViewEditorFindPreviousCommand.LABEL,
|
|
99
|
+
keybinding: {
|
|
100
|
+
when: ( ContextKeyExpr.and(
|
|
101
|
+
webviewActiveContextKeyExpr,
|
|
102
|
+
KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED
|
|
103
|
+
)),
|
|
104
|
+
primary: 1024 | 3 ,
|
|
105
|
+
weight: 100
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
run(accessor) {
|
|
110
|
+
getActiveWebviewEditor(accessor)?.runFindAction(true);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
class ReloadWebviewAction extends Action2 {
|
|
114
|
+
static { this.ID = 'workbench.action.webview.reloadWebviewAction'; }
|
|
115
|
+
static { this.LABEL = ( localize2WithPath(
|
|
116
|
+
'vs/workbench/contrib/webviewPanel/browser/webviewCommands',
|
|
117
|
+
'refreshWebviewLabel',
|
|
118
|
+
"Reload Webviews"
|
|
119
|
+
)); }
|
|
120
|
+
constructor() {
|
|
121
|
+
super({
|
|
122
|
+
id: ReloadWebviewAction.ID,
|
|
123
|
+
title: ReloadWebviewAction.LABEL,
|
|
124
|
+
category: Categories.Developer,
|
|
125
|
+
menu: [{
|
|
126
|
+
id: MenuId.CommandPalette
|
|
127
|
+
}]
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
async run(accessor) {
|
|
131
|
+
const webviewService = accessor.get(IWebviewService);
|
|
132
|
+
for (const webview of webviewService.webviews) {
|
|
133
|
+
webview.reload();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function getActiveWebviewEditor(accessor) {
|
|
138
|
+
const editorService = accessor.get(IEditorService);
|
|
139
|
+
const activeEditor = editorService.activeEditor;
|
|
140
|
+
return activeEditor instanceof WebviewInput ? activeEditor.webview : undefined;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export { HideWebViewEditorFindCommand, ReloadWebviewAction, ShowWebViewEditorFindWidgetAction, WebViewEditorFindNextCommand, WebViewEditorFindPreviousCommand };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
3
|
+
import { ExtensionIdentifier } from 'vscode/vscode/vs/platform/extensions/common/extensions';
|
|
4
|
+
import { WebviewInput } from 'vscode/vscode/vs/workbench/contrib/webviewPanel/browser/webviewEditorInput';
|
|
5
|
+
import { IWebviewWorkbenchService } from 'vscode/vscode/vs/workbench/contrib/webviewPanel/browser/webviewWorkbenchService.service';
|
|
6
|
+
|
|
7
|
+
let WebviewEditorInputSerializer = class WebviewEditorInputSerializer {
|
|
8
|
+
static { this.ID = WebviewInput.typeId; }
|
|
9
|
+
constructor(_webviewWorkbenchService) {
|
|
10
|
+
this._webviewWorkbenchService = _webviewWorkbenchService;
|
|
11
|
+
}
|
|
12
|
+
canSerialize(input) {
|
|
13
|
+
return this._webviewWorkbenchService.shouldPersist(input);
|
|
14
|
+
}
|
|
15
|
+
serialize(input) {
|
|
16
|
+
if (!this.canSerialize(input)) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
const data = this.toJson(input);
|
|
20
|
+
try {
|
|
21
|
+
return JSON.stringify(data);
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
deserialize(_instantiationService, serializedEditorInput) {
|
|
28
|
+
const data = this.fromJson(JSON.parse(serializedEditorInput));
|
|
29
|
+
return this._webviewWorkbenchService.openRevivedWebview({
|
|
30
|
+
webviewInitInfo: {
|
|
31
|
+
providedViewType: data.providedId,
|
|
32
|
+
origin: data.origin,
|
|
33
|
+
title: data.title,
|
|
34
|
+
options: data.webviewOptions,
|
|
35
|
+
contentOptions: data.contentOptions,
|
|
36
|
+
extension: data.extension,
|
|
37
|
+
},
|
|
38
|
+
viewType: data.viewType,
|
|
39
|
+
title: data.title,
|
|
40
|
+
iconPath: data.iconPath,
|
|
41
|
+
state: data.state,
|
|
42
|
+
group: data.group
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
fromJson(data) {
|
|
46
|
+
return {
|
|
47
|
+
...data,
|
|
48
|
+
extension: reviveWebviewExtensionDescription(data.extensionId, data.extensionLocation),
|
|
49
|
+
iconPath: reviveIconPath(data.iconPath),
|
|
50
|
+
state: reviveState(data.state),
|
|
51
|
+
webviewOptions: restoreWebviewOptions(data.options),
|
|
52
|
+
contentOptions: restoreWebviewContentOptions(data.options),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
toJson(input) {
|
|
56
|
+
return {
|
|
57
|
+
origin: input.webview.origin,
|
|
58
|
+
viewType: input.viewType,
|
|
59
|
+
providedId: input.providedId,
|
|
60
|
+
title: input.getName(),
|
|
61
|
+
options: { ...input.webview.options, ...input.webview.contentOptions },
|
|
62
|
+
extensionLocation: input.extension?.location,
|
|
63
|
+
extensionId: input.extension?.id.value,
|
|
64
|
+
state: input.webview.state,
|
|
65
|
+
iconPath: input.iconPath ? { light: input.iconPath.light, dark: input.iconPath.dark, } : undefined,
|
|
66
|
+
group: input.group
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
WebviewEditorInputSerializer = ( __decorate([
|
|
71
|
+
( __param(0, IWebviewWorkbenchService))
|
|
72
|
+
], WebviewEditorInputSerializer));
|
|
73
|
+
function reviveWebviewExtensionDescription(extensionId, extensionLocation) {
|
|
74
|
+
if (!extensionId) {
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
const location = reviveUri(extensionLocation);
|
|
78
|
+
if (!location) {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
id: ( new ExtensionIdentifier(extensionId)),
|
|
83
|
+
location,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function reviveIconPath(data) {
|
|
87
|
+
if (!data) {
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
const light = reviveUri(data.light);
|
|
91
|
+
const dark = reviveUri(data.dark);
|
|
92
|
+
return light && dark ? { light, dark } : undefined;
|
|
93
|
+
}
|
|
94
|
+
function reviveUri(data) {
|
|
95
|
+
if (!data) {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
if (typeof data === 'string') {
|
|
100
|
+
return ( URI.parse(data));
|
|
101
|
+
}
|
|
102
|
+
return ( URI.from(data));
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function reviveState(state) {
|
|
109
|
+
return typeof state === 'string' ? state : undefined;
|
|
110
|
+
}
|
|
111
|
+
function restoreWebviewOptions(options) {
|
|
112
|
+
return options;
|
|
113
|
+
}
|
|
114
|
+
function restoreWebviewContentOptions(options) {
|
|
115
|
+
return {
|
|
116
|
+
...options,
|
|
117
|
+
localResourceRoots: options.localResourceRoots?.map(uri => reviveUri(uri)),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export { WebviewEditorInputSerializer, restoreWebviewContentOptions, restoreWebviewOptions, reviveWebviewExtensionDescription };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
|
+
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
4
|
+
import { registerAction2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
5
|
+
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
6
|
+
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
7
|
+
import { EditorPaneDescriptor } from 'vscode/vscode/vs/workbench/browser/editor';
|
|
8
|
+
import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
9
|
+
import { EditorExtensions } from 'vscode/vscode/vs/workbench/common/editor';
|
|
10
|
+
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
11
|
+
import { ShowWebViewEditorFindWidgetAction, HideWebViewEditorFindCommand, WebViewEditorFindNextCommand, WebViewEditorFindPreviousCommand, ReloadWebviewAction } from './webviewCommands.js';
|
|
12
|
+
import { WebviewEditor } from 'vscode/vscode/vs/workbench/contrib/webviewPanel/browser/webviewEditor';
|
|
13
|
+
import { WebviewInput } from 'vscode/vscode/vs/workbench/contrib/webviewPanel/browser/webviewEditorInput';
|
|
14
|
+
import { WebviewEditorInputSerializer } from './webviewEditorInputSerializer.js';
|
|
15
|
+
import 'vscode/vscode/vs/workbench/contrib/webviewPanel/browser/webviewWorkbenchService';
|
|
16
|
+
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
17
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
18
|
+
|
|
19
|
+
(( Registry.as(EditorExtensions.EditorPane))).registerEditorPane(EditorPaneDescriptor.create(WebviewEditor, WebviewEditor.ID, ( localizeWithPath(
|
|
20
|
+
'vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution',
|
|
21
|
+
'webview.editor.label',
|
|
22
|
+
"webview editor"
|
|
23
|
+
))), [( new SyncDescriptor(WebviewInput))]);
|
|
24
|
+
let WebviewPanelContribution = class WebviewPanelContribution extends Disposable {
|
|
25
|
+
static { this.ID = 'workbench.contrib.webviewPanel'; }
|
|
26
|
+
constructor(editorService, editorGroupService) {
|
|
27
|
+
super();
|
|
28
|
+
this.editorGroupService = editorGroupService;
|
|
29
|
+
this._register(editorService.onWillOpenEditor(e => {
|
|
30
|
+
const group = editorGroupService.getGroup(e.groupId);
|
|
31
|
+
if (group) {
|
|
32
|
+
this.onEditorOpening(e.editor, group);
|
|
33
|
+
}
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
onEditorOpening(editor, group) {
|
|
37
|
+
if (!(editor instanceof WebviewInput) || editor.typeId !== WebviewInput.typeId) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (group.contains(editor)) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
let previousGroup;
|
|
44
|
+
const groups = this.editorGroupService.groups;
|
|
45
|
+
for (const group of groups) {
|
|
46
|
+
if (group.contains(editor)) {
|
|
47
|
+
previousGroup = group;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (!previousGroup) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
previousGroup.closeEditor(editor);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
WebviewPanelContribution = ( __decorate([
|
|
58
|
+
( __param(0, IEditorService)),
|
|
59
|
+
( __param(1, IEditorGroupsService))
|
|
60
|
+
], WebviewPanelContribution));
|
|
61
|
+
registerWorkbenchContribution2(WebviewPanelContribution.ID, WebviewPanelContribution, 1 );
|
|
62
|
+
( Registry.as(EditorExtensions.EditorFactory)).registerEditorSerializer(WebviewEditorInputSerializer.ID, WebviewEditorInputSerializer);
|
|
63
|
+
registerAction2(ShowWebViewEditorFindWidgetAction);
|
|
64
|
+
registerAction2(HideWebViewEditorFindCommand);
|
|
65
|
+
registerAction2(WebViewEditorFindNextCommand);
|
|
66
|
+
registerAction2(WebViewEditorFindPreviousCommand);
|
|
67
|
+
registerAction2(ReloadWebviewAction);
|