@codingame/monaco-vscode-api 1.78.5 → 1.78.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node_modules/tslib/tslib.es6.js +2 -2
- package/dist/vscode/vs/platform/extensionManagement/common/extensionManagement.js +1 -2
- package/dist/vscode/vs/platform/extensionManagement/common/implicitActivationEvents.js +1 -1
- package/dist/vscode/vs/platform/files/common/fileService.js +3 -3
- package/dist/vscode/vs/platform/files/common/inMemoryFilesystemProvider.js +1 -1
- package/dist/vscode/vs/platform/telemetry/common/telemetryUtils.js +1 -1
- package/dist/vscode/vs/platform/workspaces/common/workspaces.js +1 -1
- package/dist/vscode/vs/workbench/api/browser/mainThreadDebugService.js +1 -1
- package/dist/vscode/vs/workbench/api/browser/mainThreadDiagnostics.js +1 -1
- package/dist/vscode/vs/workbench/api/browser/mainThreadDocuments.js +4 -4
- package/dist/vscode/vs/workbench/api/browser/mainThreadDocumentsAndEditors.js +1 -1
- package/dist/vscode/vs/workbench/api/browser/mainThreadFileSystem.js +1 -1
- package/dist/vscode/vs/workbench/api/browser/mainThreadQuickOpen.js +1 -1
- package/dist/vscode/vs/workbench/api/common/cache.js +1 -1
- package/dist/vscode/vs/workbench/api/common/configurationExtensionPoint.js +1 -1
- package/dist/vscode/vs/workbench/api/common/extHostApiDeprecationService.js +1 -1
- package/dist/vscode/vs/workbench/api/common/extHostCommands.js +2 -2
- package/dist/vscode/vs/workbench/api/common/extHostDebugService.js +2 -2
- package/dist/vscode/vs/workbench/api/common/extHostDecorations.js +1 -1
- package/dist/vscode/vs/workbench/api/common/extHostDiagnostics.js +3 -3
- package/dist/vscode/vs/workbench/api/common/extHostDocumentsAndEditors.js +3 -3
- package/dist/vscode/vs/workbench/api/common/extHostExtensionActivator.js +1 -1
- package/dist/vscode/vs/workbench/api/common/extHostExtensionService.js +1 -1
- package/dist/vscode/vs/workbench/api/common/extHostFileSystem.js +1 -1
- package/dist/vscode/vs/workbench/api/common/extHostFileSystemInfo.js +1 -1
- package/dist/vscode/vs/workbench/api/common/extHostLanguages.js +1 -1
- package/dist/vscode/vs/workbench/api/common/extHostLocalizationService.js +1 -1
- package/dist/vscode/vs/workbench/api/common/extHostQuickOpen.js +2 -2
- package/dist/vscode/vs/workbench/api/common/extHostTextEditor.js +1 -1
- package/dist/vscode/vs/workbench/api/common/extHostTypeConverters.js +2 -2
- package/dist/vscode/vs/workbench/api/common/extHostTypes.js +4 -4
- package/dist/vscode/vs/workbench/api/common/extHostWorkspace.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/editor/editor.contribution.js +6 -795
- package/dist/vscode/vs/workbench/browser/parts/editor/editorActions.js +110 -1487
- package/dist/vscode/vs/workbench/browser/parts/editor/editorPane.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/editor/editorQuickAccess.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/editor/editorWithViewState.js +1 -1
- package/dist/vscode/vs/workbench/browser/quickaccess.js +2 -4
- package/dist/vscode/vs/workbench/common/contextkeys.js +1 -30
- package/dist/vscode/vs/workbench/common/editor.js +1 -1
- package/dist/vscode/vs/workbench/common/resources.js +3 -3
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugAdapterManager.js +1 -1
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugConfigurationManager.js +1 -1
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugEditorContribution.js +5 -5
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugSession.js +2 -2
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugToolBar.js +1 -1
- package/dist/vscode/vs/workbench/contrib/debug/common/debugModel.js +3 -3
- package/dist/vscode/vs/workbench/contrib/debug/common/debugUtils.js +1 -1
- package/dist/vscode/vs/workbench/contrib/files/common/explorerFileNestingTrie.js +1 -1
- package/dist/vscode/vs/workbench/contrib/snippets/browser/snippetsFile.js +1 -1
- package/dist/vscode/vs/workbench/contrib/snippets/browser/snippetsService.js +5 -3
- package/dist/vscode/vs/workbench/contrib/testing/common/testItemCollection.js +1 -1
- package/dist/vscode/vs/workbench/services/configuration/browser/configurationService.js +1 -1
- package/dist/vscode/vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService.js +1 -1
- package/dist/vscode/vs/workbench/services/configurationResolver/common/variableResolver.js +1 -1
- package/dist/vscode/vs/workbench/services/extensions/common/extensionDescriptionRegistry.js +10 -10
- package/dist/vscode/vs/workbench/services/extensions/common/extensionsRegistry.js +3 -3
- package/dist/vscode/vs/workbench/services/keybinding/browser/keybindingService.js +3 -3
- package/dist/vscode/vs/workbench/services/keybinding/browser/unboundCommands.js +1 -1
- package/dist/vscode/vs/workbench/services/languageDetection/common/languageDetectionWorkerService.js +1 -2
- package/dist/vscode/vs/workbench/services/layout/browser/layoutService.js +1 -9
- package/dist/vscode/vs/workbench/services/output/common/output.js +1 -1
- package/dist/vscode/vs/workbench/services/preferences/common/preferencesModels.js +1 -1
- package/dist/vscode/vs/workbench/services/search/common/searchService.js +7 -7
- package/dist/vscode/vs/workbench/services/textMate/browser/textMateTokenizationFeatureImpl.js +2 -2
- package/dist/vscode/vs/workbench/services/textMate/browser/workerHost/textMateWorkerHost.js +1 -1
- package/dist/vscode/vs/workbench/services/textMate/common/TMGrammarFactory.js +1 -1
- package/dist/vscode/vs/workbench/services/textfile/common/textFileEditorModelManager.js +4 -4
- package/dist/vscode/vs/workbench/services/textmodelResolver/common/textModelResolverService.js +3 -3
- package/dist/vscode/vs/workbench/services/themes/browser/workbenchThemeService.js +1 -1
- package/dist/vscode/vs/workbench/services/workingCopy/common/workingCopyBackupService.js +11 -7
- package/dist/vscode/vs/workbench/services/workingCopy/common/workingCopyService.js +1 -1
- package/monaco-editor-treemending.patch +531 -531
- package/package.json +1 -1
- package/dist/assets/editorstatus.css +0 -51
- package/dist/assets/panelpart.css +0 -75
- package/dist/vscode/vs/workbench/browser/actions/layoutActions.js +0 -1201
- package/dist/vscode/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarActions.js +0 -146
- package/dist/vscode/vs/workbench/browser/parts/editor/editorStatus.js +0 -460
- package/dist/vscode/vs/workbench/browser/parts/panel/panelActions.js +0 -422
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { Codicon } from 'monaco-editor/esm/vs/base/common/codicons.js';
|
|
2
|
-
import { localize } from 'monaco-editor/esm/vs/nls.js';
|
|
3
|
-
import { registerAction2, MenuRegistry, MenuId, Action2 } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
|
|
4
|
-
import { ContextKeyExpr } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
5
|
-
import { registerIcon } from 'monaco-editor/esm/vs/platform/theme/common/iconRegistry.js';
|
|
6
|
-
import { Categories } from 'monaco-editor/esm/vs/platform/action/common/actionCommonCategories.js';
|
|
7
|
-
import { AuxiliaryBarVisibleContext } from '../../../common/contextkeys.js';
|
|
8
|
-
import { ViewContainerLocationToString } from '../../../common/views.js';
|
|
9
|
-
import { IWorkbenchLayoutService } from '../../../services/layout/browser/layoutService.js';
|
|
10
|
-
import { IPaneCompositePartService } from '../../../services/panecomposite/browser/panecomposite.js';
|
|
11
|
-
var _a;
|
|
12
|
-
const auxiliaryBarRightIcon = ( registerIcon(
|
|
13
|
-
'auxiliarybar-right-layout-icon',
|
|
14
|
-
Codicon.layoutSidebarRight,
|
|
15
|
-
( localize(
|
|
16
|
-
'toggleAuxiliaryIconRight',
|
|
17
|
-
'Icon to toggle the auxiliary bar off in its right position.'
|
|
18
|
-
))
|
|
19
|
-
));
|
|
20
|
-
const auxiliaryBarRightOffIcon = ( registerIcon(
|
|
21
|
-
'auxiliarybar-right-off-layout-icon',
|
|
22
|
-
Codicon.layoutSidebarRightOff,
|
|
23
|
-
( localize(
|
|
24
|
-
'toggleAuxiliaryIconRightOn',
|
|
25
|
-
'Icon to toggle the auxiliary bar on in its right position.'
|
|
26
|
-
))
|
|
27
|
-
));
|
|
28
|
-
const auxiliaryBarLeftIcon = ( registerIcon('auxiliarybar-left-layout-icon', Codicon.layoutSidebarLeft, ( localize(
|
|
29
|
-
'toggleAuxiliaryIconLeft',
|
|
30
|
-
'Icon to toggle the auxiliary bar in its left position.'
|
|
31
|
-
))));
|
|
32
|
-
const auxiliaryBarLeftOffIcon = ( registerIcon(
|
|
33
|
-
'auxiliarybar-left-off-layout-icon',
|
|
34
|
-
Codicon.layoutSidebarLeftOff,
|
|
35
|
-
( localize(
|
|
36
|
-
'toggleAuxiliaryIconLeftOn',
|
|
37
|
-
'Icon to toggle the auxiliary bar on in its left position.'
|
|
38
|
-
))
|
|
39
|
-
));
|
|
40
|
-
class ToggleAuxiliaryBarAction extends Action2 {
|
|
41
|
-
constructor() {
|
|
42
|
-
super({
|
|
43
|
-
id: ToggleAuxiliaryBarAction.ID,
|
|
44
|
-
title: { value: ToggleAuxiliaryBarAction.LABEL, original: 'Toggle Secondary Side Bar Visibility' },
|
|
45
|
-
toggled: {
|
|
46
|
-
condition: AuxiliaryBarVisibleContext,
|
|
47
|
-
title: ( localize('secondary sidebar', "Secondary Side Bar")),
|
|
48
|
-
mnemonicTitle: ( localize(
|
|
49
|
-
{ key: 'secondary sidebar mnemonic', comment: ['&& denotes a mnemonic'] },
|
|
50
|
-
"Secondary Si&&de Bar"
|
|
51
|
-
)),
|
|
52
|
-
},
|
|
53
|
-
category: Categories.View,
|
|
54
|
-
f1: true,
|
|
55
|
-
keybinding: {
|
|
56
|
-
weight: 200 ,
|
|
57
|
-
primary: 2048 | 512 | 32
|
|
58
|
-
},
|
|
59
|
-
menu: [
|
|
60
|
-
{
|
|
61
|
-
id: MenuId.LayoutControlMenuSubmenu,
|
|
62
|
-
group: '0_workbench_layout',
|
|
63
|
-
order: 1
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
id: MenuId.MenubarAppearanceMenu,
|
|
67
|
-
group: '2_workbench_layout',
|
|
68
|
-
order: 2
|
|
69
|
-
}
|
|
70
|
-
]
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
async run(accessor) {
|
|
74
|
-
const layoutService = accessor.get(IWorkbenchLayoutService);
|
|
75
|
-
layoutService.setPartHidden(layoutService.isVisible("workbench.parts.auxiliarybar" ), "workbench.parts.auxiliarybar" );
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
ToggleAuxiliaryBarAction.ID = 'workbench.action.toggleAuxiliaryBar';
|
|
79
|
-
ToggleAuxiliaryBarAction.LABEL = ( localize('toggleAuxiliaryBar', "Toggle Secondary Side Bar Visibility"));
|
|
80
|
-
registerAction2(ToggleAuxiliaryBarAction);
|
|
81
|
-
registerAction2((_a = class FocusAuxiliaryBarAction extends Action2 {
|
|
82
|
-
constructor() {
|
|
83
|
-
super({
|
|
84
|
-
id: FocusAuxiliaryBarAction.ID,
|
|
85
|
-
title: { value: FocusAuxiliaryBarAction.LABEL, original: 'Focus into Secondary Side Bar' },
|
|
86
|
-
category: Categories.View,
|
|
87
|
-
f1: true,
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
async run(accessor) {
|
|
91
|
-
const paneCompositeService = accessor.get(IPaneCompositePartService);
|
|
92
|
-
const layoutService = accessor.get(IWorkbenchLayoutService);
|
|
93
|
-
if (!layoutService.isVisible("workbench.parts.auxiliarybar" )) {
|
|
94
|
-
layoutService.setPartHidden(false, "workbench.parts.auxiliarybar" );
|
|
95
|
-
}
|
|
96
|
-
const composite = paneCompositeService.getActivePaneComposite(2 );
|
|
97
|
-
composite?.focus();
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
_a.ID = 'workbench.action.focusAuxiliaryBar',
|
|
101
|
-
_a.LABEL = ( localize('focusAuxiliaryBar', "Focus into Secondary Side Bar")),
|
|
102
|
-
_a));
|
|
103
|
-
MenuRegistry.appendMenuItems([
|
|
104
|
-
{
|
|
105
|
-
id: MenuId.LayoutControlMenu,
|
|
106
|
-
item: {
|
|
107
|
-
group: '0_workbench_toggles',
|
|
108
|
-
command: {
|
|
109
|
-
id: ToggleAuxiliaryBarAction.ID,
|
|
110
|
-
title: ( localize('toggleSecondarySideBar', "Toggle Secondary Side Bar")),
|
|
111
|
-
toggled: { condition: AuxiliaryBarVisibleContext, icon: auxiliaryBarLeftIcon },
|
|
112
|
-
icon: auxiliaryBarLeftOffIcon,
|
|
113
|
-
},
|
|
114
|
-
when: ( ContextKeyExpr.and(( ContextKeyExpr.or(( ContextKeyExpr.equals('config.workbench.layoutControl.type', 'toggles')), ( ContextKeyExpr.equals('config.workbench.layoutControl.type', 'both')))), ( ContextKeyExpr.equals('config.workbench.sideBar.location', 'right')))),
|
|
115
|
-
order: 0
|
|
116
|
-
}
|
|
117
|
-
}, {
|
|
118
|
-
id: MenuId.LayoutControlMenu,
|
|
119
|
-
item: {
|
|
120
|
-
group: '0_workbench_toggles',
|
|
121
|
-
command: {
|
|
122
|
-
id: ToggleAuxiliaryBarAction.ID,
|
|
123
|
-
title: ( localize('toggleSecondarySideBar', "Toggle Secondary Side Bar")),
|
|
124
|
-
toggled: { condition: AuxiliaryBarVisibleContext, icon: auxiliaryBarRightIcon },
|
|
125
|
-
icon: auxiliaryBarRightOffIcon,
|
|
126
|
-
},
|
|
127
|
-
when: ( ContextKeyExpr.and(( ContextKeyExpr.or(( ContextKeyExpr.equals('config.workbench.layoutControl.type', 'toggles')), ( ContextKeyExpr.equals('config.workbench.layoutControl.type', 'both')))), ( ContextKeyExpr.equals('config.workbench.sideBar.location', 'left')))),
|
|
128
|
-
order: 2
|
|
129
|
-
}
|
|
130
|
-
}, {
|
|
131
|
-
id: MenuId.ViewTitleContext,
|
|
132
|
-
item: {
|
|
133
|
-
group: '3_workbench_layout_move',
|
|
134
|
-
command: {
|
|
135
|
-
id: ToggleAuxiliaryBarAction.ID,
|
|
136
|
-
title: { value: ( localize('hideAuxiliaryBar', "Hide Secondary Side Bar")), original: 'Hide Secondary Side Bar' },
|
|
137
|
-
},
|
|
138
|
-
when: ( ContextKeyExpr.and(AuxiliaryBarVisibleContext, ( ContextKeyExpr.equals(
|
|
139
|
-
'viewLocation',
|
|
140
|
-
ViewContainerLocationToString(2 )
|
|
141
|
-
)))),
|
|
142
|
-
order: 2
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
]);
|
|
146
|
-
export { ToggleAuxiliaryBarAction };
|
|
@@ -1,460 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../node_modules/tslib/tslib.es6.js';
|
|
2
|
-
import "../../../../../../assets/editorstatus.css";
|
|
3
|
-
import { localize } from 'monaco-editor/esm/vs/nls.js';
|
|
4
|
-
import { extname, basename } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
5
|
-
import { withNullAsUndefined, withUndefinedAsNull, areFunctions } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
6
|
-
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
7
|
-
import { Action } from 'monaco-editor/esm/vs/base/common/actions.js';
|
|
8
|
-
import { Language } from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
9
|
-
import { UntitledTextEditorInput } from '../../../services/untitled/common/untitledTextEditorInput.js';
|
|
10
|
-
import { EditorResourceAccessor, SideBySideEditor } from '../../../common/editor.js';
|
|
11
|
-
import { IEditorService } from '../../../services/editor/common/editorService.js';
|
|
12
|
-
import { FILES_ASSOCIATIONS_CONFIG, IFileService } from 'monaco-editor/esm/vs/platform/files/common/files.js';
|
|
13
|
-
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
14
|
-
import { ILanguageService } from 'monaco-editor/esm/vs/editor/common/languages/language.js';
|
|
15
|
-
import { ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
|
|
16
|
-
import { IExtensionGalleryService } from '../../../../platform/extensionManagement/common/extensionManagement.js';
|
|
17
|
-
import { ITextFileService } from '../../../services/textfile/common/textfiles.js';
|
|
18
|
-
import { SUPPORTED_ENCODINGS } from '../../../services/textfile/common/encoding.js';
|
|
19
|
-
import { ITextResourceConfigurationService } from 'monaco-editor/esm/vs/editor/common/services/textResourceConfiguration.js';
|
|
20
|
-
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
21
|
-
import { deepClone } from 'monaco-editor/esm/vs/base/common/objects.js';
|
|
22
|
-
import { getCodeEditor } from 'monaco-editor/esm/vs/editor/browser/editorBrowser.js';
|
|
23
|
-
import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
|
|
24
|
-
import { IPreferencesService } from '../../../services/preferences/common/preferences.js';
|
|
25
|
-
import { IQuickInputService } from 'monaco-editor/esm/vs/platform/quickinput/common/quickInput.js';
|
|
26
|
-
import { getIconClassesForLanguageId } from 'monaco-editor/esm/vs/editor/common/services/getIconClasses.js';
|
|
27
|
-
import { timeout, Promises } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
28
|
-
import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
|
|
29
|
-
import { SideBySideEditorInput } from '../../../common/editor/sideBySideEditorInput.js';
|
|
30
|
-
import { ILanguageDetectionService, AutomaticLanguageDetectionLikelyWrongId } from '../../../services/languageDetection/common/languageDetectionWorkerService.js';
|
|
31
|
-
import { ContextKeyExpr } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
32
|
-
import { Action2 } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
|
|
33
|
-
import { KeyChord } from 'monaco-editor/esm/vs/base/common/keyCodes.js';
|
|
34
|
-
class SideBySideEditorEncodingSupport {
|
|
35
|
-
constructor(primary, secondary) {
|
|
36
|
-
this.primary = primary;
|
|
37
|
-
this.secondary = secondary;
|
|
38
|
-
}
|
|
39
|
-
getEncoding() {
|
|
40
|
-
return this.primary.getEncoding();
|
|
41
|
-
}
|
|
42
|
-
async setEncoding(encoding, mode) {
|
|
43
|
-
await Promises.settled(( [this.primary, this.secondary].map(editor => editor.setEncoding(encoding, mode))));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
class SideBySideEditorLanguageSupport {
|
|
47
|
-
constructor(primary, secondary) {
|
|
48
|
-
this.primary = primary;
|
|
49
|
-
this.secondary = secondary;
|
|
50
|
-
}
|
|
51
|
-
setLanguageId(languageId, source) {
|
|
52
|
-
[this.primary, this.secondary].forEach(editor => editor.setLanguageId(languageId, source));
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
function toEditorWithEncodingSupport(input) {
|
|
56
|
-
if (input instanceof UntitledTextEditorInput) {
|
|
57
|
-
return input;
|
|
58
|
-
}
|
|
59
|
-
if (input instanceof SideBySideEditorInput) {
|
|
60
|
-
const primaryEncodingSupport = toEditorWithEncodingSupport(input.primary);
|
|
61
|
-
const secondaryEncodingSupport = toEditorWithEncodingSupport(input.secondary);
|
|
62
|
-
if (primaryEncodingSupport && secondaryEncodingSupport) {
|
|
63
|
-
return ( new SideBySideEditorEncodingSupport(primaryEncodingSupport, secondaryEncodingSupport));
|
|
64
|
-
}
|
|
65
|
-
return primaryEncodingSupport;
|
|
66
|
-
}
|
|
67
|
-
const encodingSupport = input;
|
|
68
|
-
if (areFunctions(encodingSupport.setEncoding, encodingSupport.getEncoding)) {
|
|
69
|
-
return encodingSupport;
|
|
70
|
-
}
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
function toEditorWithLanguageSupport(input) {
|
|
74
|
-
if (input instanceof UntitledTextEditorInput) {
|
|
75
|
-
return input;
|
|
76
|
-
}
|
|
77
|
-
if (input instanceof SideBySideEditorInput) {
|
|
78
|
-
const primaryLanguageSupport = toEditorWithLanguageSupport(input.primary);
|
|
79
|
-
const secondaryLanguageSupport = toEditorWithLanguageSupport(input.secondary);
|
|
80
|
-
if (primaryLanguageSupport && secondaryLanguageSupport) {
|
|
81
|
-
return ( new SideBySideEditorLanguageSupport(primaryLanguageSupport, secondaryLanguageSupport));
|
|
82
|
-
}
|
|
83
|
-
return primaryLanguageSupport;
|
|
84
|
-
}
|
|
85
|
-
const languageSupport = input;
|
|
86
|
-
if (typeof languageSupport.setLanguageId === 'function') {
|
|
87
|
-
return languageSupport;
|
|
88
|
-
}
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
const nlsEOLLF = ( localize('endOfLineLineFeed', "LF"));
|
|
92
|
-
const nlsEOLCRLF = ( localize('endOfLineCarriageReturnLineFeed', "CRLF"));
|
|
93
|
-
let ShowLanguageExtensionsAction = class ShowLanguageExtensionsAction extends Action {
|
|
94
|
-
constructor(fileExtension, commandService, galleryService) {
|
|
95
|
-
super(ShowLanguageExtensionsAction.ID, ( localize(
|
|
96
|
-
'showLanguageExtensions',
|
|
97
|
-
"Search Marketplace Extensions for '{0}'...",
|
|
98
|
-
fileExtension
|
|
99
|
-
)));
|
|
100
|
-
this.fileExtension = fileExtension;
|
|
101
|
-
this.commandService = commandService;
|
|
102
|
-
this.enabled = galleryService.isEnabled();
|
|
103
|
-
}
|
|
104
|
-
async run() {
|
|
105
|
-
await this.commandService.executeCommand('workbench.extensions.action.showExtensionsForLanguage', this.fileExtension);
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
ShowLanguageExtensionsAction.ID = 'workbench.action.showLanguageExtensions';
|
|
109
|
-
ShowLanguageExtensionsAction = ( __decorate([
|
|
110
|
-
( __param(1, ICommandService)),
|
|
111
|
-
( __param(2, IExtensionGalleryService))
|
|
112
|
-
], ShowLanguageExtensionsAction));
|
|
113
|
-
class ChangeLanguageAction extends Action2 {
|
|
114
|
-
constructor() {
|
|
115
|
-
super({
|
|
116
|
-
id: ChangeLanguageAction.ID,
|
|
117
|
-
title: { value: ( localize('changeMode', "Change Language Mode")), original: 'Change Language Mode' },
|
|
118
|
-
f1: true,
|
|
119
|
-
keybinding: {
|
|
120
|
-
weight: 200 ,
|
|
121
|
-
primary: KeyChord(2048 | 41 , 43 )
|
|
122
|
-
},
|
|
123
|
-
precondition: ContextKeyExpr.not('notebookEditorFocused')
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
async run(accessor) {
|
|
127
|
-
const quickInputService = accessor.get(IQuickInputService);
|
|
128
|
-
const editorService = accessor.get(IEditorService);
|
|
129
|
-
const languageService = accessor.get(ILanguageService);
|
|
130
|
-
const languageDetectionService = accessor.get(ILanguageDetectionService);
|
|
131
|
-
const textFileService = accessor.get(ITextFileService);
|
|
132
|
-
const preferencesService = accessor.get(IPreferencesService);
|
|
133
|
-
const instantiationService = accessor.get(IInstantiationService);
|
|
134
|
-
const configurationService = accessor.get(IConfigurationService);
|
|
135
|
-
const telemetryService = accessor.get(ITelemetryService);
|
|
136
|
-
const activeTextEditorControl = getCodeEditor(editorService.activeTextEditorControl);
|
|
137
|
-
if (!activeTextEditorControl) {
|
|
138
|
-
await quickInputService.pick([{ label: ( localize('noEditor', "No text editor active at this time")) }]);
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
const textModel = activeTextEditorControl.getModel();
|
|
142
|
-
const resource = EditorResourceAccessor.getOriginalUri(editorService.activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY });
|
|
143
|
-
let currentLanguageName;
|
|
144
|
-
let currentLanguageId;
|
|
145
|
-
if (textModel) {
|
|
146
|
-
currentLanguageId = textModel.getLanguageId();
|
|
147
|
-
currentLanguageName = withNullAsUndefined(languageService.getLanguageName(currentLanguageId));
|
|
148
|
-
}
|
|
149
|
-
let hasLanguageSupport = !!resource;
|
|
150
|
-
if (resource?.scheme === Schemas.untitled && !textFileService.untitled.get(resource)?.hasAssociatedFilePath) {
|
|
151
|
-
hasLanguageSupport = false;
|
|
152
|
-
}
|
|
153
|
-
const languages = languageService.getSortedRegisteredLanguageNames();
|
|
154
|
-
const picks = ( languages
|
|
155
|
-
.map(({ languageName, languageId }) => {
|
|
156
|
-
const extensions = languageService.getExtensions(languageId).join(' ');
|
|
157
|
-
let description;
|
|
158
|
-
if (currentLanguageName === languageName) {
|
|
159
|
-
description = ( localize('languageDescription', "({0}) - Configured Language", languageId));
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
description = ( localize('languageDescriptionConfigured', "({0})", languageId));
|
|
163
|
-
}
|
|
164
|
-
return {
|
|
165
|
-
label: languageName,
|
|
166
|
-
meta: extensions,
|
|
167
|
-
iconClasses: getIconClassesForLanguageId(languageId),
|
|
168
|
-
description
|
|
169
|
-
};
|
|
170
|
-
}));
|
|
171
|
-
picks.unshift({ type: 'separator', label: ( localize('languagesPicks', "languages (identifier)")) });
|
|
172
|
-
let configureLanguageAssociations;
|
|
173
|
-
let configureLanguageSettings;
|
|
174
|
-
let galleryAction;
|
|
175
|
-
if (hasLanguageSupport && resource) {
|
|
176
|
-
const ext = extname(resource) || basename(resource);
|
|
177
|
-
galleryAction = instantiationService.createInstance(ShowLanguageExtensionsAction, ext);
|
|
178
|
-
if (galleryAction.enabled) {
|
|
179
|
-
picks.unshift(galleryAction);
|
|
180
|
-
}
|
|
181
|
-
configureLanguageSettings = { label: ( localize(
|
|
182
|
-
'configureModeSettings',
|
|
183
|
-
"Configure '{0}' language based settings...",
|
|
184
|
-
currentLanguageName
|
|
185
|
-
)) };
|
|
186
|
-
picks.unshift(configureLanguageSettings);
|
|
187
|
-
configureLanguageAssociations = { label: ( localize('configureAssociationsExt', "Configure File Association for '{0}'...", ext)) };
|
|
188
|
-
picks.unshift(configureLanguageAssociations);
|
|
189
|
-
}
|
|
190
|
-
const autoDetectLanguage = {
|
|
191
|
-
label: ( localize('autoDetect', "Auto Detect"))
|
|
192
|
-
};
|
|
193
|
-
picks.unshift(autoDetectLanguage);
|
|
194
|
-
const pick = await quickInputService.pick(picks, { placeHolder: ( localize('pickLanguage', "Select Language Mode")), matchOnDescription: true });
|
|
195
|
-
if (!pick) {
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
if (pick === galleryAction) {
|
|
199
|
-
galleryAction.run();
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
if (pick === configureLanguageAssociations) {
|
|
203
|
-
if (resource) {
|
|
204
|
-
this.configureFileAssociation(resource, languageService, quickInputService, configurationService);
|
|
205
|
-
}
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
if (pick === configureLanguageSettings) {
|
|
209
|
-
preferencesService.openUserSettings({ jsonEditor: true, revealSetting: { key: `[${withUndefinedAsNull(currentLanguageId)}]`, edit: true } });
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
const activeEditor = editorService.activeEditor;
|
|
213
|
-
if (activeEditor) {
|
|
214
|
-
const languageSupport = toEditorWithLanguageSupport(activeEditor);
|
|
215
|
-
if (languageSupport) {
|
|
216
|
-
let languageSelection;
|
|
217
|
-
let detectedLanguage;
|
|
218
|
-
if (pick === autoDetectLanguage) {
|
|
219
|
-
if (textModel) {
|
|
220
|
-
const resource = EditorResourceAccessor.getOriginalUri(activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY });
|
|
221
|
-
if (resource) {
|
|
222
|
-
let languageId = withNullAsUndefined(languageService.guessLanguageIdByFilepathOrFirstLine(resource, textModel.getLineContent(1)));
|
|
223
|
-
if (!languageId || languageId === 'unknown') {
|
|
224
|
-
detectedLanguage = await languageDetectionService.detectLanguage(resource);
|
|
225
|
-
languageId = detectedLanguage;
|
|
226
|
-
}
|
|
227
|
-
if (languageId) {
|
|
228
|
-
languageSelection = languageService.createById(languageId);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
else {
|
|
234
|
-
const languageId = languageService.getLanguageIdByLanguageName(pick.label);
|
|
235
|
-
languageSelection = languageService.createById(languageId);
|
|
236
|
-
if (resource) {
|
|
237
|
-
languageDetectionService.detectLanguage(resource).then(detectedLanguageId => {
|
|
238
|
-
const chosenLanguageId = languageService.getLanguageIdByLanguageName(pick.label) || 'unknown';
|
|
239
|
-
if (detectedLanguageId === currentLanguageId && currentLanguageId !== chosenLanguageId) {
|
|
240
|
-
const modelPreference = configurationService.getValue('workbench.editor.preferHistoryBasedLanguageDetection') ? 'history' : 'classic';
|
|
241
|
-
telemetryService.publicLog2(AutomaticLanguageDetectionLikelyWrongId, {
|
|
242
|
-
currentLanguageId: currentLanguageName ?? 'unknown',
|
|
243
|
-
nextLanguageId: pick.label,
|
|
244
|
-
lineCount: textModel?.getLineCount() ?? -1,
|
|
245
|
-
modelPreference,
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
if (typeof languageSelection !== 'undefined') {
|
|
252
|
-
languageSupport.setLanguageId(languageSelection.languageId, ChangeLanguageAction.ID);
|
|
253
|
-
if (resource?.scheme === Schemas.untitled) {
|
|
254
|
-
const modelPreference = configurationService.getValue('workbench.editor.preferHistoryBasedLanguageDetection') ? 'history' : 'classic';
|
|
255
|
-
telemetryService.publicLog2('setUntitledDocumentLanguage', {
|
|
256
|
-
to: languageSelection.languageId,
|
|
257
|
-
from: currentLanguageId ?? 'none',
|
|
258
|
-
modelPreference,
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
activeTextEditorControl.focus();
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
configureFileAssociation(resource, languageService, quickInputService, configurationService) {
|
|
267
|
-
const extension = extname(resource);
|
|
268
|
-
const base = basename(resource);
|
|
269
|
-
const currentAssociation = languageService.guessLanguageIdByFilepathOrFirstLine(URI.file(base));
|
|
270
|
-
const languages = languageService.getSortedRegisteredLanguageNames();
|
|
271
|
-
const picks = ( languages.map(({ languageName, languageId }) => {
|
|
272
|
-
return {
|
|
273
|
-
id: languageId,
|
|
274
|
-
label: languageName,
|
|
275
|
-
iconClasses: getIconClassesForLanguageId(languageId),
|
|
276
|
-
description: (languageId === currentAssociation) ? ( localize('currentAssociation', "Current Association")) : undefined
|
|
277
|
-
};
|
|
278
|
-
}));
|
|
279
|
-
setTimeout(async () => {
|
|
280
|
-
const language = await quickInputService.pick(picks, { placeHolder: ( localize(
|
|
281
|
-
'pickLanguageToConfigure',
|
|
282
|
-
"Select Language Mode to Associate with '{0}'",
|
|
283
|
-
extension || base
|
|
284
|
-
)) });
|
|
285
|
-
if (language) {
|
|
286
|
-
const fileAssociationsConfig = configurationService.inspect(FILES_ASSOCIATIONS_CONFIG);
|
|
287
|
-
let associationKey;
|
|
288
|
-
if (extension && base[0] !== '.') {
|
|
289
|
-
associationKey = `*${extension}`;
|
|
290
|
-
}
|
|
291
|
-
else {
|
|
292
|
-
associationKey = base;
|
|
293
|
-
}
|
|
294
|
-
let target = 2 ;
|
|
295
|
-
if (fileAssociationsConfig.workspaceValue && !!fileAssociationsConfig.workspaceValue[associationKey]) {
|
|
296
|
-
target = 5 ;
|
|
297
|
-
}
|
|
298
|
-
const currentAssociations = deepClone(((target === 5) ) ? fileAssociationsConfig.workspaceValue : fileAssociationsConfig.userValue) || Object.create(null);
|
|
299
|
-
currentAssociations[associationKey] = language.id;
|
|
300
|
-
configurationService.updateValue(FILES_ASSOCIATIONS_CONFIG, currentAssociations, target);
|
|
301
|
-
}
|
|
302
|
-
}, 50 );
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
ChangeLanguageAction.ID = 'workbench.action.editor.changeLanguageMode';
|
|
306
|
-
class ChangeEOLAction extends Action2 {
|
|
307
|
-
constructor() {
|
|
308
|
-
super({
|
|
309
|
-
id: 'workbench.action.editor.changeEOL',
|
|
310
|
-
title: { value: ( localize('changeEndOfLine', "Change End of Line Sequence")), original: 'Change End of Line Sequence' },
|
|
311
|
-
f1: true
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
async run(accessor) {
|
|
315
|
-
const editorService = accessor.get(IEditorService);
|
|
316
|
-
const quickInputService = accessor.get(IQuickInputService);
|
|
317
|
-
const activeTextEditorControl = getCodeEditor(editorService.activeTextEditorControl);
|
|
318
|
-
if (!activeTextEditorControl) {
|
|
319
|
-
await quickInputService.pick([{ label: ( localize('noEditor', "No text editor active at this time")) }]);
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
if (editorService.activeEditor?.hasCapability(2 )) {
|
|
323
|
-
await quickInputService.pick([{ label: ( localize('noWritableCodeEditor', "The active code editor is read-only.")) }]);
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
let textModel = activeTextEditorControl.getModel();
|
|
327
|
-
const EOLOptions = [
|
|
328
|
-
{ label: nlsEOLLF, eol: 0 },
|
|
329
|
-
{ label: nlsEOLCRLF, eol: 1 },
|
|
330
|
-
];
|
|
331
|
-
const selectedIndex = (textModel?.getEOL() === '\n') ? 0 : 1;
|
|
332
|
-
const eol = await quickInputService.pick(EOLOptions, { placeHolder: ( localize('pickEndOfLine', "Select End of Line Sequence")), activeItem: EOLOptions[selectedIndex] });
|
|
333
|
-
if (eol) {
|
|
334
|
-
const activeCodeEditor = getCodeEditor(editorService.activeTextEditorControl);
|
|
335
|
-
if (activeCodeEditor?.hasModel() && !editorService.activeEditor?.hasCapability(2 )) {
|
|
336
|
-
textModel = activeCodeEditor.getModel();
|
|
337
|
-
textModel.pushStackElement();
|
|
338
|
-
textModel.pushEOL(eol.eol);
|
|
339
|
-
textModel.pushStackElement();
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
activeTextEditorControl.focus();
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
class ChangeEncodingAction extends Action2 {
|
|
346
|
-
constructor() {
|
|
347
|
-
super({
|
|
348
|
-
id: 'workbench.action.editor.changeEncoding',
|
|
349
|
-
title: { value: ( localize('changeEncoding', "Change File Encoding")), original: 'Change File Encoding' },
|
|
350
|
-
f1: true
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
async run(accessor) {
|
|
354
|
-
const editorService = accessor.get(IEditorService);
|
|
355
|
-
const quickInputService = accessor.get(IQuickInputService);
|
|
356
|
-
const fileService = accessor.get(IFileService);
|
|
357
|
-
const textFileService = accessor.get(ITextFileService);
|
|
358
|
-
const textResourceConfigurationService = accessor.get(ITextResourceConfigurationService);
|
|
359
|
-
const activeTextEditorControl = getCodeEditor(editorService.activeTextEditorControl);
|
|
360
|
-
if (!activeTextEditorControl) {
|
|
361
|
-
await quickInputService.pick([{ label: ( localize('noEditor', "No text editor active at this time")) }]);
|
|
362
|
-
return;
|
|
363
|
-
}
|
|
364
|
-
const activeEditorPane = editorService.activeEditorPane;
|
|
365
|
-
if (!activeEditorPane) {
|
|
366
|
-
await quickInputService.pick([{ label: ( localize('noEditor', "No text editor active at this time")) }]);
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
const encodingSupport = toEditorWithEncodingSupport(activeEditorPane.input);
|
|
370
|
-
if (!encodingSupport) {
|
|
371
|
-
await quickInputService.pick([{ label: ( localize('noFileEditor', "No file active at this time")) }]);
|
|
372
|
-
return;
|
|
373
|
-
}
|
|
374
|
-
const saveWithEncodingPick = { label: ( localize('saveWithEncoding', "Save with Encoding")) };
|
|
375
|
-
const reopenWithEncodingPick = { label: ( localize('reopenWithEncoding', "Reopen with Encoding")) };
|
|
376
|
-
if (!Language.isDefaultVariant()) {
|
|
377
|
-
const saveWithEncodingAlias = 'Save with Encoding';
|
|
378
|
-
if (saveWithEncodingAlias !== saveWithEncodingPick.label) {
|
|
379
|
-
saveWithEncodingPick.detail = saveWithEncodingAlias;
|
|
380
|
-
}
|
|
381
|
-
const reopenWithEncodingAlias = 'Reopen with Encoding';
|
|
382
|
-
if (reopenWithEncodingAlias !== reopenWithEncodingPick.label) {
|
|
383
|
-
reopenWithEncodingPick.detail = reopenWithEncodingAlias;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
let action;
|
|
387
|
-
if (encodingSupport instanceof UntitledTextEditorInput) {
|
|
388
|
-
action = saveWithEncodingPick;
|
|
389
|
-
}
|
|
390
|
-
else if (activeEditorPane.input.hasCapability(2 )) {
|
|
391
|
-
action = reopenWithEncodingPick;
|
|
392
|
-
}
|
|
393
|
-
else {
|
|
394
|
-
action = await quickInputService.pick([reopenWithEncodingPick, saveWithEncodingPick], { placeHolder: ( localize('pickAction', "Select Action")), matchOnDetail: true });
|
|
395
|
-
}
|
|
396
|
-
if (!action) {
|
|
397
|
-
return;
|
|
398
|
-
}
|
|
399
|
-
await timeout(50);
|
|
400
|
-
const resource = EditorResourceAccessor.getOriginalUri(activeEditorPane.input, { supportSideBySide: SideBySideEditor.PRIMARY });
|
|
401
|
-
if (!resource || (!fileService.hasProvider(resource) && resource.scheme !== Schemas.untitled)) {
|
|
402
|
-
return;
|
|
403
|
-
}
|
|
404
|
-
let guessedEncoding = undefined;
|
|
405
|
-
if (fileService.hasProvider(resource)) {
|
|
406
|
-
const content = await textFileService.readStream(resource, { autoGuessEncoding: true });
|
|
407
|
-
guessedEncoding = content.encoding;
|
|
408
|
-
}
|
|
409
|
-
const isReopenWithEncoding = (action === reopenWithEncodingPick);
|
|
410
|
-
const configuredEncoding = textResourceConfigurationService.getValue(withNullAsUndefined(resource), 'files.encoding');
|
|
411
|
-
let directMatchIndex;
|
|
412
|
-
let aliasMatchIndex;
|
|
413
|
-
const picks = ( ( Object.keys(SUPPORTED_ENCODINGS))
|
|
414
|
-
.sort((k1, k2) => {
|
|
415
|
-
if (k1 === configuredEncoding) {
|
|
416
|
-
return -1;
|
|
417
|
-
}
|
|
418
|
-
else if (k2 === configuredEncoding) {
|
|
419
|
-
return 1;
|
|
420
|
-
}
|
|
421
|
-
return SUPPORTED_ENCODINGS[k1].order - SUPPORTED_ENCODINGS[k2].order;
|
|
422
|
-
})
|
|
423
|
-
.filter(k => {
|
|
424
|
-
if (k === guessedEncoding && guessedEncoding !== configuredEncoding) {
|
|
425
|
-
return false;
|
|
426
|
-
}
|
|
427
|
-
return !isReopenWithEncoding || !SUPPORTED_ENCODINGS[k].encodeOnly;
|
|
428
|
-
})
|
|
429
|
-
.map((key, index) => {
|
|
430
|
-
if (key === encodingSupport.getEncoding()) {
|
|
431
|
-
directMatchIndex = index;
|
|
432
|
-
}
|
|
433
|
-
else if (SUPPORTED_ENCODINGS[key].alias === encodingSupport.getEncoding()) {
|
|
434
|
-
aliasMatchIndex = index;
|
|
435
|
-
}
|
|
436
|
-
return { id: key, label: SUPPORTED_ENCODINGS[key].labelLong, description: key };
|
|
437
|
-
}));
|
|
438
|
-
const items = picks.slice();
|
|
439
|
-
if (guessedEncoding && configuredEncoding !== guessedEncoding && SUPPORTED_ENCODINGS[guessedEncoding]) {
|
|
440
|
-
picks.unshift({ type: 'separator' });
|
|
441
|
-
picks.unshift({ id: guessedEncoding, label: SUPPORTED_ENCODINGS[guessedEncoding].labelLong, description: ( localize('guessedEncoding', "Guessed from content")) });
|
|
442
|
-
}
|
|
443
|
-
const encoding = await quickInputService.pick(picks, {
|
|
444
|
-
placeHolder: isReopenWithEncoding ? ( localize('pickEncodingForReopen', "Select File Encoding to Reopen File")) : ( localize('pickEncodingForSave', "Select File Encoding to Save with")),
|
|
445
|
-
activeItem: items[typeof directMatchIndex === 'number' ? directMatchIndex : typeof aliasMatchIndex === 'number' ? aliasMatchIndex : -1]
|
|
446
|
-
});
|
|
447
|
-
if (!encoding) {
|
|
448
|
-
return;
|
|
449
|
-
}
|
|
450
|
-
if (!editorService.activeEditorPane) {
|
|
451
|
-
return;
|
|
452
|
-
}
|
|
453
|
-
const activeEncodingSupport = toEditorWithEncodingSupport(editorService.activeEditorPane.input);
|
|
454
|
-
if (typeof encoding.id !== 'undefined' && activeEncodingSupport) {
|
|
455
|
-
await activeEncodingSupport.setEncoding(encoding.id, isReopenWithEncoding ? 1 : 0 );
|
|
456
|
-
}
|
|
457
|
-
activeTextEditorControl.focus();
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
export { ChangeEOLAction, ChangeEncodingAction, ChangeLanguageAction, ShowLanguageExtensionsAction };
|