Revert "Merge from vscode ada4bddb8edc69eea6ebaaa0e88c5f903cbd43d8 (#5529)" (#5553)

This reverts commit 5d44b6a6a7.
This commit is contained in:
Anthony Dresser
2019-05-20 17:07:32 -07:00
committed by GitHub
parent 1315b8e42a
commit c9a4f8f664
325 changed files with 3332 additions and 4501 deletions

View File

@@ -19,7 +19,7 @@ import { KeyMod, KeyCode, KeyChord } from 'vs/base/common/keyCodes';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import { MenuBarVisibility } from 'vs/platform/windows/common/windows';
import { isWindows, isLinux } from 'vs/base/common/platform';
import { IsMacContext } from 'vs/workbench/browser/contextkeys';
import { IsMacContext } from 'vs/workbench/common/contextkeys';
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { InEditorZenModeContext } from 'vs/workbench/common/editor';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { IAction, IActionRunner, ActionRunner } from 'vs/base/common/actions';
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { Component } from 'vs/workbench/common/component';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IComposite, ICompositeControl } from 'vs/workbench/common/composite';
@@ -170,12 +170,12 @@ export abstract class Composite extends Component implements IComposite {
}
/**
* For any of the actions returned by this composite, provide an IActionViewItem in
* For any of the actions returned by this composite, provide an IActionItem in
* cases where the implementor of the composite wants to override the presentation
* of an action. Returns undefined to indicate that the action is not rendered through
* an action item.
*/
getActionViewItem(action: IAction): IActionViewItem | undefined {
getActionItem(action: IAction): IActionItem | undefined {
return undefined;
}

View File

@@ -5,10 +5,11 @@
import { Event } from 'vs/base/common/event';
import { Disposable } from 'vs/base/common/lifecycle';
import { IContextKeyService, IContextKey, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { InputFocusedContext } from 'vs/platform/contextkey/common/contextkeys';
import { IWindowsConfiguration } from 'vs/platform/windows/common/windows';
import { ActiveEditorContext, EditorsVisibleContext, TextCompareEditorVisibleContext, TextCompareEditorActiveContext, ActiveEditorGroupEmptyContext, MultipleEditorGroupsContext, TEXT_DIFF_EDITOR_ID, SplitEditorsVertically, InEditorZenModeContext } from 'vs/workbench/common/editor';
import { IsMacContext, IsLinuxContext, IsWindowsContext, HasMacNativeTabsContext, IsDevelopmentContext, SupportsWorkspacesContext, WorkbenchStateContext, WorkspaceFolderCountContext, RemoteAuthorityContext } from 'vs/workbench/common/contextkeys';
import { trackFocus, addDisposableListener, EventType } from 'vs/base/browser/dom';
import { preferredSideBySideGroupDirection, GroupDirection, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
@@ -18,25 +19,6 @@ import { WorkbenchState, IWorkspaceContextService } from 'vs/platform/workspace/
import { SideBarVisibleContext } from 'vs/workbench/common/viewlet';
import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { isMacintosh, isLinux, isWindows } from 'vs/base/common/platform';
export const IsMacContext = new RawContextKey<boolean>('isMac', isMacintosh);
export const IsLinuxContext = new RawContextKey<boolean>('isLinux', isLinux);
export const IsWindowsContext = new RawContextKey<boolean>('isWindows', isWindows);
export const RemoteAuthorityContext = new RawContextKey<string>('remoteAuthority', '');
export const HasMacNativeTabsContext = new RawContextKey<boolean>('hasMacNativeTabs', false);
export const SupportsWorkspacesContext = new RawContextKey<boolean>('supportsWorkspaces', true);
export const IsDevelopmentContext = new RawContextKey<boolean>('isDevelopment', false);
export const WorkbenchStateContext = new RawContextKey<string>('workbenchState', undefined);
export const WorkspaceFolderCountContext = new RawContextKey<number>('workspaceFolderCount', 0);
export const RemoteFileDialogContext = new RawContextKey<boolean>('remoteFileDialogVisible', false);
export class WorkbenchContextKeysHandler extends Disposable {
private inputFocusedContext: IContextKey<boolean>;

View File

@@ -30,7 +30,6 @@ import { addDisposableListener, EventType } from 'vs/base/browser/dom';
import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IRecentFile } from 'vs/platform/history/common/history';
import { IWorkspaceEditingService } from 'vs/workbench/services/workspace/common/workspaceEditing';
import { withNullAsUndefined } from 'vs/base/common/types';
export interface IDraggedResource {
resource: URI;
@@ -82,12 +81,7 @@ export function extractResources(e: DragEvent, externalOnly?: boolean): Array<ID
try {
const draggedEditors: ISerializedDraggedEditor[] = JSON.parse(rawEditorsData);
draggedEditors.forEach(draggedEditor => {
resources.push({
resource: URI.parse(draggedEditor.resource),
backupResource: draggedEditor.backupResource ? URI.parse(draggedEditor.backupResource) : undefined,
viewState: withNullAsUndefined(draggedEditor.viewState),
isExternal: false
});
resources.push({ resource: URI.parse(draggedEditor.resource), backupResource: draggedEditor.backupResource ? URI.parse(draggedEditor.backupResource) : undefined, viewState: draggedEditor.viewState, isExternal: false });
});
} catch (error) {
// Invalid transfer
@@ -246,7 +240,7 @@ export class ResourcesDropHandler {
return this.backupFileService.resolveBackupContent(droppedDirtyEditor.backupResource!).then(content => {
// Set the contents of to the resource to the target
return this.backupFileService.backupResource(droppedDirtyEditor.resource, content.value.create(this.getDefaultEOL()).createSnapshot(true));
return this.backupFileService.backupResource(droppedDirtyEditor.resource, content!.create(this.getDefaultEOL()).createSnapshot(true));
}).then(() => false, () => false /* ignore any error */);
}

View File

@@ -77,7 +77,7 @@ export class EditorDescriptor implements IEditorDescriptor {
}
describes(obj: unknown): boolean {
return obj instanceof BaseEditor && obj.getId() === this.id;
return obj instanceof BaseEditor && (<BaseEditor>obj).getId() === this.id;
}
}
@@ -108,7 +108,7 @@ class EditorRegistry implements IEditorRegistry {
const matchingDescriptors: EditorDescriptor[] = [];
for (const editor of this.editors) {
const inputDescriptors: SyncDescriptor<EditorInput>[] = editor[INPUT_DESCRIPTORS_PROPERTY];
const inputDescriptors = <SyncDescriptor<EditorInput>[]>editor[INPUT_DESCRIPTORS_PROPERTY];
for (const inputDescriptor of inputDescriptors) {
const inputClass = inputDescriptor.ctor;

View File

@@ -21,7 +21,7 @@ import { ITextModel } from 'vs/editor/common/model';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { Event, Emitter } from 'vs/base/common/event';
import { ILabelService } from 'vs/platform/label/common/label';
import { getIconClasses, detectModeId } from 'vs/editor/common/services/getIconClasses';
import { getIconClasses, getConfiguredLangId } from 'vs/editor/common/services/getIconClasses';
import { Disposable, dispose, IDisposable } from 'vs/base/common/lifecycle';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { withNullAsUndefined } from 'vs/base/common/types';
@@ -121,16 +121,7 @@ export class ResourceLabels extends Disposable {
return; // ignore transitions in files from no mode to specific mode because this happens each time a model is created
}
this._widgets.forEach(widget => widget.notifyModelModeChanged(e.model));
}));
// notify when model is added
this._register(this.modelService.onModelAdded(model => {
if (!model.uri) {
return; // we need the resource to compare
}
this._widgets.forEach(widget => widget.notifyModelAdded(model));
this._widgets.forEach(widget => widget.notifyModelModeChanged(e));
}));
// notify when file decoration changes
@@ -237,7 +228,7 @@ class ResourceLabelWidget extends IconLabel {
private label?: IResourceLabelProps;
private options?: IResourceLabelOptions;
private computedIconClasses?: string[];
private lastKnownDetectedModeId?: string;
private lastKnownConfiguredLangId?: string;
private computedPathLabel?: string;
private needsRedraw?: Redraw;
@@ -267,21 +258,13 @@ class ResourceLabelWidget extends IconLabel {
}
}
notifyModelModeChanged(model: ITextModel): void {
this.handleModelEvent(model);
}
notifyModelAdded(model: ITextModel): void {
this.handleModelEvent(model);
}
private handleModelEvent(model: ITextModel): void {
notifyModelModeChanged(e: { model: ITextModel; oldModeId: string; }): void {
if (!this.label || !this.label.resource) {
return; // only update if label exists
}
if (model.uri.toString() === this.label.resource.toString()) {
if (this.lastKnownDetectedModeId !== model.getModeId()) {
if (e.model.uri.toString() === this.label.resource.toString()) {
if (this.lastKnownConfiguredLangId !== e.model.getLanguageIdentifier().language) {
this.render(true); // update if the language id of the model has changed from our last known state
}
}
@@ -350,7 +333,7 @@ class ResourceLabelWidget extends IconLabel {
setEditor(editor: IEditorInput, options?: IResourceLabelOptions): void {
this.setResource({
resource: toResource(editor, { supportSideBySide: SideBySideEditor.MASTER }),
resource: withNullAsUndefined(toResource(editor, { supportSideBySide: SideBySideEditor.MASTER })),
name: withNullAsUndefined(editor.getName()),
description: withNullAsUndefined(editor.getDescription())
}, options);
@@ -384,7 +367,7 @@ class ResourceLabelWidget extends IconLabel {
clear(): void {
this.label = undefined;
this.options = undefined;
this.lastKnownDetectedModeId = undefined;
this.lastKnownConfiguredLangId = undefined;
this.computedIconClasses = undefined;
this.computedPathLabel = undefined;
@@ -405,10 +388,10 @@ class ResourceLabelWidget extends IconLabel {
}
if (this.label) {
const detectedModeId = this.label.resource ? withNullAsUndefined(detectModeId(this.modelService, this.modeService, this.label.resource)) : undefined;
if (this.lastKnownDetectedModeId !== detectedModeId) {
const configuredLangId = this.label.resource ? withNullAsUndefined(getConfiguredLangId(this.modelService, this.modeService, this.label.resource)) : undefined;
if (this.lastKnownConfiguredLangId !== configuredLangId) {
clearIconCache = true;
this.lastKnownDetectedModeId = detectedModeId;
this.lastKnownConfiguredLangId = configuredLangId;
}
}
@@ -482,7 +465,7 @@ class ResourceLabelWidget extends IconLabel {
this.label = undefined;
this.options = undefined;
this.lastKnownDetectedModeId = undefined;
this.lastKnownConfiguredLangId = undefined;
this.computedIconClasses = undefined;
this.computedPathLabel = undefined;
}

View File

@@ -10,7 +10,7 @@ import { onDidChangeFullscreen, isFullscreen, getZoomFactor } from 'vs/base/brow
import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
import { Registry } from 'vs/platform/registry/common/platform';
import { isWindows, isLinux, isMacintosh } from 'vs/base/common/platform';
import { pathsToEditors } from 'vs/workbench/common/editor';
import { IUntitledResourceInput, pathsToEditors } from 'vs/workbench/common/editor';
import { SidebarPart } from 'vs/workbench/browser/parts/sidebar/sidebarPart';
import { PanelPart } from 'vs/workbench/browser/parts/panel/panelPart';
import { PanelRegistry, Extensions as PanelExtensions } from 'vs/workbench/browser/panel';
@@ -425,7 +425,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
return []; // do not open any empty untitled file if we have backups to restore
}
return [Object.create(null)]; // open empty untitled file
return [<IUntitledResourceInput>{}];
});
}

View File

@@ -39,10 +39,6 @@ body {
user-select: none;
}
body.web {
position: fixed; /* prevent bounce effect */
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.monaco-workbench {

View File

@@ -8,7 +8,7 @@ import { domContentLoaded, addDisposableListener, EventType } from 'vs/base/brow
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { ILogService } from 'vs/platform/log/common/log';
import { Disposable } from 'vs/base/common/lifecycle';
import { SimpleLogService, SimpleProductService, SimpleWorkbenchEnvironmentService } from 'vs/workbench/browser/web.simpleservices';
import { SimpleLogService, SimpleProductService, SimpleWorkbenchEnvironmentService } from 'vs/workbench/browser/nodeless.simpleservices';
import { Workbench } from 'vs/workbench/browser/workbench';
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
import { REMOTE_FILE_SYSTEM_CHANNEL_NAME, RemoteExtensionsFileSystemProvider } from 'vs/platform/remote/common/remoteAgentFileSystemChannel';

View File

@@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
import { URI } from 'vs/base/common/uri';
import { IBackupFileService, IResolvedBackup } from 'vs/workbench/services/backup/common/backup';
import { ITextSnapshot } from 'vs/editor/common/model';
import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
import { ITextBufferFactory, ITextSnapshot } from 'vs/editor/common/model';
import { createTextBufferFactoryFromSnapshot } from 'vs/editor/common/model/textModel';
import { keys, ResourceMap } from 'vs/base/common/map';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
@@ -58,11 +58,11 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { Color, RGBA } from 'vs/base/common/color';
import { ITunnelService } from 'vs/platform/remote/common/tunnel';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IFileService } from 'vs/platform/files/common/files';
export const workspaceResource = URI.file((<any>self).USER_HOME_DIR || '/').with({
export const workspaceResource = URI.from({
scheme: Schemas.vscodeRemote,
authority: document.location.host
authority: document.location.host,
path: (<any>self).USER_HOME_DIR || '/'
});
//#region Backup File
@@ -86,20 +86,20 @@ export class SimpleBackupFileService implements IBackupFileService {
return Promise.resolve(undefined);
}
backupResource<T extends object>(resource: URI, content: ITextSnapshot, versionId?: number, meta?: T): Promise<void> {
backupResource(resource: URI, content: ITextSnapshot, versionId?: number): Promise<void> {
const backupResource = this.toBackupResource(resource);
this.backups.set(backupResource.toString(), content);
return Promise.resolve();
}
resolveBackupContent<T extends object>(backupResource: URI): Promise<IResolvedBackup<T>> {
resolveBackupContent(backupResource: URI): Promise<ITextBufferFactory | undefined> {
const snapshot = this.backups.get(backupResource.toString());
if (snapshot) {
return Promise.resolve({ value: createTextBufferFactoryFromSnapshot(snapshot) });
return Promise.resolve(createTextBufferFactoryFromSnapshot(snapshot));
}
return Promise.reject('Unexpected backup resource to resolve');
return Promise.resolve(undefined);
}
getWorkspaceFileBackups(): Promise<URI[]> {
@@ -234,14 +234,14 @@ export class SimpleWorkbenchEnvironmentService implements IWorkbenchEnvironmentS
args = { _: [] };
execPath: string;
cliPath: string;
appRoot: string = '/web/';
appRoot: string = '/nodeless/';
userHome: string;
userDataPath: string;
appNameLong: string;
appQuality?: string;
appSettingsHome: string = '/web/settings';
appSettingsPath: string = '/web/settings/settings.json';
appKeybindingsPath: string = '/web/settings/keybindings.json';
appSettingsHome: string = '/nodeless/settings';
appSettingsPath: string = '/nodeless/settings/settings.json';
appKeybindingsPath: string = '/nodeless/settings/keybindings.json';
machineSettingsHome: string;
machineSettingsPath: string;
settingsSearchBuildId?: number;
@@ -264,7 +264,7 @@ export class SimpleWorkbenchEnvironmentService implements IWorkbenchEnvironmentS
wait: boolean;
status: boolean;
log?: string;
logsPath: string = '/web/logs';
logsPath: string = '/nodeless/logs';
verbose: boolean;
skipGettingStarted: boolean;
skipReleaseNotes: boolean;
@@ -702,8 +702,7 @@ export class SimpleSearchService implements ISearchService {
constructor(
@IModelService private modelService: IModelService,
@IEditorService private editorService: IEditorService,
@IUntitledEditorService private untitledEditorService: IUntitledEditorService,
@IFileService private fileService: IFileService
@IUntitledEditorService private untitledEditorService: IUntitledEditorService
) {
}
@@ -733,8 +732,8 @@ export class SimpleSearchService implements ISearchService {
return Disposable.None;
}
private getLocalResults(query: ITextQuery): ResourceMap<IFileMatch | null> {
const localResults = new ResourceMap<IFileMatch | null>();
private getLocalResults(query: ITextQuery): ResourceMap<IFileMatch> {
const localResults = new ResourceMap<IFileMatch>();
if (query.type === QueryType.Text) {
const models = this.modelService.getModels();
@@ -755,8 +754,10 @@ export class SimpleSearchService implements ISearchService {
}
}
// Block walkthrough, webview, etc.
else if (!this.fileService.canHandleResource(resource)) {
// Don't support other resource schemes than files for now
// why is that? we should search for resources from other
// schemes
else if (resource.scheme !== Schemas.file) {
return;
}
@@ -765,7 +766,8 @@ export class SimpleSearchService implements ISearchService {
}
// Use editor API to find matches
const matches = model.findMatches(query.contentPattern.pattern, false, !!query.contentPattern.isRegExp, !!query.contentPattern.isCaseSensitive, query.contentPattern.isWordMatch ? query.contentPattern.wordSeparators! : null, false, query.maxResults);
// @ts-ignore
const matches = model.findMatches(query.contentPattern.pattern, false, query.contentPattern.isRegExp, query.contentPattern.isCaseSensitive, query.contentPattern.isWordMatch ? query.contentPattern.wordSeparators : null, false, query.maxResults);
if (matches.length) {
const fileMatch = new FileMatch(resource);
localResults.set(resource, fileMatch);
@@ -773,6 +775,7 @@ export class SimpleSearchService implements ISearchService {
const textSearchResults = editorMatchesToTextSearchResults(matches, model, query.previewOptions);
fileMatch.results = addContextToEditorMatches(textSearchResults, model, query);
} else {
// @ts-ignore
localResults.set(resource, null);
}
});
@@ -782,6 +785,13 @@ export class SimpleSearchService implements ISearchService {
}
private matches(resource: URI, query: ITextQuery): boolean {
// includes
if (query.includePattern) {
if (resource.scheme !== Schemas.file) {
return false; // if we match on file patterns, we have to ignore non file resources
}
}
return pathIncludedInQuery(query, resource.fsPath);
}
}

View File

@@ -18,7 +18,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { activeContrastBorder, focusBorder } from 'vs/platform/theme/common/colorRegistry';
import { ICssStyleCollector, ITheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { ActivityAction, ActivityActionViewItem, ICompositeBar, ICompositeBarColors, ToggleCompositePinnedAction } from 'vs/workbench/browser/parts/compositeBarActions';
import { ActivityAction, ActivityActionItem, ICompositeBar, ICompositeBarColors, ToggleCompositePinnedAction } from 'vs/workbench/browser/parts/compositeBarActions';
import { ViewletDescriptor } from 'vs/workbench/browser/viewlet';
import { Extensions as ActionExtensions, IWorkbenchActionRegistry } from 'vs/workbench/common/actions';
import { IActivity, IGlobalActivity } from 'vs/workbench/common/activity';
@@ -110,7 +110,7 @@ export class GlobalActivityAction extends ActivityAction {
}
}
export class GlobalActivityActionViewItem extends ActivityActionViewItem {
export class GlobalActivityActionItem extends ActivityActionItem {
constructor(
action: GlobalActivityAction,

View File

@@ -10,7 +10,7 @@ import { ActionsOrientation, ActionBar } from 'vs/base/browser/ui/actionbar/acti
import { GlobalActivityExtensions, IGlobalActivityRegistry } from 'vs/workbench/common/activity';
import { Registry } from 'vs/platform/registry/common/platform';
import { Part } from 'vs/workbench/browser/part';
import { GlobalActivityActionViewItem, GlobalActivityAction, ViewletActivityAction, ToggleViewletAction, PlaceHolderToggleCompositePinnedAction, PlaceHolderViewletActivityAction } from 'vs/workbench/browser/parts/activitybar/activitybarActions';
import { GlobalActivityActionItem, GlobalActivityAction, ViewletActivityAction, ToggleViewletAction, PlaceHolderToggleCompositePinnedAction, PlaceHolderViewletActivityAction } from 'vs/workbench/browser/parts/activitybar/activitybarActions';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { IBadge } from 'vs/workbench/services/activity/common/activity';
import { IWorkbenchLayoutService, Parts, Position as SideBarPosition } from 'vs/workbench/services/layout/browser/layoutService';
@@ -87,7 +87,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
}
}
this.compositeBar = this._register(this.instantiationService.createInstance(CompositeBar, this.cachedViewlets.map(v => ({ id: v.id, name: undefined, visible: v.visible, order: v.order, pinned: v.pinned })), {
this.compositeBar = this._register(this.instantiationService.createInstance(CompositeBar, this.cachedViewlets.map(v => (<ICompositeBarItem>{ id: v.id, name: undefined, visible: v.visible, order: v.order, pinned: v.pinned })), {
icon: true,
orientation: ActionsOrientation.VERTICAL,
openComposite: (compositeId: string) => this.viewletService.openViewlet(compositeId, true),
@@ -218,7 +218,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
}
private getActivitybarItemColors(theme: ITheme): ICompositeBarColors {
return {
return <ICompositeBarColors>{
activeForegroundColor: theme.getColor(ACTIVITY_BAR_FOREGROUND),
inactiveForegroundColor: theme.getColor(ACTIVITY_BAR_INACTIVE_FOREGROUND),
badgeBackground: theme.getColor(ACTIVITY_BAR_BADGE_BACKGROUND),
@@ -236,7 +236,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
.map(a => new GlobalActivityAction(a));
this.globalActionBar = this._register(new ActionBar(container, {
actionViewItemProvider: a => this.instantiationService.createInstance(GlobalActivityActionViewItem, a, (theme: ITheme) => this.getActivitybarItemColors(theme)),
actionItemProvider: a => this.instantiationService.createInstance(GlobalActivityActionItem, a, (theme: ITheme) => this.getActivitybarItemColors(theme)),
orientation: ActionsOrientation.VERTICAL,
ariaLabel: nls.localize('globalActions', "Global Actions"),
animated: false
@@ -380,7 +380,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
// Layout composite bar
let availableHeight = contentAreaSize.height;
if (this.globalActionBar) {
availableHeight -= (this.globalActionBar.viewItems.length * ActivitybarPart.ACTION_HEIGHT); // adjust height for global actions showing
availableHeight -= (this.globalActionBar.items.length * ActivitybarPart.ACTION_HEIGHT); // adjust height for global actions showing
}
this.compositeBar.layout(new Dimension(width, availableHeight));
}
@@ -446,9 +446,9 @@ export class ActivitybarPart extends Part implements IActivityBarService {
}
private getCachedViewlets(): ICachedViewlet[] {
const storedStates: Array<string | ICachedViewlet> = JSON.parse(this.cachedViewletsValue);
const cachedViewlets = storedStates.map(c => {
const serialized: ICachedViewlet = typeof c === 'string' /* migration from pinned states to composites states */ ? { id: c, pinned: true, order: undefined, visible: true, iconUrl: undefined, views: undefined } : c;
const storedStates = <Array<string | ICachedViewlet>>JSON.parse(this.cachedViewletsValue);
const cachedViewlets = <ICachedViewlet[]>storedStates.map(c => {
const serialized: ICachedViewlet = typeof c === 'string' /* migration from pinned states to composites states */ ? <ICachedViewlet>{ id: c, pinned: true, order: undefined, visible: true, iconUrl: undefined, views: undefined } : c;
serialized.visible = isUndefinedOrNull(serialized.visible) ? true : serialized.visible;
return serialized;
});
@@ -466,7 +466,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
private loadOldCachedViewlets(): ICachedViewlet[] {
const previousState = this.storageService.get('workbench.activity.placeholderViewlets', StorageScope.GLOBAL, '[]');
const result: ICachedViewlet[] = JSON.parse(previousState);
const result = (<ICachedViewlet[]>JSON.parse(previousState));
this.storageService.remove('workbench.activity.placeholderViewlets', StorageScope.GLOBAL);
return result;

View File

@@ -11,7 +11,7 @@ import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { IBadge } from 'vs/workbench/services/activity/common/activity';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ActionBar, ActionsOrientation, Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { CompositeActionViewItem, CompositeOverflowActivityAction, ICompositeActivity, CompositeOverflowActivityActionViewItem, ActivityAction, ICompositeBar, ICompositeBarColors, DraggedCompositeIdentifier } from 'vs/workbench/browser/parts/compositeBarActions';
import { CompositeActionItem, CompositeOverflowActivityAction, ICompositeActivity, CompositeOverflowActivityActionItem, ActivityAction, ICompositeBar, ICompositeBarColors, DraggedCompositeIdentifier } from 'vs/workbench/browser/parts/compositeBarActions';
import { Dimension, $, addDisposableListener, EventType, EventHelper } from 'vs/base/browser/dom';
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
@@ -50,7 +50,7 @@ export class CompositeBar extends Widget implements ICompositeBar {
private compositeSwitcherBar: ActionBar;
private compositeOverflowAction: CompositeOverflowActivityAction | null;
private compositeOverflowActionViewItem: CompositeOverflowActivityActionViewItem | undefined;
private compositeOverflowActionItem: CompositeOverflowActivityActionItem | undefined;
private model: CompositeBarModel;
private visibleComposites: string[];
@@ -93,12 +93,12 @@ export class CompositeBar extends Widget implements ICompositeBar {
create(parent: HTMLElement): HTMLElement {
const actionBarDiv = parent.appendChild($('.composite-bar'));
this.compositeSwitcherBar = this._register(new ActionBar(actionBarDiv, {
actionViewItemProvider: (action: Action) => {
actionItemProvider: (action: Action) => {
if (action instanceof CompositeOverflowActivityAction) {
return this.compositeOverflowActionViewItem;
return this.compositeOverflowActionItem;
}
const item = this.model.findItem(action.id);
return item && this.instantiationService.createInstance(CompositeActionViewItem, action, item.pinnedAction, () => this.getContextMenuActions(), this.options.colors, this.options.icon, this);
return item && this.instantiationService.createInstance(CompositeActionItem, action, item.pinnedAction, () => this.getContextMenuActions(), this.options.colors, this.options.icon, this);
},
orientation: this.options.orientation,
ariaLabel: nls.localize('activityBarAriaLabel', "Active View Switcher"),
@@ -278,13 +278,13 @@ export class CompositeBar extends Widget implements ICompositeBar {
} else {
if (this.dimension && this.dimension.height !== 0 && this.dimension.width !== 0) {
// Compute sizes only if visible. Otherwise the size measurment would be computed wrongly.
const currentItemsLength = this.compositeSwitcherBar.viewItems.length;
const currentItemsLength = this.compositeSwitcherBar.items.length;
this.compositeSwitcherBar.push(items.map(composite => composite.activityAction));
items.map((composite, index) => this.compositeSizeInBar.set(composite.id, this.options.orientation === ActionsOrientation.VERTICAL
? this.compositeSwitcherBar.getHeight(currentItemsLength + index)
: this.compositeSwitcherBar.getWidth(currentItemsLength + index)
));
items.forEach(() => this.compositeSwitcherBar.pull(this.compositeSwitcherBar.viewItems.length - 1));
items.forEach(() => this.compositeSwitcherBar.pull(this.compositeSwitcherBar.items.length - 1));
}
}
}
@@ -343,10 +343,10 @@ export class CompositeBar extends Widget implements ICompositeBar {
this.compositeOverflowAction.dispose();
this.compositeOverflowAction = null;
if (this.compositeOverflowActionViewItem) {
this.compositeOverflowActionViewItem.dispose();
if (this.compositeOverflowActionItem) {
this.compositeOverflowActionItem.dispose();
}
this.compositeOverflowActionViewItem = undefined;
this.compositeOverflowActionItem = undefined;
}
// Pull out composites that overflow or got hidden
@@ -357,9 +357,9 @@ export class CompositeBar extends Widget implements ICompositeBar {
}
});
compositesToRemove.reverse().forEach(index => {
const actionViewItem = this.compositeSwitcherBar.viewItems[index];
const actionItem = this.compositeSwitcherBar.items[index];
this.compositeSwitcherBar.pull(index);
actionViewItem.dispose();
actionItem.dispose();
this.visibleComposites.splice(index, 1);
});
@@ -368,9 +368,9 @@ export class CompositeBar extends Widget implements ICompositeBar {
const currentIndex = this.visibleComposites.indexOf(compositeId);
if (newIndex !== currentIndex) {
if (currentIndex !== -1) {
const actionViewItem = this.compositeSwitcherBar.viewItems[currentIndex];
const actionItem = this.compositeSwitcherBar.items[currentIndex];
this.compositeSwitcherBar.pull(currentIndex);
actionViewItem.dispose();
actionItem.dispose();
this.visibleComposites.splice(currentIndex, 1);
}
@@ -382,12 +382,12 @@ export class CompositeBar extends Widget implements ICompositeBar {
// Add overflow action as needed
if ((visibleCompositesChange && overflows) || this.compositeSwitcherBar.length() === 0) {
this.compositeOverflowAction = this.instantiationService.createInstance(CompositeOverflowActivityAction, () => {
if (this.compositeOverflowActionViewItem) {
this.compositeOverflowActionViewItem.showMenu();
if (this.compositeOverflowActionItem) {
this.compositeOverflowActionItem.showMenu();
}
});
this.compositeOverflowActionViewItem = this.instantiationService.createInstance(
CompositeOverflowActivityActionViewItem,
this.compositeOverflowActionItem = this.instantiationService.createInstance(
CompositeOverflowActivityActionItem,
this.compositeOverflowAction,
() => this.getOverflowingComposites(),
() => this.model.activeItem ? this.model.activeItem.id : undefined,

View File

@@ -6,7 +6,7 @@
import * as nls from 'vs/nls';
import { Action } from 'vs/base/common/actions';
import * as dom from 'vs/base/browser/dom';
import { BaseActionViewItem, IBaseActionViewItemOptions, Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { BaseActionItem, IBaseActionItemOptions, Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { dispose, IDisposable, Disposable, toDisposable } from 'vs/base/common/lifecycle';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
@@ -118,16 +118,16 @@ export interface ICompositeBarColors {
dragAndDropBackground?: Color;
}
export interface IActivityActionViewItemOptions extends IBaseActionViewItemOptions {
export interface IActivityActionItemOptions extends IBaseActionItemOptions {
icon?: boolean;
colors: (theme: ITheme) => ICompositeBarColors;
}
export class ActivityActionViewItem extends BaseActionViewItem {
export class ActivityActionItem extends BaseActionItem {
protected container: HTMLElement;
protected label: HTMLElement;
protected badge: HTMLElement;
protected options: IActivityActionViewItemOptions;
protected options: IActivityActionItemOptions;
private badgeContent: HTMLElement;
private badgeDisposable: IDisposable = Disposable.None;
@@ -135,7 +135,7 @@ export class ActivityActionViewItem extends BaseActionViewItem {
constructor(
action: ActivityAction,
options: IActivityActionViewItemOptions,
options: IActivityActionItemOptions,
@IThemeService protected themeService: IThemeService
) {
super(null, action, options);
@@ -347,7 +347,7 @@ export class CompositeOverflowActivityAction extends ActivityAction {
}
}
export class CompositeOverflowActivityActionViewItem extends ActivityActionViewItem {
export class CompositeOverflowActivityActionItem extends ActivityActionItem {
private actions: Action[];
constructor(
@@ -428,7 +428,7 @@ export class DraggedCompositeIdentifier {
}
}
export class CompositeActionViewItem extends ActivityActionViewItem {
export class CompositeActionItem extends ActivityActionItem {
private static manageExtensionAction: ManageExtensionAction;
@@ -451,8 +451,8 @@ export class CompositeActionViewItem extends ActivityActionViewItem {
this.compositeTransfer = LocalSelectionTransfer.getInstance<DraggedCompositeIdentifier>();
if (!CompositeActionViewItem.manageExtensionAction) {
CompositeActionViewItem.manageExtensionAction = instantiationService.createInstance(ManageExtensionAction);
if (!CompositeActionItem.manageExtensionAction) {
CompositeActionItem.manageExtensionAction = instantiationService.createInstance(ManageExtensionAction);
}
this._register(compositeActivityAction.onDidChangeActivity(() => { this.compositeActivity = null; this.updateActivity(); }, this));
@@ -569,7 +569,7 @@ export class CompositeActionViewItem extends ActivityActionViewItem {
const actions: Action[] = [this.toggleCompositePinnedAction];
if ((<any>this.compositeActivityAction.activity).extensionId) {
actions.push(new Separator());
actions.push(CompositeActionViewItem.manageExtensionAction);
actions.push(CompositeActionItem.manageExtensionAction);
}
const isPinned = this.compositeBar.isPinned(this.activity.id);

View File

@@ -11,7 +11,7 @@ import * as strings from 'vs/base/common/strings';
import { Emitter } from 'vs/base/common/event';
import * as errors from 'vs/base/common/errors';
import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar';
import { IActionViewItem, ActionsOrientation } from 'vs/base/browser/ui/actionbar/actionbar';
import { IActionItem, ActionsOrientation } from 'vs/base/browser/ui/actionbar/actionbar';
import { ProgressBar } from 'vs/base/browser/ui/progressbar/progressbar';
import { prepareActions } from 'vs/workbench/browser/actions';
import { IAction } from 'vs/base/common/actions';
@@ -399,7 +399,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
// Toolbar
this.toolBar = this._register(new ToolBar(titleActionsContainer, this.contextMenuService, {
actionViewItemProvider: action => this.actionViewItemProvider(action),
actionItemProvider: action => this.actionItemProvider(action),
orientation: ActionsOrientation.HORIZONTAL,
getKeyBinding: action => this.keybindingService.lookupKeybinding(action.id),
anchorAlignmentProvider: () => this.getTitleAreaDropDownAnchorAlignment()
@@ -432,11 +432,11 @@ export abstract class CompositePart<T extends Composite> extends Part {
this.titleLabel.updateStyles();
}
protected actionViewItemProvider(action: IAction): IActionViewItem | undefined {
protected actionItemProvider(action: IAction): IActionItem | undefined {
// Check Active Composite
if (this.activeComposite) {
return this.activeComposite.getActionViewItem(action);
return this.activeComposite.getActionItem(action);
}
return undefined;

View File

@@ -70,7 +70,7 @@ class Item extends BreadcrumbsItem {
return false;
}
if (this.element instanceof FileElement && other.element instanceof FileElement) {
return isEqual(this.element.uri, other.element.uri, false);
return isEqual(this.element.uri, other.element.uri);
}
if (this.element instanceof TreeElement && other.element instanceof TreeElement) {
return this.element.id === other.element.id;

View File

@@ -388,14 +388,21 @@ export class BreadcrumbsFilePicker extends BreadcrumbsPicker {
const labels = this._instantiationService.createInstance(ResourceLabels, DEFAULT_LABELS_CONTAINER /* TODO@Jo visibility propagation */);
this._disposables.push(labels);
return this._instantiationService.createInstance(WorkbenchAsyncDataTree, container, new FileVirtualDelegate(), [this._instantiationService.createInstance(FileRenderer, labels)], this._instantiationService.createInstance(FileDataSource), {
filterOnType: true,
multipleSelectionSupport: false,
sorter: new FileSorter(),
filter: this._instantiationService.createInstance(FileFilter),
identityProvider: new FileIdentityProvider(),
keyboardNavigationLabelProvider: new FileNavigationLabelProvider()
}) as WorkbenchAsyncDataTree<BreadcrumbElement | IFileStat, any, FuzzyScore>;
return this._instantiationService.createInstance(
WorkbenchAsyncDataTree,
container,
new FileVirtualDelegate(),
[this._instantiationService.createInstance(FileRenderer, labels)],
this._instantiationService.createInstance(FileDataSource),
{
filterOnType: true,
multipleSelectionSupport: false,
sorter: new FileSorter(),
filter: this._instantiationService.createInstance(FileFilter),
identityProvider: new FileIdentityProvider(),
keyboardNavigationLabelProvider: new FileNavigationLabelProvider()
}
) as WorkbenchAsyncDataTree<BreadcrumbElement, any, FuzzyScore>;
}
_setInput(element: BreadcrumbElement): Promise<void> {

View File

@@ -104,7 +104,7 @@ Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
interface ISerializedUntitledEditorInput {
resource: string;
resourceJSON: object;
modeId: string | undefined;
modeId: string | null;
encoding: string;
}
@@ -136,7 +136,7 @@ class UntitledEditorInputFactory implements IEditorInputFactory {
const serialized: ISerializedUntitledEditorInput = {
resource: resource.toString(), // Keep for backwards compatibility
resourceJSON: resource.toJSON(),
modeId: untitledEditorInput.getMode(),
modeId: untitledEditorInput.getModeId(),
encoding: untitledEditorInput.getEncoding()
};
@@ -147,10 +147,10 @@ class UntitledEditorInputFactory implements IEditorInputFactory {
return instantiationService.invokeFunction<UntitledEditorInput>(accessor => {
const deserialized: ISerializedUntitledEditorInput = JSON.parse(serializedEditorInput);
const resource = !!deserialized.resourceJSON ? URI.revive(<UriComponents>deserialized.resourceJSON) : URI.parse(deserialized.resource);
const mode = deserialized.modeId;
const language = deserialized.modeId;
const encoding = deserialized.encoding;
return accessor.get(IEditorService).createInput({ resource, mode, encoding, forceUntitled: true }) as UntitledEditorInput;
return accessor.get(IEditorService).createInput({ resource, language, encoding, forceUntitled: true }) as UntitledEditorInput;
});
}
}

View File

@@ -449,7 +449,7 @@ export function toEditorQuickOpenEntry(element: any): IEditorQuickOpenEntry | nu
// QuickOpenEntryGroup
if (element instanceof QuickOpenEntryGroup) {
const group = element;
const group = <QuickOpenEntryGroup>element;
if (group.getEntry()) {
element = group.getEntry();
}

View File

@@ -40,7 +40,7 @@ import { CLOSE_EDITOR_GROUP_COMMAND_ID } from 'vs/workbench/browser/parts/editor
import { NoTabsTitleControl } from 'vs/workbench/browser/parts/editor/noTabsTitleControl';
import { IMenuService, MenuId, IMenu } from 'vs/platform/actions/common/actions';
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import { fillInContextMenuActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
import { fillInContextMenuActions } from 'vs/platform/actions/browser/menuItemActionItem';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
// {{SQL CARBON EDIT}}
import { ICommandService } from 'vs/platform/commands/common/commands';

View File

@@ -18,7 +18,6 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { EditorInput, toResource, SideBySideEditor } from 'vs/workbench/common/editor';
import { compareItemsByScore, scoreItem, ScorerCache, prepareQuery } from 'vs/base/parts/quickopen/common/quickOpenScorer';
import { CancellationToken } from 'vs/base/common/cancellation';
import { withNullAsUndefined } from 'vs/base/common/types';
export class EditorPickerEntry extends QuickOpenEntryGroup {
@@ -33,13 +32,13 @@ export class EditorPickerEntry extends QuickOpenEntryGroup {
getLabelOptions(): IIconLabelValueOptions {
return {
extraClasses: getIconClasses(this.modelService, this.modeService, this.getResource()),
extraClasses: getIconClasses(this.modelService, this.modeService, this.getResource() || undefined),
italic: !this._group.isPinned(this.editor)
};
}
getLabel() {
return withNullAsUndefined(this.editor.getName());
return this.editor.getName();
}
getIcon(): string {
@@ -59,7 +58,7 @@ export class EditorPickerEntry extends QuickOpenEntryGroup {
}
getDescription() {
return withNullAsUndefined(this.editor.getDescription());
return this.editor.getDescription();
}
run(mode: Mode, context: IEntryRunContext): boolean {

View File

@@ -14,11 +14,11 @@ import { IStatusbarItem } from 'vs/workbench/browser/parts/statusbar/statusbar';
import { Action } from 'vs/base/common/actions';
import { Language } from 'vs/base/common/platform';
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
import { IFileEditorInput, EncodingMode, IEncodingSupport, toResource, SideBySideEditorInput, IEditor as IBaseEditor, IEditorInput, SideBySideEditor, IModeSupport } from 'vs/workbench/common/editor';
import { IFileEditorInput, EncodingMode, IEncodingSupport, toResource, SideBySideEditorInput, IEditor as IBaseEditor, IEditorInput, SideBySideEditor } from 'vs/workbench/common/editor';
import { IDisposable, combinedDisposable, dispose, toDisposable } from 'vs/base/common/lifecycle';
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { IEditorAction } from 'vs/editor/common/editorCommon';
import { EndOfLineSequence } from 'vs/editor/common/model';
import { EndOfLineSequence, ITextModel } from 'vs/editor/common/model';
import { IModelLanguageChangedEvent, IModelOptionsChangedEvent } from 'vs/editor/common/model/textModelEvents';
import { TrimTrailingWhitespaceAction } from 'vs/editor/contrib/linesOperations/linesOperations';
import { IndentUsingSpaces, IndentUsingTabs, DetectIndentation, IndentationToSpacesAction, IndentationToTabsAction } from 'vs/editor/contrib/indentation/indentation';
@@ -62,15 +62,7 @@ class SideBySideEditorEncodingSupport implements IEncodingSupport {
}
setEncoding(encoding: string, mode: EncodingMode): void {
[this.master, this.details].forEach(editor => editor.setEncoding(encoding, mode));
}
}
class SideBySideEditorModeSupport implements IModeSupport {
constructor(private master: IModeSupport, private details: IModeSupport) { }
setMode(mode: string): void {
[this.master, this.details].forEach(editor => editor.setMode(mode));
[this.master, this.details].forEach(s => s.setEncoding(encoding, mode));
}
}
@@ -94,7 +86,7 @@ function toEditorWithEncodingSupport(input: IEditorInput): IEncodingSupport | nu
}
// File or Resource Editor
const encodingSupport = input as IFileEditorInput;
let encodingSupport = input as IFileEditorInput;
if (areFunctions(encodingSupport.setEncoding, encodingSupport.getEncoding)) {
return encodingSupport;
}
@@ -103,41 +95,14 @@ function toEditorWithEncodingSupport(input: IEditorInput): IEncodingSupport | nu
return null;
}
function toEditorWithModeSupport(input: IEditorInput): IModeSupport | null {
// Untitled Editor
if (input instanceof UntitledEditorInput) {
return input;
}
// Side by Side (diff) Editor
if (input instanceof SideBySideEditorInput) {
const masterModeSupport = toEditorWithModeSupport(input.master);
const detailsModeSupport = toEditorWithModeSupport(input.details);
if (masterModeSupport && detailsModeSupport) {
return new SideBySideEditorModeSupport(masterModeSupport, detailsModeSupport);
}
return masterModeSupport;
}
// File or Resource Editor
const modeSupport = input as IFileEditorInput;
if (typeof modeSupport.setMode === 'function') {
return modeSupport;
}
// Unsupported for any other editor
return null;
}
interface IEditorSelectionStatus {
selections?: Selection[];
charactersSelected?: number;
}
class StateChange {
_stateChangeBrand: void;
indentation: boolean = false;
selectionStatus: boolean = false;
mode: boolean = false;
@@ -158,7 +123,7 @@ class StateChange {
this.metadata = this.metadata || other.metadata;
}
hasChanges(): boolean {
public hasChanges(): boolean {
return this.indentation
|| this.selectionStatus
|| this.mode
@@ -217,49 +182,42 @@ class State {
change.selectionStatus = true;
}
}
if ('indentation' in update) {
if (this._indentation !== update.indentation) {
this._indentation = update.indentation;
change.indentation = true;
}
}
if ('mode' in update) {
if (this._mode !== update.mode) {
this._mode = update.mode;
change.mode = true;
}
}
if ('encoding' in update) {
if (this._encoding !== update.encoding) {
this._encoding = update.encoding;
change.encoding = true;
}
}
if ('EOL' in update) {
if (this._EOL !== update.EOL) {
this._EOL = update.EOL;
change.EOL = true;
}
}
if ('tabFocusMode' in update) {
if (this._tabFocusMode !== update.tabFocusMode) {
this._tabFocusMode = update.tabFocusMode;
change.tabFocusMode = true;
}
}
if ('screenReaderMode' in update) {
if (this._screenReaderMode !== update.screenReaderMode) {
this._screenReaderMode = update.screenReaderMode;
change.screenReaderMode = true;
}
}
if ('metadata' in update) {
if (this._metadata !== update.metadata) {
this._metadata = update.metadata;
@@ -281,6 +239,7 @@ const nlsTabFocusMode = nls.localize('tabFocusModeEnabled', "Tab Moves Focus");
const nlsScreenReaderDetected = nls.localize('screenReaderDetected', "Screen Reader Optimized");
const nlsScreenReaderDetectedTitle = nls.localize('screenReaderDetectedExtra', "If you are not using a Screen Reader, please change the setting `editor.accessibilitySupport` to \"off\".");
class StatusBarItem {
private _showing = true;
@@ -292,15 +251,15 @@ class StatusBarItem {
this.element.title = title;
}
set textContent(value: string) {
public set textContent(value: string) {
this.element.textContent = value;
}
set onclick(value: () => void) {
public set onclick(value: () => void) {
this.element.onclick = value;
}
setVisible(shouldShow: boolean): void {
public setVisible(shouldShow: boolean): void {
if (shouldShow !== this._showing) {
this._showing = shouldShow;
this.element.style.display = shouldShow ? '' : 'none';
@@ -308,6 +267,7 @@ class StatusBarItem {
}
}
export class EditorStatus implements IStatusbarItem {
private state: State;
private element: HTMLElement;
@@ -704,7 +664,7 @@ export class EditorStatus implements IStatusbarItem {
this.updateState(update);
}
private promptedScreenReader: boolean = false;
private _promptedScreenReader: boolean = false;
private onScreenReaderModeChange(editorWidget: ICodeEditor | undefined): void {
let screenReaderMode = false;
@@ -716,8 +676,8 @@ export class EditorStatus implements IStatusbarItem {
const screenReaderConfiguration = this.configurationService.getValue<IEditorOptions>('editor').accessibilitySupport;
if (screenReaderConfiguration === 'auto') {
// show explanation
if (!this.promptedScreenReader) {
this.promptedScreenReader = true;
if (!this._promptedScreenReader) {
this._promptedScreenReader = true;
setTimeout(() => {
this.onScreenReaderModeClick();
}, 100);
@@ -814,7 +774,7 @@ export class EditorStatus implements IStatusbarItem {
if (activeControl) {
const activeResource = toResource(activeControl.input, { supportSideBySide: SideBySideEditor.MASTER });
if (activeResource && activeResource.toString() === resource.toString()) {
return this.onEncodingChange(activeControl); // only update if the encoding changed for the active resource
return this.onEncodingChange(<IBaseEditor>activeControl); // only update if the encoding changed for the active resource
}
}
}
@@ -927,7 +887,7 @@ export class ChangeModeAction extends Action {
}
}
return {
return <IQuickPickItem>{
label: lang,
iconClasses: getIconClasses(this.modelService, this.modeService, fakeResource),
description
@@ -990,35 +950,50 @@ export class ChangeModeAction extends Action {
}
// Change mode for active editor
const activeEditor = this.editorService.activeControl; // {{SQL CARBON EDIT}} @anthonydresser change to activeControl from active editor
if (activeEditor) {
const modeSupport = toEditorWithModeSupport(activeEditor.input); // {{SQL CARBON EDIT}} @anthonydresser reference input rather than activeeditor directly
if (modeSupport) {
// Find mode
let languageSelection: ILanguageSelection | undefined;
if (pick === autoDetectMode) {
if (textModel) {
const resource = toResource(activeEditor.input, { supportSideBySide: SideBySideEditor.MASTER }); // {{SQL CARBON EDIT}} @anthonydresser reference input rather than activeeditor directly
if (resource) {
languageSelection = this.modeService.createByFilepathOrFirstLine(resource.fsPath, textModel.getLineContent(1));
}
}
} else {
languageSelection = this.modeService.createByLanguageName(pick.label);
// {{SQL CARBON EDIT}} - Get activeControl instead of activeEditor @todo anthonydresser 4/12/19 investigate
const activeEditor = this.editorService.activeControl;
const activeTextEditorWidget = this.editorService.activeTextEditorWidget;
const models: ITextModel[] = [];
if (isCodeEditor(activeTextEditorWidget)) {
const codeEditorModel = activeTextEditorWidget.getModel();
if (codeEditorModel) {
models.push(codeEditorModel);
}
} else if (isDiffEditor(activeTextEditorWidget)) {
const diffEditorModel = activeTextEditorWidget.getModel();
if (diffEditorModel) {
if (diffEditorModel.original) {
models.push(diffEditorModel.original);
}
// {{SQL CARBON EDIT}} @anthonydresser preform a check before we actuall set the mode
// Change mode
if (typeof languageSelection !== 'undefined') {
QueryEditorService.sqlLanguageModeCheck(textModel, languageSelection, activeEditor).then(newTextModel => {
if (newTextModel) {
modeSupport.setMode(languageSelection.languageIdentifier.language);
}
});
if (diffEditorModel.modified) {
models.push(diffEditorModel.modified);
}
}
}
// Find mode
let languageSelection: ILanguageSelection | undefined;
if (pick === autoDetectMode) {
if (textModel) {
// {{SQL CARBON EDIT}} - use activeEditor.input instead of activeEditor
const resource = toResource(activeEditor.input, { supportSideBySide: SideBySideEditor.MASTER });
if (resource) {
languageSelection = this.modeService.createByFilepathOrFirstLine(resource.fsPath, textModel.getLineContent(1));
}
}
} else {
languageSelection = this.modeService.createByLanguageName(pick.label);
}
// {{SQL CARBON EDIT}}
// Change mode
models.forEach(textModel => {
QueryEditorService.sqlLanguageModeCheck(textModel, languageSelection, activeEditor).then((newTextModel) => {
if (newTextModel) {
this.modelService.setMode(newTextModel, languageSelection);
}
});
});
});
}
@@ -1029,9 +1004,9 @@ export class ChangeModeAction extends Action {
const languages = this.modeService.getRegisteredLanguageNames();
const picks: IQuickPickItem[] = languages.sort().map((lang, index) => {
const id = withNullAsUndefined(this.modeService.getModeIdForLanguageName(lang.toLowerCase()));
const id = this.modeService.getModeIdForLanguageName(lang.toLowerCase());
return {
return <IQuickPickItem>{
id,
label: lang,
description: (id === currentAssociation) ? nls.localize('currentAssociation', "Current Association") : undefined
@@ -1041,7 +1016,7 @@ export class ChangeModeAction extends Action {
setTimeout(() => {
this.quickInputService.pick(picks, { placeHolder: nls.localize('pickLanguageToConfigure', "Select Language Mode to Associate with '{0}'", extension || base) }).then(language => {
if (language) {
const fileAssociationsConfig = this.configurationService.inspect<{}>(FILES_ASSOCIATIONS_CONFIG);
const fileAssociationsConfig = this.configurationService.inspect(FILES_ASSOCIATIONS_CONFIG);
let associationKey: string;
if (extension && base[0] !== '.') {
@@ -1192,7 +1167,6 @@ export class ChangeEncodingAction extends Action {
if (!activeControl) {
return this.quickInputService.pick([{ label: nls.localize('noEditor', "No text editor active at this time") }]);
}
const encodingSupport: IEncodingSupport | null = toEditorWithEncodingSupport(activeControl.input);
if (!encodingSupport) {
return this.quickInputService.pick([{ label: nls.localize('noFileEditor', "No file active at this time") }]);
@@ -1283,12 +1257,10 @@ export class ChangeEncodingAction extends Action {
if (!encoding) {
return;
}
const activeControl = this.editorService.activeControl;
if (!activeControl) {
return;
}
const encodingSupport = toEditorWithEncodingSupport(activeControl.input);
if (typeof encoding.id !== 'undefined' && encodingSupport && encodingSupport.getEncoding() !== encoding.id) {
encodingSupport.setEncoding(encoding.id, isReopenWithEncoding ? EncodingMode.Decode : EncodingMode.Encode); // Set new encoding

View File

@@ -370,7 +370,7 @@ class InlineImageView {
dispose: () => combinedDisposable(disposables).dispose()
};
const cacheKey = `${descriptor.resource.toString()}:${descriptor.etag}`;
const cacheKey = descriptor.resource.toString();
let ctrlPressed = false;
let altPressed = false;
@@ -501,8 +501,8 @@ class InlineImageView {
return;
}
const isScrollWheelKeyPressed = platform.isMacintosh ? altPressed : ctrlPressed;
if (!isScrollWheelKeyPressed && !e.ctrlKey) { // pinching is reported as scroll wheel + ctrl
const isScrollWhellKeyPressed = platform.isMacintosh ? altPressed : ctrlPressed;
if (!isScrollWhellKeyPressed && !e.ctrlKey) { // pinching is reported as scroll wheel + ctrl
return;
}
@@ -513,8 +513,12 @@ class InlineImageView {
firstZoom();
}
let delta = e.deltaY > 0 ? 1 : -1;
let delta = e.deltaY < 0 ? 1 : -1;
// Pinching should increase the scale
if (e.ctrlKey && !isScrollWhellKeyPressed) {
delta *= -1;
}
updateScale(scale as number * (1 - delta * InlineImageView.SCALE_PINCH_FACTOR));
}));

View File

@@ -93,10 +93,10 @@ export class SideBySideEditor extends BaseEditor {
this.updateStyles();
}
setInput(newInput: EditorInput, options: EditorOptions, token: CancellationToken): Promise<void> {
const oldInput = this.input as SideBySideEditorInput;
setInput(newInput: SideBySideEditorInput, options: EditorOptions, token: CancellationToken): Promise<void> {
const oldInput = <SideBySideEditorInput>this.input;
return super.setInput(newInput, options, token)
.then(() => this.updateInput(oldInput, newInput as SideBySideEditorInput, options, token));
.then(() => this.updateInput(oldInput, newInput, options, token));
}
setOptions(options: EditorOptions): void {
@@ -177,8 +177,8 @@ export class SideBySideEditor extends BaseEditor {
}
private setNewInput(newInput: SideBySideEditorInput, options: EditorOptions, token: CancellationToken): Promise<void> {
const detailsEditor = this.doCreateEditor(newInput.details, this.detailsEditorContainer);
const masterEditor = this.doCreateEditor(newInput.master, this.masterEditorContainer);
const detailsEditor = this.doCreateEditor(<EditorInput>newInput.details, this.detailsEditorContainer);
const masterEditor = this.doCreateEditor(<EditorInput>newInput.master, this.masterEditorContainer);
return this.onEditorsCreated(detailsEditor, masterEditor, newInput.details, newInput.master, options, token);
}

View File

@@ -6,7 +6,7 @@
import { applyDragImage } from 'vs/base/browser/dnd';
import { addDisposableListener, Dimension, EventType } from 'vs/base/browser/dom';
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import { ActionsOrientation, IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { ActionsOrientation, IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar';
import { IAction, IRunEvent } from 'vs/base/common/actions';
import * as arrays from 'vs/base/common/arrays';
@@ -15,7 +15,7 @@ import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import 'vs/css!./media/titlecontrol';
import { getCodeEditor } from 'vs/editor/browser/editorBrowser';
import { localize } from 'vs/nls';
import { createActionViewItem, fillInActionBarActions, fillInContextMenuActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
import { createActionItem, fillInActionBarActions, fillInContextMenuActions } from 'vs/platform/actions/browser/menuItemActionItem';
import { ExecuteCommandAction, IMenu, IMenuService, MenuId } from 'vs/platform/actions/common/actions';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
@@ -39,7 +39,7 @@ import { Themable } from 'vs/workbench/common/theme';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
import { IFileService } from 'vs/platform/files/common/files';
import { withNullAsUndefined, withUndefinedAsNull } from 'vs/base/common/types';
import { withNullAsUndefined } from 'vs/base/common/types';
import { ILabelService } from 'vs/platform/label/common/label';
export interface IToolbarActions {
@@ -129,7 +129,7 @@ export abstract class TitleControl extends Themable {
const context: IEditorCommandsContext = { groupId: this.group.id };
this.editorActionsToolbar = this._register(new ToolBar(container, this.contextMenuService, {
actionViewItemProvider: action => this.actionViewItemProvider(action),
actionItemProvider: action => this.actionItemProvider(action),
orientation: ActionsOrientation.HORIZONTAL,
ariaLabel: localize('araLabelEditorActions', "Editor actions"),
getKeyBinding: action => this.getKeybinding(action),
@@ -159,21 +159,21 @@ export abstract class TitleControl extends Themable {
}));
}
private actionViewItemProvider(action: IAction): IActionViewItem | undefined {
private actionItemProvider(action: IAction): IActionItem | undefined {
const activeControl = this.group.activeControl;
// Check Active Editor
let actionViewItem: IActionViewItem | undefined = undefined;
let actionItem: IActionItem | undefined = undefined;
if (activeControl instanceof BaseEditor) {
actionViewItem = activeControl.getActionViewItem(action);
actionItem = activeControl.getActionItem(action);
}
// Check extensions
if (!actionViewItem) {
actionViewItem = createActionViewItem(action, this.keybindingService, this.notificationService, this.contextMenuService);
if (!actionItem) {
actionItem = createActionItem(action, this.keybindingService, this.notificationService, this.contextMenuService);
}
return actionViewItem;
return actionItem;
}
protected updateEditorActionsToolbar(): void {
@@ -222,7 +222,7 @@ export abstract class TitleControl extends Themable {
this.editorToolBarMenuDisposables = dispose(this.editorToolBarMenuDisposables);
// Update the resource context
this.resourceContext.set(this.group.activeEditor ? withUndefinedAsNull(toResource(this.group.activeEditor, { supportSideBySide: SideBySideEditor.MASTER })) : null);
this.resourceContext.set(this.group.activeEditor ? toResource(this.group.activeEditor, { supportSideBySide: SideBySideEditor.MASTER }) : null);
// Editor actions require the editor control to be there, so we retrieve it via service
const activeControl = this.group.activeControl;
@@ -289,7 +289,7 @@ export abstract class TitleControl extends Themable {
// Update the resource context
const currentContext = this.resourceContext.get();
this.resourceContext.set(withUndefinedAsNull(toResource(editor, { supportSideBySide: SideBySideEditor.MASTER })));
this.resourceContext.set(toResource(editor, { supportSideBySide: SideBySideEditor.MASTER }));
// Find target anchor
let anchor: HTMLElement | { x: number, y: number } = node;

View File

@@ -16,7 +16,7 @@ import { IAction, IActionRunner } from 'vs/base/common/actions';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { DropdownMenuActionViewItem } from 'vs/base/browser/ui/dropdown/dropdown';
import { DropdownMenuActionItem } from 'vs/base/browser/ui/dropdown/dropdown';
import { INotificationViewItem, NotificationViewItem, NotificationViewItemLabelKind, INotificationMessage, ChoiceAction } from 'vs/workbench/common/notifications';
import { ClearNotificationAction, ExpandNotificationAction, CollapseNotificationAction, ConfigureNotificationAction } from 'vs/workbench/browser/parts/notifications/notificationsActions';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
@@ -219,9 +219,9 @@ export class NotificationRenderer implements IListRenderer<INotificationViewItem
toolbarContainer,
{
ariaLabel: localize('notificationActions', "Notification Actions"),
actionViewItemProvider: action => {
actionItemProvider: action => {
if (action && action instanceof ConfigureNotificationAction) {
const item = new DropdownMenuActionViewItem(action, action.configurationActions, this.contextMenuService, undefined, this.actionRunner, undefined, action.class);
const item = new DropdownMenuActionItem(action, action.configurationActions, this.contextMenuService, undefined, this.actionRunner, undefined, action.class);
data.toDispose.push(item);
return item;

View File

@@ -394,9 +394,9 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
private getCachedPanels(): ICachedPanel[] {
const registeredPanels = this.getPanels();
const storedStates: Array<string | ICachedPanel> = JSON.parse(this.cachedPanelsValue);
const cachedPanels = storedStates.map(c => {
const serialized: ICachedPanel = typeof c === 'string' /* migration from pinned states to composites states */ ? { id: c, pinned: true, order: undefined, visible: true } : c;
const storedStates = <Array<string | ICachedPanel>>JSON.parse(this.cachedPanelsValue);
const cachedPanels = <ICachedPanel[]>storedStates.map(c => {
const serialized: ICachedPanel = typeof c === 'string' /* migration from pinned states to composites states */ ? <ICachedPanel>{ id: c, pinned: true, order: undefined, visible: true } : c;
const registered = registeredPanels.some(p => p.id === serialized.id);
serialized.visible = registered ? isUndefinedOrNull(serialized.visible) ? true : serialized.visible : false;
return serialized;

View File

@@ -119,7 +119,6 @@
.quick-input-list {
line-height: 22px;
margin-top: 6px;
}
.quick-input-list .monaco-list {

View File

@@ -33,7 +33,7 @@ import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editor
import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { ICommandAndKeybindingRule, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { inQuickOpenContext, InQuickOpenContextKey } from 'vs/workbench/browser/parts/quickopen/quickopen';
import { ActionBar, ActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { ActionBar, ActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { Action } from 'vs/base/common/actions';
import { URI } from 'vs/base/common/uri';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
@@ -1442,11 +1442,11 @@ export class QuickInputService extends Component implements IQuickInputService {
private setEnabled(enabled: boolean) {
if (enabled !== this.enabled) {
this.enabled = enabled;
for (const item of this.ui.leftActionBar.viewItems) {
(item as ActionViewItem).getAction().enabled = enabled;
for (const item of this.ui.leftActionBar.items) {
(item as ActionItem).getAction().enabled = enabled;
}
for (const item of this.ui.rightActionBar.viewItems) {
(item as ActionViewItem).getAction().enabled = enabled;
for (const item of this.ui.rightActionBar.items) {
(item as ActionItem).getAction().enabled = enabled;
}
this.ui.checkAll.disabled = !enabled;
// this.ui.inputBox.enabled = enabled; Avoid loosing focus.

View File

@@ -710,7 +710,7 @@ class EditorHistoryItemAccessorClass extends QuickOpenItemAccessorClass {
}
getItemDescription(entry: QuickOpenEntry): string | null {
return this.allowMatchOnDescription ? types.withUndefinedAsNull(entry.getDescription()) : null;
return this.allowMatchOnDescription ? entry.getDescription() : null;
}
}
@@ -724,8 +724,8 @@ export class EditorHistoryEntryGroup extends QuickOpenEntryGroup {
export class EditorHistoryEntry extends EditorQuickOpenEntry {
private input: IEditorInput | IResourceInput;
private resource: URI | undefined;
private label: string | undefined;
private description?: string;
private label: string | null;
private description: string | null;
private dirty: boolean;
constructor(
@@ -744,8 +744,8 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
if (input instanceof EditorInput) {
this.resource = resourceForEditorHistory(input, fileService);
this.label = types.withNullAsUndefined(input.getName());
this.description = types.withNullAsUndefined(input.getDescription());
this.label = input.getName();
this.description = input.getDescription();
this.dirty = input.isDirty();
} else {
const resourceInput = input as IResourceInput;
@@ -764,7 +764,7 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
return this.dirty ? 'dirty' : '';
}
getLabel(): string | undefined {
getLabel(): string | null {
return this.label;
}
@@ -778,12 +778,12 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
return nls.localize('entryAriaLabel', "{0}, recently opened", this.getLabel());
}
getDescription(): string | undefined {
getDescription(): string | null {
return this.description;
}
getResource(): URI | undefined {
return this.resource;
getResource(): URI | null {
return types.withUndefinedAsNull(this.resource);
}
getInput(): IEditorInput | IResourceInput {
@@ -848,7 +848,7 @@ export class RemoveFromEditorHistoryAction extends Action {
return <IHistoryPickEntry>{
input: h,
iconClasses: getIconClasses(this.modelService, this.modeService, entry.getResource()),
iconClasses: getIconClasses(this.modelService, this.modeService, types.withNullAsUndefined(entry.getResource())),
label: entry.getLabel(),
description: entry.getDescription()
};

View File

@@ -248,7 +248,7 @@ export class SidebarPart extends CompositePart<Viewlet> implements IViewletServi
this.contextMenuService.showContextMenu({
getAnchor: () => anchor,
getActions: () => contextMenuActions,
getActionViewItem: action => this.actionViewItemProvider(action as Action),
getActionItem: action => this.actionItemProvider(action as Action),
actionRunner: activeViewlet.getActionRunner()
});
}

View File

@@ -7,11 +7,11 @@ import 'vs/css!./media/views';
import { Event, Emitter } from 'vs/base/common/event';
import { IDisposable, dispose, Disposable, toDisposable } from 'vs/base/common/lifecycle';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IAction, IActionViewItem, ActionRunner, Action } from 'vs/base/common/actions';
import { IAction, IActionItem, ActionRunner, Action } from 'vs/base/common/actions';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IMenuService, MenuId, MenuItemAction } from 'vs/platform/actions/common/actions';
import { ContextAwareMenuEntryActionViewItem, fillInActionBarActions, fillInContextMenuActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
import { ContextAwareMenuItemActionItem, fillInActionBarActions, fillInContextMenuActions } from 'vs/platform/actions/browser/menuItemActionItem';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IViewsService, ITreeView, ITreeItem, TreeItemCollapsibleState, ITreeViewDataProvider, TreeViewItemHandleArg, ITreeViewDescriptor, IViewsRegistry, ViewContainer, ITreeItemLabel, Extensions } from 'vs/workbench/common/views';
import { IViewletViewOptions, FileIconThemableWorkbenchTree } from 'vs/workbench/browser/parts/views/viewsViewlet';
@@ -24,7 +24,7 @@ import { ICommandService } from 'vs/platform/commands/common/commands';
import * as DOM from 'vs/base/browser/dom';
import { IDataSource, ITree, IRenderer, ContextMenuEvent } from 'vs/base/parts/tree/browser/tree';
import { ResourceLabels, IResourceLabel } from 'vs/workbench/browser/labels';
import { ActionBar, IActionViewItemProvider, ActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { ActionBar, IActionItemProvider, ActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { URI } from 'vs/base/common/uri';
import { dirname, basename } from 'vs/base/common/resources';
import { LIGHT, FileThemeIcon, FolderThemeIcon, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
@@ -87,8 +87,8 @@ export class CustomTreeViewPanel extends ViewletPanel {
return [...this.treeView.getSecondaryActions()];
}
getActionViewItem(action: IAction): IActionViewItem | undefined {
return action instanceof MenuItemAction ? new ContextAwareMenuEntryActionViewItem(action, this.keybindingService, this.notificationService, this.contextMenuService) : undefined;
getActionItem(action: IAction): IActionItem | undefined {
return action instanceof MenuItemAction ? new ContextAwareMenuItemActionItem(action, this.keybindingService, this.notificationService, this.contextMenuService) : undefined;
}
getOptimalWidth(): number {
@@ -378,11 +378,11 @@ export class CustomTreeView extends Disposable implements ITreeView {
}
private createTree() {
const actionViewItemProvider = (action: IAction) => action instanceof MenuItemAction ? this.instantiationService.createInstance(ContextAwareMenuEntryActionViewItem, action) : undefined;
const actionItemProvider = (action: IAction) => action instanceof MenuItemAction ? this.instantiationService.createInstance(ContextAwareMenuItemActionItem, action) : undefined;
const menus = this._register(this.instantiationService.createInstance(TreeMenus, this.id));
this.treeLabels = this._register(this.instantiationService.createInstance(ResourceLabels, this));
const dataSource = this.instantiationService.createInstance(TreeDataSource, this, <T>(task: Promise<T>) => this.progressService.withProgress({ location: this.viewContainer.id }, () => task));
const renderer = this.instantiationService.createInstance(TreeRenderer, this.id, menus, this.treeLabels, actionViewItemProvider);
const renderer = this.instantiationService.createInstance(TreeRenderer, this.id, menus, this.treeLabels, actionItemProvider);
const controller = this.instantiationService.createInstance(TreeController, this.id, menus);
this.tree = this._register(this.instantiationService.createInstance(FileIconThemableWorkbenchTree, this.treeContainer, { dataSource, renderer, controller }, {}));
this.tree.contextKeyService.createKey<boolean>(this.id, true);
@@ -645,7 +645,7 @@ class TreeRenderer implements IRenderer {
private treeViewId: string,
private menus: TreeMenus,
private labels: ResourceLabels,
private actionViewItemProvider: IActionViewItemProvider,
private actionItemProvider: IActionItemProvider,
@IWorkbenchThemeService private readonly themeService: IWorkbenchThemeService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@ILabelService private readonly labelService: ILabelService
@@ -668,7 +668,7 @@ class TreeRenderer implements IRenderer {
DOM.addClass(resourceLabel.element, 'custom-view-tree-node-item-resourceLabel');
const actionsContainer = DOM.append(resourceLabel.element, DOM.$('.actions'));
const actionBar = new ActionBar(actionsContainer, {
actionViewItemProvider: this.actionViewItemProvider,
actionItemProvider: this.actionItemProvider,
actionRunner: new MultipleSelectionActionRunner(() => tree.getSelection())
});
@@ -809,10 +809,10 @@ class TreeController extends WorkbenchTreeController {
getActions: () => actions,
getActionViewItem: (action) => {
getActionItem: (action) => {
const keybinding = this._keybindingService.lookupKeybinding(action.id);
if (keybinding) {
return new ActionViewItem(action, action, { label: true, keybinding: keybinding.getLabel() });
return new ActionItem(action, action, { label: true, keybinding: keybinding.getLabel() });
}
return undefined;
},

View File

@@ -13,7 +13,7 @@ import { append, $, trackFocus, toggleClass, EventType, isAncestor, Dimension, a
import { IDisposable, combinedDisposable } from 'vs/base/common/lifecycle';
import { firstIndex } from 'vs/base/common/arrays';
import { IAction, IActionRunner } from 'vs/base/common/actions';
import { IActionViewItem, ActionsOrientation } from 'vs/base/browser/ui/actionbar/actionbar';
import { IActionItem, ActionsOrientation } from 'vs/base/browser/ui/actionbar/actionbar';
import { Registry } from 'vs/platform/registry/common/platform';
import { prepareActions } from 'vs/workbench/browser/actions';
import { Viewlet, ViewletRegistry, Extensions } from 'vs/workbench/browser/viewlet';
@@ -28,6 +28,7 @@ import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/la
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import { IView } from 'vs/workbench/common/views';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { withNullAsUndefined } from 'vs/base/common/types';
export interface IPanelColors extends IColorMapping {
dropBackground?: ColorIdentifier;
@@ -126,9 +127,9 @@ export abstract class ViewletPanel extends Panel implements IView {
const actions = append(container, $('.actions'));
this.toolbar = new ToolBar(actions, this.contextMenuService, {
orientation: ActionsOrientation.HORIZONTAL,
actionViewItemProvider: action => this.getActionViewItem(action),
actionItemProvider: action => this.getActionItem(action),
ariaLabel: nls.localize('viewToolbarAriaLabel', "{0} actions", this.title),
getKeyBinding: action => this.keybindingService.lookupKeybinding(action.id),
getKeyBinding: action => withNullAsUndefined(this.keybindingService.lookupKeybinding(action.id)),
actionRunner: this.actionRunner
});
@@ -179,7 +180,7 @@ export abstract class ViewletPanel extends Panel implements IView {
return [];
}
getActionViewItem(action: IAction): IActionViewItem | undefined {
getActionItem(action: IAction): IActionItem | undefined {
return undefined;
}
@@ -288,12 +289,12 @@ export class PanelViewlet extends Viewlet {
return [];
}
getActionViewItem(action: IAction): IActionViewItem | undefined {
getActionItem(action: IAction): IActionItem | undefined {
if (this.isSingleView()) {
return this.panelItems[0].panel.getActionViewItem(action);
return this.panelItems[0].panel.getActionItem(action);
}
return super.getActionViewItem(action);
return super.getActionItem(action);
}
focus(): void {

View File

@@ -229,12 +229,12 @@ export interface IEditorQuickOpenEntry {
/**
* The editor input used for this entry when opening.
*/
getInput(): IResourceInput | IEditorInput | undefined;
getInput(): IResourceInput | IEditorInput | null;
/**
* The editor options used for this entry when opening.
*/
getOptions(): IEditorOptions | undefined;
getOptions(): IEditorOptions | null;
}
/**
@@ -250,12 +250,12 @@ export class EditorQuickOpenEntry extends QuickOpenEntry implements IEditorQuick
return this._editorService;
}
getInput(): IResourceInput | IEditorInput | undefined {
return undefined;
getInput(): IResourceInput | IEditorInput | null {
return null;
}
getOptions(): IEditorOptions | undefined {
return undefined;
getOptions(): IEditorOptions | null {
return null;
}
run(mode: Mode, context: IEntryRunContext): boolean {
@@ -301,12 +301,12 @@ export class EditorQuickOpenEntry extends QuickOpenEntry implements IEditorQuick
*/
export class EditorQuickOpenEntryGroup extends QuickOpenEntryGroup implements IEditorQuickOpenEntry {
getInput(): IEditorInput | IResourceInput | undefined {
return undefined;
getInput(): IEditorInput | IResourceInput | null {
return null;
}
getOptions(): IEditorOptions | undefined {
return undefined;
getOptions(): IEditorOptions | null {
return null;
}
}

View File

@@ -14,7 +14,7 @@ import { getZoomLevel } from 'vs/base/browser/browser';
import { mark } from 'vs/base/common/performance';
import { onUnexpectedError, setUnexpectedErrorHandler } from 'vs/base/common/errors';
import { Registry } from 'vs/platform/registry/common/platform';
import { isWindows, isLinux, isWeb } from 'vs/base/common/platform';
import { isWindows, isLinux } from 'vs/base/common/platform';
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
import { IEditorInputFactoryRegistry, Extensions as EditorExtensions } from 'vs/workbench/common/editor';
import { IActionBarRegistry, Extensions as ActionBarExtensions } from 'vs/workbench/browser/actions';
@@ -270,11 +270,7 @@ export class Workbench extends Layout {
]);
addClasses(this.container, ...workbenchClasses);
addClass(document.body, platformClass); // used by our fonts
if (isWeb) {
addClass(document.body, 'web');
}
addClasses(document.body, platformClass); // used by our fonts
// Apply font aliasing
this.setFontAliasing(configurationService);