Merge from vscode 91e99652cd5fcfc072387c64e151b435e39e8dcf (#6962)

This commit is contained in:
Anthony Dresser
2019-08-26 15:58:42 -07:00
committed by GitHub
parent edf470c8fa
commit 507bae90b7
103 changed files with 1743 additions and 1543 deletions

View File

@@ -768,7 +768,7 @@ class ReplDelegate implements IListVirtualDelegate<IReplElement> {
return (nameRows + 1) * rowHeight;
}
let valueRows = countNumberOfLines(value) + Math.floor(value.length / 150);
let valueRows = value ? (countNumberOfLines(value) + Math.floor(value.length / 150)) : 0;
return rowHeight * (nameRows + valueRows);
}

View File

@@ -27,6 +27,7 @@ import { IEditorGroupsService, IEditorGroup } from 'vs/workbench/services/editor
import { ResourceQueue, timeout } from 'vs/base/common/async';
import { onUnexpectedError } from 'vs/base/common/errors';
import { withNullAsUndefined } from 'vs/base/common/types';
import { EditorActivation } from 'vs/platform/editor/common/editor';
// {{SQL CARBON EDIT}}
import { QueryInput } from 'sql/workbench/parts/query/common/queryInput';
@@ -334,7 +335,7 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut
// Binary editor that should reload from event
if (resource && editor.input && isBinaryEditor && (e.contains(resource, FileChangeType.UPDATED) || e.contains(resource, FileChangeType.ADDED))) {
this.editorService.openEditor(editor.input, { forceReload: true, preserveFocus: true }, editor.group);
this.editorService.openEditor(editor.input, { forceReload: true, preserveFocus: true, activation: EditorActivation.PRESERVE }, editor.group);
}
});
}

View File

@@ -32,6 +32,7 @@ import { CancellationToken } from 'vs/base/common/cancellation';
import { IEditorGroupView } from 'vs/workbench/browser/parts/editor/editor';
import { createErrorWithActions } from 'vs/base/common/errorsWithActions';
import { MutableDisposable } from 'vs/base/common/lifecycle';
import { EditorActivation } from 'vs/platform/editor/common/editor';
/**
* An implementation of editor for file system resources.
@@ -225,6 +226,13 @@ export class TextFileEditor extends BaseTextEditor {
private openAsBinary(input: FileEditorInput, options: EditorOptions): void {
input.setForceOpenAsBinary();
// Make sure to not steal away the currently active group
// because we are triggering another openEditor() call
// and do not control the initial intent that resulted
// in us now opening as binary.
options.overwrite({ activation: EditorActivation.PRESERVE });
this.editorService.openEditor(input, options, this.group);
}

View File

@@ -26,10 +26,9 @@ import { Disposable } from 'vs/base/common/lifecycle';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
import { DelegatingEditorService } from 'vs/workbench/services/editor/browser/editorService';
import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IEditorOptions } from 'vs/platform/editor/common/editor';
import { IEditorInput, IEditor } from 'vs/workbench/common/editor';
import { IEditor } from 'vs/workbench/common/editor';
import { ViewletPanel } from 'vs/workbench/browser/parts/views/panelViewlet';
import { KeyChord, KeyMod, KeyCode } from 'vs/base/common/keyCodes';
import { Registry } from 'vs/platform/registry/common/platform';
@@ -158,7 +157,6 @@ export class ExplorerViewlet extends ViewContainerViewlet {
@ITelemetryService telemetryService: ITelemetryService,
@IWorkspaceContextService protected contextService: IWorkspaceContextService,
@IStorageService protected storageService: IStorageService,
@IEditorService private readonly editorService: IEditorService,
@IEditorGroupsService private readonly editorGroupService: IEditorGroupsService,
@IConfigurationService configurationService: IConfigurationService,
@IInstantiationService protected instantiationService: IInstantiationService,
@@ -187,7 +185,7 @@ export class ExplorerViewlet extends ViewContainerViewlet {
// We try to be smart and only use the delay if we recognize that the user action is likely to cause
// a new entry in the opened editors view.
const delegatingEditorService = this.instantiationService.createInstance(DelegatingEditorService);
delegatingEditorService.setEditorOpenHandler(async (group: IEditorGroup, editor: IEditorInput, options?: IEditorOptions): Promise<IEditor | null> => {
delegatingEditorService.setEditorOpenHandler(async (delegate, group, editor, options): Promise<IEditor | null> => {
let openEditorsView = this.getOpenEditorsView();
if (openEditorsView) {
let delay = 0;
@@ -205,7 +203,7 @@ export class ExplorerViewlet extends ViewContainerViewlet {
let openedEditor: IEditor | undefined;
try {
openedEditor = await this.editorService.openEditor(editor, options, group);
openedEditor = await delegate(group, editor, options);
} catch (error) {
// ignore
} finally {

View File

@@ -244,23 +244,23 @@ async function saveAll(saveAllArguments: any, editorService: IEditorService, unt
// Store some properties per untitled file to restore later after save is completed
const groupIdToUntitledResourceInput = new Map<number, IResourceInput[]>();
editorGroupService.groups.forEach(g => {
const activeEditorResource = g.activeEditor && g.activeEditor.getResource();
g.editors.forEach(e => {
editorGroupService.groups.forEach(group => {
const activeEditorResource = group.activeEditor && group.activeEditor.getResource();
group.editors.forEach(e => {
const resource = e.getResource();
if (resource && untitledEditorService.isDirty(resource)) {
if (!groupIdToUntitledResourceInput.has(g.id)) {
groupIdToUntitledResourceInput.set(g.id, []);
if (!groupIdToUntitledResourceInput.has(group.id)) {
groupIdToUntitledResourceInput.set(group.id, []);
}
groupIdToUntitledResourceInput.get(g.id)!.push({
groupIdToUntitledResourceInput.get(group.id)!.push({
encoding: untitledEditorService.getEncoding(resource),
resource,
options: {
inactive: activeEditorResource ? activeEditorResource.toString() !== resource.toString() : true,
pinned: true,
preserveFocus: true,
index: g.getIndexOfEditor(e)
index: group.getIndexOfEditor(e)
}
});
}

View File

@@ -241,8 +241,7 @@ export class ExplorerView extends ViewletPanel {
const activeFile = this.getActiveFile();
if (!activeFile && !focused[0].isDirectory) {
// Open the focused element in the editor if there is currently no file opened #67708
this.editorService.openEditor({ resource: focused[0].resource, options: { preserveFocus: true, revealIfVisible: true } })
.then(undefined, onUnexpectedError);
this.editorService.openEditor({ resource: focused[0].resource, options: { preserveFocus: true, revealIfVisible: true } });
}
}
}

View File

@@ -28,7 +28,7 @@ import { IListVirtualDelegate, IListRenderer, IListContextMenuEvent, IListDragAn
import { ResourceLabels, IResourceLabel } from 'vs/workbench/browser/labels';
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IEditorService, SIDE_GROUP, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService';
import { IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { createAndFillInContextMenuActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
import { IMenuService, MenuId, IMenu } from 'vs/platform/actions/common/actions';
@@ -263,15 +263,21 @@ export class OpenEditorsView extends ViewletPanel {
let openToSide = false;
let isSingleClick = false;
let isDoubleClick = false;
let isMiddleClick = false;
if (browserEvent instanceof MouseEvent) {
isSingleClick = browserEvent.detail === 1;
isDoubleClick = browserEvent.detail === 2;
isMiddleClick = browserEvent.button === 1;
openToSide = this.list.useAltAsMultipleSelectionModifier ? (browserEvent.ctrlKey || browserEvent.metaKey) : browserEvent.altKey;
}
const focused = this.list.getFocusedElements();
const element = focused.length ? focused[0] : undefined;
if (element instanceof OpenEditor) {
if (isMiddleClick) {
return; // already handled above: closes the editor
}
this.openEditor(element, { preserveFocus: isSingleClick, pinned: isDoubleClick, sideBySide: openToSide });
} else if (element) {
this.editorGroupService.activateGroup(element);
@@ -349,13 +355,9 @@ export class OpenEditorsView extends ViewletPanel {
const preserveActivateGroup = options.sideBySide && options.preserveFocus; // needed for https://github.com/Microsoft/vscode/issues/42399
if (!preserveActivateGroup) {
this.editorGroupService.activateGroup(element.groupId); // needed for https://github.com/Microsoft/vscode/issues/6672
this.editorGroupService.activateGroup(element.group); // needed for https://github.com/Microsoft/vscode/issues/6672
}
this.editorService.openEditor(element.editor, options, options.sideBySide ? SIDE_GROUP : ACTIVE_GROUP).then(editor => {
if (editor && !preserveActivateGroup && editor.group) {
this.editorGroupService.activateGroup(editor.group);
}
});
this.editorService.openEditor(element.editor, options, options.sideBySide ? SIDE_GROUP : element.group);
}
}

View File

@@ -15,7 +15,7 @@ import { URI } from 'vs/base/common/uri';
import { IActivityService, NumberBadge } from 'vs/workbench/services/activity/common/activity';
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
import * as arrays from 'vs/base/common/arrays';
import { IEditorService, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
export class DirtyFilesTracker extends Disposable implements IWorkbenchContribution {
private isDocumentedEdited: boolean;
@@ -88,7 +88,6 @@ export class DirtyFilesTracker extends Disposable implements IWorkbenchContribut
}
private doOpenDirtyResources(resources: URI[]): void {
const activeEditor = this.editorService.activeControl;
// Open
this.editorService.openEditors(resources.map(resource => {
@@ -96,7 +95,7 @@ export class DirtyFilesTracker extends Disposable implements IWorkbenchContribut
resource,
options: { inactive: true, pinned: true, preserveFocus: true }
};
}), activeEditor ? activeEditor.group : ACTIVE_GROUP);
}));
}
private onTextFilesSaved(e: TextFileModelChangeEvent[]): void {

View File

@@ -46,6 +46,7 @@ import { attachStylerCallback, attachInputBoxStyler } from 'vs/platform/theme/co
import { IStorageService } from 'vs/platform/storage/common/storage';
import { InputBox, MessageType } from 'vs/base/browser/ui/inputbox/inputBox';
import { Emitter, Event } from 'vs/base/common/event';
import { MenuRegistry, MenuId, isIMenuItem } from 'vs/platform/actions/common/actions';
const $ = DOM.$;
@@ -489,11 +490,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
if (this.input) {
const input: KeybindingsEditorInput = this.input as KeybindingsEditorInput;
this.keybindingsEditorModel = await input.resolve();
const editorActionsLabels: Map<string, string> = EditorExtensionsRegistry.getEditorActions().reduce((editorActions, editorAction) => {
editorActions.set(editorAction.id, editorAction.label);
return editorActions;
}, new Map<string, string>());
await this.keybindingsEditorModel.resolve(editorActionsLabels);
await this.keybindingsEditorModel.resolve(this.getActionsLabels());
this.renderKeybindingsEntries(false, preserveFocus);
if (input.searchOptions) {
this.recordKeysAction.checked = input.searchOptions.recordKeybindings;
@@ -505,6 +502,19 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
}
}
private getActionsLabels(): Map<string, string> {
const actionsLabels: Map<string, string> = new Map<string, string>();
EditorExtensionsRegistry.getEditorActions().forEach(editorAction => actionsLabels.set(editorAction.id, editorAction.label));
for (const menuItem of MenuRegistry.getMenuItems(MenuId.CommandPalette)) {
if (isIMenuItem(menuItem)) {
const title = typeof menuItem.command.title === 'string' ? menuItem.command.title : menuItem.command.title.value;
const category = menuItem.command.category ? typeof menuItem.command.category === 'string' ? menuItem.command.category : menuItem.command.category.value : undefined;
actionsLabels.set(menuItem.command.id, category ? `${category}: ${title}` : title);
}
}
return actionsLabels;
}
private filterKeybindings(): void {
this.renderKeybindingsEntries(this.searchWidget.hasFocus());
this.delayedFilterLogging.trigger(() => this.reportFilteringUsed(this.searchWidget.getValue()));
@@ -716,7 +726,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
private createCopyCommandAction(keybinding: IKeybindingItemEntry): IAction {
return <IAction>{
label: localize('copyCommandLabel', "Copy Command"),
label: localize('copyCommandLabel', "Copy Command ID"),
enabled: true,
id: KEYBINDINGS_EDITOR_COMMAND_COPY_COMMAND,
run: () => this.copyKeybindingCommand(keybinding)

View File

@@ -87,8 +87,10 @@ class GotoLineEntry extends EditorQuickOpenEntry {
private parseInput(line: string) {
const numbers = line.split(/,|:|#/).map(part => parseInt(part, 10)).filter(part => !isNaN(part));
this.line = numbers[0];
const endLine = this.getMaxLineNumber() + 1;
this.column = numbers[1];
this.line = numbers[0] > 0 ? numbers[0] : endLine + numbers[0];
}
getLabel(): string {
@@ -113,7 +115,7 @@ class GotoLineEntry extends EditorQuickOpenEntry {
}
private invalidRange(maxLineNumber: number = this.getMaxLineNumber()): boolean {
return !this.line || !types.isNumber(this.line) || (maxLineNumber > 0 && types.isNumber(this.line) && this.line > maxLineNumber);
return !this.line || !types.isNumber(this.line) || (maxLineNumber > 0 && types.isNumber(this.line) && this.line > maxLineNumber) || this.line < 0;
}
private getMaxLineNumber(): number {

View File

@@ -17,7 +17,7 @@ import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
import { ITextEditorOptions } from 'vs/platform/editor/common/editor';
import { getDocumentSymbols } from 'vs/editor/contrib/quickOpen/quickOpen';
import { DocumentSymbolProviderRegistry, DocumentSymbol, symbolKindToCssClass, SymbolKind, SymbolTag } from 'vs/editor/common/modes';
import { IRange } from 'vs/editor/common/core/range';
import { IRange, Range } from 'vs/editor/common/core/range';
import { themeColorFromId } from 'vs/platform/theme/common/themeService';
import { overviewRulerRangeHighlight } from 'vs/editor/common/view/editorColorRegistry';
import { GroupIdentifier, IEditorInput } from 'vs/workbench/common/editor';
@@ -88,7 +88,7 @@ class OutlineModel extends QuickOpenModel {
// Filter by search
if (searchValue.length > searchValuePos) {
const score = filters.fuzzyScore(
searchValue.substr(searchValuePos), searchValueLow.substr(searchValuePos), 0,
searchValue, searchValueLow, searchValuePos,
entry.getLabel(), entry.getLabel().toLowerCase(), 0,
true
);
@@ -219,7 +219,7 @@ class SymbolEntry extends EditorQuickOpenEntryGroup {
getOptions(pinned?: boolean): ITextEditorOptions {
return {
selection: this.revealRange,
selection: Range.collapseToStart(this.revealRange),
pinned
};
}
@@ -242,7 +242,7 @@ class SymbolEntry extends EditorQuickOpenEntryGroup {
// Apply selection and focus
else {
const range = this.revealRange;
const range = Range.collapseToStart(this.revealRange);
const activeTextEditorWidget = this.editorService.activeTextEditorWidget;
if (activeTextEditorWidget) {
activeTextEditorWidget.setSelection(range);
@@ -256,7 +256,7 @@ class SymbolEntry extends EditorQuickOpenEntryGroup {
private runPreview(): boolean {
// Select Outline Position
const range = this.revealRange;
const range = Range.collapseToStart(this.revealRange);
const activeTextEditorWidget = this.editorService.activeTextEditorWidget;
if (activeTextEditorWidget) {
activeTextEditorWidget.revealRangeInCenter(range, ScrollType.Smooth);

View File

@@ -52,7 +52,6 @@ import { IReplaceService } from 'vs/workbench/contrib/search/common/replace';
import { getOutOfWorkspaceEditorResources } from 'vs/workbench/contrib/search/common/search';
import { FileMatch, FileMatchOrMatch, FolderMatch, IChangeEvent, ISearchWorkbenchService, Match, RenderableMatch, searchMatchComparer, SearchModel, SearchResult, BaseFolderMatch } from 'vs/workbench/contrib/search/common/searchModel';
import { ACTIVE_GROUP, IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService';
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IPreferencesService, ISettingsEditorOptions } from 'vs/workbench/services/preferences/common/preferences';
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { relativePath } from 'vs/base/common/resources';
@@ -148,7 +147,6 @@ export class SearchView extends ViewletPanel {
@IPreferencesService private readonly preferencesService: IPreferencesService,
@IThemeService protected themeService: IThemeService,
@ISearchHistoryService private readonly searchHistoryService: ISearchHistoryService,
@IEditorGroupsService private readonly editorGroupsService: IEditorGroupsService,
@IContextMenuService contextMenuService: IContextMenuService,
@IMenuService private readonly menuService: IMenuService,
@IAccessibilityService private readonly accessibilityService: IAccessibilityService,
@@ -1570,10 +1568,6 @@ export class SearchView extends ViewletPanel {
} else {
this.viewModel.searchResult.rangeHighlightDecorations.removeHighlightRange();
}
if (editor) {
this.editorGroupsService.activateGroup(editor.group!);
}
}, errors.onUnexpectedError);
}

View File

@@ -98,7 +98,7 @@ const presentation: IJSONSchema = {
showReuseMessage: true,
clear: false,
},
description: nls.localize('JsonSchema.tasks.presentation', 'Configures the panel that is used to present the task\'s ouput and reads its input.'),
description: nls.localize('JsonSchema.tasks.presentation', 'Configures the panel that is used to present the task\'s output and reads its input.'),
additionalProperties: false,
properties: {
echo: {

View File

@@ -17,6 +17,10 @@ import { Emitter, Event } from 'vs/base/common/event';
import { basename } from 'vs/base/common/path';
import { IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement';
import { ExtensionType } from 'vs/platform/extensions/common/extensions';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { InstallRecommendedExtensionAction } from 'vs/workbench/contrib/extensions/browser/extensionsActions';
import { IProductService } from 'vs/platform/product/common/product';
const MINIMUM_FONT_SIZE = 6;
const MAXIMUM_FONT_SIZE = 25;
@@ -40,7 +44,10 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper {
@IConfigurationService private readonly _configurationService: IConfigurationService,
@IExtensionManagementService private readonly _extensionManagementService: IExtensionManagementService,
@INotificationService private readonly _notificationService: INotificationService,
@IStorageService private readonly _storageService: IStorageService
@IStorageService private readonly _storageService: IStorageService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IProductService private readonly productService: IProductService
) {
this._updateConfig();
this._configurationService.onDidChangeConfiguration(e => {
@@ -263,18 +270,42 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper {
this.recommendationsShown = true;
if (platform.isWindows && shellLaunchConfig.executable && basename(shellLaunchConfig.executable).toLowerCase() === 'wsl.exe') {
if (! await this.isExtensionInstalled('ms-vscode-remote.remote-wsl')) {
const exeBasedExtensionTips = this.productService.exeBasedExtensionTips;
if (!exeBasedExtensionTips || !exeBasedExtensionTips.wsl) {
return;
}
const extId = exeBasedExtensionTips.wsl.recommendations[0];
if (extId && ! await this.isExtensionInstalled(extId)) {
this._notificationService.prompt(
Severity.Info,
nls.localize(
'useWslExtension.title',
"Check out the 'Visual Studio Code Remote - WSL' extension for a great development experience in WSL. Click [here]({0}) to learn more.",
'https://go.microsoft.com/fwlink/?linkid=2097212'
),
[],
'useWslExtension.title', "The '{0}' extension is recommended for opening a terminal in WSL.", exeBasedExtensionTips.wsl.friendlyName),
[
{
label: nls.localize('install', 'Install'),
run: () => {
/* __GDPR__
"terminalLaunchRecommendation:popup" : {
"userReaction" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"extensionId": { "classification": "PublicNonPersonalData", "purpose": "FeatureInsight" }
}
*/
this.telemetryService.publicLog('terminalLaunchRecommendation:popup', { userReaction: 'install', extId });
this.instantiationService.createInstance(InstallRecommendedExtensionAction, extId).run();
}
}
],
{
sticky: true,
neverShowAgain: { id: 'terminalConfigHelper/launchRecommendationsIgnore', scope: NeverShowAgainScope.WORKSPACE }
neverShowAgain: { id: 'terminalConfigHelper/launchRecommendationsIgnore', scope: NeverShowAgainScope.WORKSPACE },
onCancel: () => {
/* __GDPR__
"terminalLaunchRecommendation:popup" : {
"userReaction" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
}
*/
this.telemetryService.publicLog('terminalLaunchRecommendation:popup', { userReaction: 'cancelled' });
}
}
);
}

View File

@@ -29,7 +29,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk
const configurationService = new TestConfigurationService();
configurationService.setUserConfiguration('editor', { fontFamily: 'foo' });
configurationService.setUserConfiguration('terminal', { integrated: { fontFamily: null } });
const configHelper = new TerminalConfigHelper(LinuxDistro.Fedora, configurationService, null!, null!, null!);
const configHelper = new TerminalConfigHelper(LinuxDistro.Fedora, configurationService, null!, null!, null!, null!, null!, null!);
configHelper.panelContainer = fixture;
assert.equal(configHelper.getFont().fontFamily, '\'DejaVu Sans Mono\', monospace', 'Fedora should have its font overridden when terminal.integrated.fontFamily not set');
});
@@ -38,7 +38,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk
const configurationService = new TestConfigurationService();
configurationService.setUserConfiguration('editor', { fontFamily: 'foo' });
configurationService.setUserConfiguration('terminal', { integrated: { fontFamily: null } });
const configHelper = new TerminalConfigHelper(LinuxDistro.Ubuntu, configurationService, null!, null!, null!);
const configHelper = new TerminalConfigHelper(LinuxDistro.Ubuntu, configurationService, null!, null!, null!, null!, null!, null!);
configHelper.panelContainer = fixture;
assert.equal(configHelper.getFont().fontFamily, '\'Ubuntu Mono\', monospace', 'Ubuntu should have its font overridden when terminal.integrated.fontFamily not set');
});
@@ -47,7 +47,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk
const configurationService = new TestConfigurationService();
configurationService.setUserConfiguration('editor', { fontFamily: 'foo' });
configurationService.setUserConfiguration('terminal', { integrated: { fontFamily: null } });
const configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!);
const configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!);
configHelper.panelContainer = fixture;
assert.equal(configHelper.getFont().fontFamily, 'foo', 'editor.fontFamily should be the fallback when terminal.integrated.fontFamily not set');
});
@@ -65,7 +65,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk
fontSize: 10
}
});
let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!);
let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!);
configHelper.panelContainer = fixture;
assert.equal(configHelper.getFont().fontSize, 10, 'terminal.integrated.fontSize should be selected over editor.fontSize');
@@ -78,11 +78,11 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk
fontSize: 0
}
});
configHelper = new TerminalConfigHelper(LinuxDistro.Ubuntu, configurationService, null!, null!, null!);
configHelper = new TerminalConfigHelper(LinuxDistro.Ubuntu, configurationService, null!, null!, null!, null!, null!, null!);
configHelper.panelContainer = fixture;
assert.equal(configHelper.getFont().fontSize, 8, 'The minimum terminal font size (with adjustment) should be used when terminal.integrated.fontSize less than it');
configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!);
configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!);
configHelper.panelContainer = fixture;
assert.equal(configHelper.getFont().fontSize, 6, 'The minimum terminal font size should be used when terminal.integrated.fontSize less than it');
@@ -95,7 +95,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk
fontSize: 1500
}
});
configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!);
configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!);
configHelper.panelContainer = fixture;
assert.equal(configHelper.getFont().fontSize, 25, 'The maximum terminal font size should be used when terminal.integrated.fontSize more than it');
@@ -108,11 +108,11 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk
fontSize: null
}
});
configHelper = new TerminalConfigHelper(LinuxDistro.Ubuntu, configurationService, null!, null!, null!);
configHelper = new TerminalConfigHelper(LinuxDistro.Ubuntu, configurationService, null!, null!, null!, null!, null!, null!);
configHelper.panelContainer = fixture;
assert.equal(configHelper.getFont().fontSize, EDITOR_FONT_DEFAULTS.fontSize + 2, 'The default editor font size (with adjustment) should be used when terminal.integrated.fontSize is not set');
configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!);
configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!);
configHelper.panelContainer = fixture;
assert.equal(configHelper.getFont().fontSize, EDITOR_FONT_DEFAULTS.fontSize, 'The default editor font size should be used when terminal.integrated.fontSize is not set');
});
@@ -130,7 +130,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk
lineHeight: 2
}
});
let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!);
let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!);
configHelper.panelContainer = fixture;
assert.equal(configHelper.getFont().lineHeight, 2, 'terminal.integrated.lineHeight should be selected over editor.lineHeight');
@@ -144,7 +144,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk
lineHeight: 0
}
});
configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!);
configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!);
configHelper.panelContainer = fixture;
assert.equal(configHelper.getFont().lineHeight, 1, 'editor.lineHeight should be 1 when terminal.integrated.lineHeight not set');
});
@@ -157,7 +157,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk
}
});
let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!);
let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!);
configHelper.panelContainer = fixture;
assert.equal(configHelper.configFontIsMonospace(), true, 'monospace is monospaced');
});
@@ -169,7 +169,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk
fontFamily: 'sans-serif'
}
});
let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!);
let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!);
configHelper.panelContainer = fixture;
assert.equal(configHelper.configFontIsMonospace(), false, 'sans-serif is not monospaced');
});
@@ -181,7 +181,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk
fontFamily: 'serif'
}
});
let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!);
let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!);
configHelper.panelContainer = fixture;
assert.equal(configHelper.configFontIsMonospace(), false, 'serif is not monospaced');
});
@@ -197,7 +197,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk
}
});
let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!);
let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!);
configHelper.panelContainer = fixture;
assert.equal(configHelper.configFontIsMonospace(), true, 'monospace is monospaced');
});
@@ -213,7 +213,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk
}
});
let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!);
let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!);
configHelper.panelContainer = fixture;
assert.equal(configHelper.configFontIsMonospace(), false, 'sans-serif is not monospaced');
});
@@ -229,7 +229,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk
}
});
let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!);
let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!);
configHelper.panelContainer = fixture;
assert.equal(configHelper.configFontIsMonospace(), false, 'serif is not monospaced');
});

View File

@@ -122,7 +122,7 @@ export class ProductContribution implements IWorkbenchContribution {
@IStorageService storageService: IStorageService,
@IInstantiationService instantiationService: IInstantiationService,
@INotificationService notificationService: INotificationService,
@IEnvironmentService environmentService: IEnvironmentService,
@IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService,
@IOpenerService openerService: IOpenerService,
@IConfigurationService configurationService: IConfigurationService,
@IWindowService windowService: IWindowService,

View File

@@ -7,7 +7,7 @@ import { Emitter } from 'vs/base/common/event';
import { URI } from 'vs/base/common/uri';
import { Webview, WebviewContentOptions, WebviewOptions } from 'vs/workbench/contrib/webview/browser/webview';
import { IThemeService, ITheme } from 'vs/platform/theme/common/themeService';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IFileService } from 'vs/platform/files/common/files';
import { Disposable } from 'vs/base/common/lifecycle';
import { areWebviewInputOptionsEqual } from 'vs/workbench/contrib/webview/browser/webviewEditorService';
@@ -40,14 +40,14 @@ export class IFrameWebview extends Disposable implements Webview {
contentOptions: WebviewContentOptions,
@IThemeService themeService: IThemeService,
@ITunnelService tunnelService: ITunnelService,
@IEnvironmentService private readonly environmentService: IEnvironmentService,
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
@IFileService private readonly fileService: IFileService,
@IConfigurationService private readonly _configurationService: IConfigurationService,
) {
super();
const useExternalEndpoint = this._configurationService.getValue<string>('webview.experimental.useExternalEndpoint');
if (typeof environmentService.webviewEndpoint !== 'string' && !useExternalEndpoint) {
if (!useExternalEndpoint && (!environmentService.options || typeof environmentService.options.webviewEndpoint !== 'string')) {
throw new Error('To use iframe based webviews, you must configure `environmentService.webviewEndpoint`');
}
@@ -145,7 +145,7 @@ export class IFrameWebview extends Disposable implements Webview {
private get endpoint(): string {
const useExternalEndpoint = this._configurationService.getValue<string>('webview.experimental.useExternalEndpoint');
const baseEndpoint = useExternalEndpoint ? 'https://{{uuid}}.vscode-webview-test.com/8fa811108f0f0524c473020ef57b6620f6c201e1' : this.environmentService.webviewEndpoint!;
const baseEndpoint = useExternalEndpoint ? 'https://{{uuid}}.vscode-webview-test.com/8fa811108f0f0524c473020ef57b6620f6c201e1' : this.environmentService.options!.webviewEndpoint!;
const endpoint = baseEndpoint.replace('{{uuid}}', this.id);
if (endpoint[endpoint.length - 1] === '/') {
return endpoint.slice(0, endpoint.length - 1);

View File

@@ -6,7 +6,7 @@
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { ITelemetryService, ITelemetryInfo } from 'vs/platform/telemetry/common/telemetry';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import * as platform from 'vs/base/common/platform';
import product from 'vs/platform/product/node/product';
import { IOpenerService } from 'vs/platform/opener/common/opener';
@@ -21,7 +21,7 @@ export class GettingStarted implements IWorkbenchContribution {
constructor(
@IStorageService private readonly storageService: IStorageService,
@IEnvironmentService environmentService: IEnvironmentService,
@IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
@IOpenerService private readonly openerService: IOpenerService
) {