Merge remote-tracking branch 'origin/master' into tyriar/6979_terminal_themes

This commit is contained in:
Daniel Imms
2016-10-08 13:57:59 -07:00
1207 changed files with 22263 additions and 31486 deletions

View File

@@ -4,46 +4,46 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {Emitter} from 'vs/base/common/event';
import {score} from 'vs/editor/common/modes/languageSelector';
import { Emitter } from 'vs/base/common/event';
import { score } from 'vs/editor/common/modes/languageSelector';
import * as Platform from 'vs/base/common/platform';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import * as errors from 'vs/base/common/errors';
import product from 'vs/platform/product';
import pkg from 'vs/platform/package';
import {ExtHostFileSystemEventService} from 'vs/workbench/api/node/extHostFileSystemEventService';
import {ExtHostDocuments} from 'vs/workbench/api/node/extHostDocuments';
import {ExtHostDocumentSaveParticipant} from 'vs/workbench/api/node/extHostDocumentSaveParticipant';
import {ExtHostConfiguration} from 'vs/workbench/api/node/extHostConfiguration';
import {ExtHostDiagnostics} from 'vs/workbench/api/node/extHostDiagnostics';
import {ExtHostWorkspace} from 'vs/workbench/api/node/extHostWorkspace';
import {ExtHostQuickOpen} from 'vs/workbench/api/node/extHostQuickOpen';
import {ExtHostHeapService} from 'vs/workbench/api/node/extHostHeapService';
import {ExtHostStatusBar} from 'vs/workbench/api/node/extHostStatusBar';
import {ExtHostCommands} from 'vs/workbench/api/node/extHostCommands';
import {ExtHostOutputService} from 'vs/workbench/api/node/extHostOutputService';
import {ExtHostTerminalService} from 'vs/workbench/api/node/extHostTerminalService';
import {ExtHostMessageService} from 'vs/workbench/api/node/extHostMessageService';
import {ExtHostEditors} from 'vs/workbench/api/node/extHostEditors';
import {ExtHostLanguages} from 'vs/workbench/api/node/extHostLanguages';
import {ExtHostLanguageFeatures} from 'vs/workbench/api/node/extHostLanguageFeatures';
import { ExtHostFileSystemEventService } from 'vs/workbench/api/node/extHostFileSystemEventService';
import { ExtHostDocuments } from 'vs/workbench/api/node/extHostDocuments';
import { ExtHostDocumentSaveParticipant } from 'vs/workbench/api/node/extHostDocumentSaveParticipant';
import { ExtHostConfiguration } from 'vs/workbench/api/node/extHostConfiguration';
import { ExtHostDiagnostics } from 'vs/workbench/api/node/extHostDiagnostics';
import { ExtHostWorkspace } from 'vs/workbench/api/node/extHostWorkspace';
import { ExtHostQuickOpen } from 'vs/workbench/api/node/extHostQuickOpen';
import { ExtHostHeapService } from 'vs/workbench/api/node/extHostHeapService';
import { ExtHostStatusBar } from 'vs/workbench/api/node/extHostStatusBar';
import { ExtHostCommands } from 'vs/workbench/api/node/extHostCommands';
import { ExtHostOutputService } from 'vs/workbench/api/node/extHostOutputService';
import { ExtHostTerminalService } from 'vs/workbench/api/node/extHostTerminalService';
import { ExtHostMessageService } from 'vs/workbench/api/node/extHostMessageService';
import { ExtHostEditors } from 'vs/workbench/api/node/extHostEditors';
import { ExtHostLanguages } from 'vs/workbench/api/node/extHostLanguages';
import { ExtHostLanguageFeatures } from 'vs/workbench/api/node/extHostLanguageFeatures';
import * as ExtHostTypeConverters from 'vs/workbench/api/node/extHostTypeConverters';
import {registerApiCommands} from 'vs/workbench/api/node/extHostApiCommands';
import { registerApiCommands } from 'vs/workbench/api/node/extHostApiCommands';
import * as extHostTypes from 'vs/workbench/api/node/extHostTypes';
import Modes = require('vs/editor/common/modes');
import URI from 'vs/base/common/uri';
import Severity from 'vs/base/common/severity';
import EditorCommon = require('vs/editor/common/editorCommon');
import {IExtensionDescription} from 'vs/platform/extensions/common/extensions';
import {ExtHostExtensionService} from 'vs/workbench/api/node/extHostExtensionService';
import {ExtensionsRegistry} from 'vs/platform/extensions/common/extensionsRegistry';
import {TPromise} from 'vs/base/common/winjs.base';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {CancellationTokenSource} from 'vs/base/common/cancellation';
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { ExtHostExtensionService } from 'vs/workbench/api/node/extHostExtensionService';
import { ExtensionsRegistry } from 'vs/platform/extensions/common/extensionsRegistry';
import { TPromise } from 'vs/base/common/winjs.base';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { CancellationTokenSource } from 'vs/base/common/cancellation';
import vscode = require('vscode');
import * as paths from 'vs/base/common/paths';
import {ITelemetryService, ITelemetryInfo} from 'vs/platform/telemetry/common/telemetry';
import {MainContext, ExtHostContext, InstanceCollection} from './extHost.protocol';
import { ITelemetryService, ITelemetryInfo } from 'vs/platform/telemetry/common/telemetry';
import { MainContext, ExtHostContext, InstanceCollection } from './extHost.protocol';
/**
* This class implements the API described in vscode.d.ts,
@@ -228,7 +228,7 @@ export class ExtHostAPIImplementation {
showTextDocument(document: vscode.TextDocument, column?: vscode.ViewColumn, preserveFocus?: boolean): TPromise<vscode.TextEditor> {
return extHostEditors.showTextDocument(document, column, preserveFocus);
},
createTextEditorDecorationType(options:vscode.DecorationRenderOptions): vscode.TextEditorDecorationType {
createTextEditorDecorationType(options: vscode.DecorationRenderOptions): vscode.TextEditorDecorationType {
return extHostEditors.createTextEditorDecorationType(options);
},
onDidChangeActiveTextEditor: extHostEditors.onDidChangeActiveTextEditor.bind(extHostEditors),
@@ -335,7 +335,7 @@ export class ExtHostAPIImplementation {
onDidChangeConfiguration: (listener: () => any, thisArgs?: any, disposables?: extHostTypes.Disposable[]) => {
return extHostConfiguration.onDidChangeConfiguration(listener, thisArgs, disposables);
},
getConfiguration: (section?: string):vscode.WorkspaceConfiguration => {
getConfiguration: (section?: string): vscode.WorkspaceConfiguration => {
return extHostConfiguration.getConfiguration(section);
}
});
@@ -348,7 +348,7 @@ export class ExtHostAPIImplementation {
return languages.getLanguages();
},
match(selector: vscode.DocumentSelector, document: vscode.TextDocument): number {
return score(selector, <any> document.uri, document.languageId);
return score(selector, <any>document.uri, document.languageId);
},
registerCodeActionsProvider(selector: vscode.DocumentSelector, provider: vscode.CodeActionProvider): vscode.Disposable {
return languageFeatures.registerCodeActionProvider(selector, provider);
@@ -395,20 +395,20 @@ export class ExtHostAPIImplementation {
registerDocumentLinkProvider(selector: vscode.DocumentSelector, provider: vscode.DocumentLinkProvider): vscode.Disposable {
return languageFeatures.registerDocumentLinkProvider(selector, provider);
},
setLanguageConfiguration: (language: string, configuration: vscode.LanguageConfiguration):vscode.Disposable => {
setLanguageConfiguration: (language: string, configuration: vscode.LanguageConfiguration): vscode.Disposable => {
return languageFeatures.setLanguageConfiguration(language, configuration);
}
};
this.extensions = {
getExtension(extensionId: string):Extension<any> {
getExtension(extensionId: string): Extension<any> {
let desc = ExtensionsRegistry.getExtensionDescription(extensionId);
if (desc) {
return new Extension(<ExtHostExtensionService> extensionService, desc);
return new Extension(<ExtHostExtensionService>extensionService, desc);
}
},
get all():Extension<any>[] {
return ExtensionsRegistry.getAllExtensionDescriptions().map((desc) => new Extension(<ExtHostExtensionService> extensionService, desc));
get all(): Extension<any>[] {
return ExtensionsRegistry.getAllExtensionDescriptions().map((desc) => new Extension(<ExtHostExtensionService>extensionService, desc));
}
};
}
@@ -422,7 +422,7 @@ class Extension<T> implements vscode.Extension<T> {
public extensionPath: string;
public packageJSON: any;
constructor(extensionService:ExtHostExtensionService, description:IExtensionDescription) {
constructor(extensionService: ExtHostExtensionService, description: IExtensionDescription) {
this._extensionService = extensionService;
this.id = description.id;
this.extensionPath = paths.normalize(description.extensionFolderPath, true);

View File

@@ -5,41 +5,41 @@
'use strict';
import {IWorkbenchContribution} from 'vs/workbench/common/contributions';
import {Registry} from 'vs/platform/platform';
import {IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions} from 'vs/workbench/common/contributions';
import {IInstantiationService, IConstructorSignature0} from 'vs/platform/instantiation/common/instantiation';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import {MainContext, InstanceCollection} from './extHost.protocol';
import {IExtensionService} from 'vs/platform/extensions/common/extensions';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { Registry } from 'vs/platform/platform';
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
import { IInstantiationService, IConstructorSignature0 } from 'vs/platform/instantiation/common/instantiation';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { MainContext, InstanceCollection } from './extHost.protocol';
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
// --- addressable
import {MainThreadCommands} from './mainThreadCommands';
import {MainThreadConfiguration} from './mainThreadConfiguration';
import {MainThreadDiagnostics} from './mainThreadDiagnostics';
import {MainThreadDocuments} from './mainThreadDocuments';
import {MainThreadEditors} from './mainThreadEditors';
import {MainThreadErrors} from './mainThreadErrors';
import {MainThreadLanguageFeatures} from './mainThreadLanguageFeatures';
import {MainThreadLanguages} from './mainThreadLanguages';
import {MainThreadMessageService} from './mainThreadMessageService';
import {MainThreadOutputService} from './mainThreadOutputService';
import {MainThreadQuickOpen} from './mainThreadQuickOpen';
import {MainThreadStatusBar} from './mainThreadStatusBar';
import {MainThreadStorage} from './mainThreadStorage';
import {MainThreadTelemetry} from './mainThreadTelemetry';
import {MainThreadTerminalService} from './mainThreadTerminalService';
import {MainThreadWorkspace} from './mainThreadWorkspace';
import {MainProcessExtensionService} from './mainThreadExtensionService';
import {MainThreadFileSystemEventService} from './mainThreadFileSystemEventService';
import {MainThreadHeapService} from './mainThreadHeapService';
import { MainThreadCommands } from './mainThreadCommands';
import { MainThreadConfiguration } from './mainThreadConfiguration';
import { MainThreadDiagnostics } from './mainThreadDiagnostics';
import { MainThreadDocuments } from './mainThreadDocuments';
import { MainThreadEditors } from './mainThreadEditors';
import { MainThreadErrors } from './mainThreadErrors';
import { MainThreadLanguageFeatures } from './mainThreadLanguageFeatures';
import { MainThreadLanguages } from './mainThreadLanguages';
import { MainThreadMessageService } from './mainThreadMessageService';
import { MainThreadOutputService } from './mainThreadOutputService';
import { MainThreadQuickOpen } from './mainThreadQuickOpen';
import { MainThreadStatusBar } from './mainThreadStatusBar';
import { MainThreadStorage } from './mainThreadStorage';
import { MainThreadTelemetry } from './mainThreadTelemetry';
import { MainThreadTerminalService } from './mainThreadTerminalService';
import { MainThreadWorkspace } from './mainThreadWorkspace';
import { MainProcessExtensionService } from './mainThreadExtensionService';
import { MainThreadFileSystemEventService } from './mainThreadFileSystemEventService';
import { MainThreadHeapService } from './mainThreadHeapService';
// --- other interested parties
import {MainProcessTextMateSyntax} from 'vs/editor/node/textMate/TMSyntax';
import {MainProcessTextMateSnippet} from 'vs/editor/node/textMate/TMSnippets';
import {JSONValidationExtensionPoint} from 'vs/platform/jsonschemas/common/jsonValidationExtensionPoint';
import {LanguageConfigurationFileHandler} from 'vs/editor/node/languageConfiguration';
import {SaveParticipant} from './mainThreadSaveParticipant';
import { MainProcessTextMateSyntax } from 'vs/editor/node/textMate/TMSyntax';
import { MainProcessTextMateSnippet } from 'vs/editor/node/textMate/TMSnippets';
import { JSONValidationExtensionPoint } from 'vs/platform/jsonschemas/common/jsonValidationExtensionPoint';
import { LanguageConfigurationFileHandler } from 'vs/editor/node/languageConfiguration';
import { SaveParticipant } from './mainThreadSaveParticipant';
export class ExtHostContribution implements IWorkbenchContribution {

View File

@@ -30,7 +30,7 @@ import { IResourceEdit } from 'vs/editor/common/services/bulkEdit';
import { ConfigurationTarget } from 'vs/workbench/services/configuration/common/configurationEditing';
import { IPickOpenEntry, IPickOptions } from 'vs/workbench/services/quickopen/common/quickOpenService';
import { SaveReason } from 'vs/workbench/parts/files/common/files';
import { SaveReason } from 'vs/workbench/services/textfile/common/textfiles';
import { IWorkspaceSymbol } from 'vs/workbench/parts/search/common/search';
import { IApplyEditsOptions, TextEditorRevealType, ITextEditorConfigurationUpdate, IResolvedTextEditorConfiguration, ISelectionChangeEvent } from './mainThreadEditorsTracker';

View File

@@ -5,21 +5,21 @@
'use strict';
import URI from 'vs/base/common/uri';
import {TPromise} from 'vs/base/common/winjs.base';
import {IDisposable} from 'vs/base/common/lifecycle';
import { TPromise } from 'vs/base/common/winjs.base';
import { IDisposable } from 'vs/base/common/lifecycle';
import * as vscode from 'vscode';
import * as typeConverters from 'vs/workbench/api/node/extHostTypeConverters';
import * as types from 'vs/workbench/api/node/extHostTypes';
import {ISingleEditOperation} from 'vs/editor/common/editorCommon';
import { ISingleEditOperation } from 'vs/editor/common/editorCommon';
import * as modes from 'vs/editor/common/modes';
import {ICommandHandlerDescription} from 'vs/platform/commands/common/commands';
import {ExtHostCommands} from 'vs/workbench/api/node/extHostCommands';
import {IQuickFix2} from 'vs/editor/contrib/quickFix/common/quickFix';
import {IOutline} from 'vs/editor/contrib/quickOpen/common/quickOpen';
import {IWorkspaceSymbolProvider, IWorkspaceSymbol} from 'vs/workbench/parts/search/common/search';
import {ICodeLensData} from 'vs/editor/contrib/codelens/common/codelens';
import { ICommandHandlerDescription } from 'vs/platform/commands/common/commands';
import { ExtHostCommands } from 'vs/workbench/api/node/extHostCommands';
import { IQuickFix2 } from 'vs/editor/contrib/quickFix/common/quickFix';
import { IOutline } from 'vs/editor/contrib/quickOpen/common/quickOpen';
import { IWorkspaceSymbolProvider, IWorkspaceSymbol } from 'vs/workbench/parts/search/common/search';
import { ICodeLensData } from 'vs/editor/contrib/codelens/common/codelens';
export function registerApiCommands(commands:ExtHostCommands) {
export function registerApiCommands(commands: ExtHostCommands) {
new ExtHostApiCommands(commands).registerCommands();
}
@@ -177,12 +177,12 @@ class ExtHostApiCommands {
The body element of the displayed html is dynamically annotated with one of the following css classes in order to
communicate the kind of color theme vscode is currently using: \`vscode-light\`, \`vscode-dark\`, or \`vscode-high-contrast\'.
`,
args: [
{ name: 'uri', description: 'Uri of the resource to preview.', constraint: value => value instanceof URI || typeof value === 'string' },
{ name: 'column', description: '(optional) Column in which to preview.', constraint: value => typeof value === 'undefined' || (typeof value === 'number' && typeof types.ViewColumn[value] === 'string') },
{ name: 'label', description: '(optional) An human readable string that is used as title for the preview.', constraint: v => typeof v === 'string' || typeof v === 'undefined' }
]
});
args: [
{ name: 'uri', description: 'Uri of the resource to preview.', constraint: value => value instanceof URI || typeof value === 'string' },
{ name: 'column', description: '(optional) Column in which to preview.', constraint: value => typeof value === 'undefined' || (typeof value === 'number' && typeof types.ViewColumn[value] === 'string') },
{ name: 'label', description: '(optional) An human readable string that is used as title for the preview.', constraint: v => typeof v === 'string' || typeof v === 'undefined' }
]
});
this._register('vscode.openFolder', (uri?: URI, newWindow?: boolean) => {
if (!uri) {
@@ -191,32 +191,32 @@ class ExtHostApiCommands {
return this._commands.executeCommand('_workbench.ipc', 'vscode:windowOpen', [[uri.fsPath], newWindow]);
}, {
description: 'Open a folder in the current window or new window depending on the newWindow argument. Note that opening in the same window will shutdown the current extension host process and start a new one on the given folder unless the newWindow parameter is set to true.',
args: [
{ name: 'uri', description: '(optional) Uri of the folder to open. If not provided, a native dialog will ask the user for the folder', constraint: value => value === void 0 || value instanceof URI },
{ name: 'newWindow', description: '(optional) Wether to open the folder in a new window or the same. Defaults to opening in the same window.', constraint: value => value === void 0 || typeof value === 'boolean' }
]
});
description: 'Open a folder in the current window or new window depending on the newWindow argument. Note that opening in the same window will shutdown the current extension host process and start a new one on the given folder unless the newWindow parameter is set to true.',
args: [
{ name: 'uri', description: '(optional) Uri of the folder to open. If not provided, a native dialog will ask the user for the folder', constraint: value => value === void 0 || value instanceof URI },
{ name: 'newWindow', description: '(optional) Wether to open the folder in a new window or the same. Defaults to opening in the same window.', constraint: value => value === void 0 || typeof value === 'boolean' }
]
});
this._register('vscode.startDebug', (configuration?: any) => {
return this._commands.executeCommand('_workbench.startDebug', configuration);
}, {
description: 'Start a debugging session.',
args: [
{ name: 'configuration', description: '(optional) Name of the debug configuration from \'launch.json\' to use. Or a configuration json object to use.' }
]
});
description: 'Start a debugging session.',
args: [
{ name: 'configuration', description: '(optional) Name of the debug configuration from \'launch.json\' to use. Or a configuration json object to use.' }
]
});
this._register('vscode.diff', (left: URI, right: URI, label: string) => {
return this._commands.executeCommand('_workbench.diff', [left, right, label]);
}, {
description: 'Opens the provided resources in the diff editor to compare their contents.',
args: [
{ name: 'left', description: 'Left-hand side resource of the diff editor', constraint: URI },
{ name: 'right', description: 'Right-hand side resource of the diff editor', constraint: URI },
{ name: 'title', description: '(optional) Human readable title for the diff editor', constraint: v => v === void 0 || typeof v === 'string' }
]
});
description: 'Opens the provided resources in the diff editor to compare their contents.',
args: [
{ name: 'left', description: 'Left-hand side resource of the diff editor', constraint: URI },
{ name: 'right', description: 'Right-hand side resource of the diff editor', constraint: URI },
{ name: 'title', description: '(optional) Human readable title for the diff editor', constraint: v => v === void 0 || typeof v === 'string' }
]
});
this._register('vscode.open', (resource: URI, column: vscode.ViewColumn) => {
return this._commands.executeCommand('_workbench.open', [resource, typeConverters.fromViewColumn(column)]);
@@ -336,7 +336,7 @@ class ExtHostApiCommands {
});
}
private _executeCompletionItemProvider(resource: URI, position: types.Position, triggerCharacter: string): Thenable<types.CompletionItem[]|types.CompletionList> {
private _executeCompletionItemProvider(resource: URI, position: types.Position, triggerCharacter: string): Thenable<types.CompletionItem[] | types.CompletionList> {
const args = {
resource,
position: position && typeConverters.fromPosition(position),

View File

@@ -4,15 +4,15 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import {validateConstraint} from 'vs/base/common/types';
import {ICommandHandlerDescription} from 'vs/platform/commands/common/commands';
import {TPromise} from 'vs/base/common/winjs.base';
import {ExtHostEditors} from 'vs/workbench/api/node/extHostEditors';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { validateConstraint } from 'vs/base/common/types';
import { ICommandHandlerDescription } from 'vs/platform/commands/common/commands';
import { TPromise } from 'vs/base/common/winjs.base';
import { ExtHostEditors } from 'vs/workbench/api/node/extHostEditors';
import * as extHostTypes from 'vs/workbench/api/node/extHostTypes';
import * as extHostTypeConverter from 'vs/workbench/api/node/extHostTypeConverters';
import {cloneAndChange} from 'vs/base/common/objects';
import {MainContext, MainThreadCommandsShape, ExtHostCommandsShape} from './extHost.protocol';
import { cloneAndChange } from 'vs/base/common/objects';
import { MainContext, MainThreadCommandsShape, ExtHostCommandsShape } from './extHost.protocol';
interface CommandHandler {
callback: Function;
@@ -28,7 +28,7 @@ export class ExtHostCommands extends ExtHostCommandsShape {
constructor(
threadService: IThreadService,
extHostEditors:ExtHostEditors
extHostEditors: ExtHostEditors
) {
super();
this._extHostEditors = extHostEditors;
@@ -65,7 +65,7 @@ export class ExtHostCommands extends ExtHostCommandsShape {
} else {
// automagically convert some argument types
args = cloneAndChange(args, function(value) {
args = cloneAndChange(args, function (value) {
if (value instanceof extHostTypes.Position) {
return extHostTypeConverter.fromPosition(value);
}

View File

@@ -4,15 +4,15 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {localize} from 'vs/nls';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import {IMarkerData} from 'vs/platform/markers/common/markers';
import { localize } from 'vs/nls';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { IMarkerData } from 'vs/platform/markers/common/markers';
import URI from 'vs/base/common/uri';
import {compare} from 'vs/base/common/strings';
import { compare } from 'vs/base/common/strings';
import Severity from 'vs/base/common/severity';
import * as vscode from 'vscode';
import {MainContext, MainThreadDiagnosticsShape, ExtHostDiagnosticsShape} from './extHost.protocol';
import {DiagnosticSeverity} from './extHostTypes';
import { MainContext, MainThreadDiagnosticsShape, ExtHostDiagnosticsShape } from './extHost.protocol';
import { DiagnosticSeverity } from './extHostTypes';
export class DiagnosticCollection implements vscode.DiagnosticCollection {
@@ -22,7 +22,7 @@ export class DiagnosticCollection implements vscode.DiagnosticCollection {
private _proxy: MainThreadDiagnosticsShape;
private _isDisposed = false;
private _data: {[uri:string]: vscode.Diagnostic[]} = Object.create(null);
private _data: { [uri: string]: vscode.Diagnostic[] } = Object.create(null);
constructor(name: string, proxy: MainThreadDiagnosticsShape) {
this._name = name;
@@ -130,7 +130,7 @@ export class DiagnosticCollection implements vscode.DiagnosticCollection {
}
}
entries.push([<URI> uri, marker]);
entries.push([<URI>uri, marker]);
}
this._proxy.$changeMany(this.name, entries);
@@ -139,7 +139,7 @@ export class DiagnosticCollection implements vscode.DiagnosticCollection {
delete(uri: vscode.Uri): void {
this._checkDisposed();
delete this._data[uri.toString()];
this._proxy.$changeMany(this.name, [[<URI> uri, undefined]]);
this._proxy.$changeMany(this.name, [[<URI>uri, undefined]]);
}
clear(): void {

View File

@@ -15,7 +15,7 @@ import { TextEdit } from 'vs/workbench/api/node/extHostTypes';
import { fromRange, TextDocumentSaveReason } from 'vs/workbench/api/node/extHostTypeConverters';
import { IResourceEdit } from 'vs/editor/common/services/bulkEdit';
import { ExtHostDocuments } from 'vs/workbench/api/node/extHostDocuments';
import { SaveReason } from 'vs/workbench/parts/files/common/files';
import { SaveReason } from 'vs/workbench/services/textfile/common/textfiles';
declare class WeakMap<K, V> {
// delete(key: K): boolean;
@@ -73,7 +73,7 @@ export class ExtHostDocumentSaveParticipant extends ExtHostDocumentSaveParticipa
}
const document = this._documents.getDocumentData(resource).document;
return this._deliverEventAsyncAndBlameBadListeners(fn, thisArg, <any> { document, reason: TextDocumentSaveReason.to(reason) });
return this._deliverEventAsyncAndBlameBadListeners(fn, thisArg, <any>{ document, reason: TextDocumentSaveReason.to(reason) });
};
}));

View File

@@ -4,20 +4,20 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {onUnexpectedError} from 'vs/base/common/errors';
import { onUnexpectedError } from 'vs/base/common/errors';
import * as editorCommon from 'vs/editor/common/editorCommon';
import {MirrorModel2} from 'vs/editor/common/model/mirrorModel2';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import Event, {Emitter} from 'vs/base/common/event';
import { MirrorModel2 } from 'vs/editor/common/model/mirrorModel2';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import Event, { Emitter } from 'vs/base/common/event';
import URI from 'vs/base/common/uri';
import {IDisposable} from 'vs/base/common/lifecycle';
import {Range, Position, Disposable} from 'vs/workbench/api/node/extHostTypes';
import { IDisposable } from 'vs/base/common/lifecycle';
import { Range, Position, Disposable } from 'vs/workbench/api/node/extHostTypes';
import * as TypeConverters from './extHostTypeConverters';
import {TPromise} from 'vs/base/common/winjs.base';
import { TPromise } from 'vs/base/common/winjs.base';
import * as vscode from 'vscode';
import {asWinJsPromise} from 'vs/base/common/async';
import {getWordAtText, ensureValidWordDefinition} from 'vs/editor/common/model/wordHelper';
import {MainContext, MainThreadDocumentsShape, ExtHostDocumentsShape, IModelAddedData} from './extHost.protocol';
import { asWinJsPromise } from 'vs/base/common/async';
import { getWordAtText, ensureValidWordDefinition } from 'vs/editor/common/model/wordHelper';
import { MainContext, MainThreadDocumentsShape, ExtHostDocumentsShape, IModelAddedData } from './extHost.protocol';
const _modeId2WordDefinition: {
[modeId: string]: RegExp;

View File

@@ -5,18 +5,18 @@
'use strict';
import URI from 'vs/base/common/uri';
import {readonly, illegalArgument} from 'vs/base/common/errors';
import {IdGenerator} from 'vs/base/common/idGenerator';
import Event, {Emitter} from 'vs/base/common/event';
import {TPromise} from 'vs/base/common/winjs.base';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import {ExtHostDocuments, ExtHostDocumentData} from 'vs/workbench/api/node/extHostDocuments';
import {Selection, Range, Position, EditorOptions, EndOfLine, TextEditorRevealType, TextEditorSelectionChangeKind} from './extHostTypes';
import {ISingleEditOperation} from 'vs/editor/common/editorCommon';
import {IResolvedTextEditorConfiguration, ISelectionChangeEvent} from 'vs/workbench/api/node/mainThreadEditorsTracker';
import { readonly, illegalArgument } from 'vs/base/common/errors';
import { IdGenerator } from 'vs/base/common/idGenerator';
import Event, { Emitter } from 'vs/base/common/event';
import { TPromise } from 'vs/base/common/winjs.base';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { ExtHostDocuments, ExtHostDocumentData } from 'vs/workbench/api/node/extHostDocuments';
import { Selection, Range, Position, EditorOptions, EndOfLine, TextEditorRevealType, TextEditorSelectionChangeKind } from './extHostTypes';
import { ISingleEditOperation } from 'vs/editor/common/editorCommon';
import { IResolvedTextEditorConfiguration, ISelectionChangeEvent } from 'vs/workbench/api/node/mainThreadEditorsTracker';
import * as TypeConverters from './extHostTypeConverters';
import {TextDocument, TextEditorSelectionChangeEvent, TextEditorOptionsChangeEvent, TextEditorOptions, TextEditorViewColumnChangeEvent, ViewColumn} from 'vscode';
import {MainContext, MainThreadEditorsShape, ExtHostEditorsShape, ITextEditorAddData, ITextEditorPositionData} from './extHost.protocol';
import { TextDocument, TextEditorSelectionChangeEvent, TextEditorOptionsChangeEvent, TextEditorOptions, TextEditorViewColumnChangeEvent, ViewColumn } from 'vscode';
import { MainContext, MainThreadEditorsShape, ExtHostEditorsShape, ITextEditorAddData, ITextEditorPositionData } from './extHost.protocol';
export class ExtHostEditors extends ExtHostEditorsShape {
@@ -71,7 +71,7 @@ export class ExtHostEditors extends ExtHostEditorsShape {
}
showTextDocument(document: TextDocument, column: ViewColumn, preserveFocus: boolean): TPromise<vscode.TextEditor> {
return this._proxy.$tryShowTextDocument(<URI> document.uri, TypeConverters.fromViewColumn(column), preserveFocus).then(id => {
return this._proxy.$tryShowTextDocument(<URI>document.uri, TypeConverters.fromViewColumn(column), preserveFocus).then(id => {
let editor = this._editors[id];
if (editor) {
return editor;
@@ -181,8 +181,8 @@ export interface IEditData {
documentVersionId: number;
edits: ITextEditOperation[];
setEndOfLine: EndOfLine;
undoStopBefore:boolean;
undoStopAfter:boolean;
undoStopBefore: boolean;
undoStopAfter: boolean;
}
export class TextEditorEdit {
@@ -193,7 +193,7 @@ export class TextEditorEdit {
private _undoStopBefore: boolean;
private _undoStopAfter: boolean;
constructor(document: vscode.TextDocument, options:{ undoStopBefore: boolean; undoStopAfter: boolean; }) {
constructor(document: vscode.TextDocument, options: { undoStopBefore: boolean; undoStopAfter: boolean; }) {
this._documentVersionId = document.version;
this._collectedEdits = [];
this._setEndOfLine = 0;
@@ -253,7 +253,7 @@ export class TextEditorEdit {
});
}
setEndOfLine(endOfLine:EndOfLine): void {
setEndOfLine(endOfLine: EndOfLine): void {
if (endOfLine !== EndOfLine.LF && endOfLine !== EndOfLine.CRLF) {
throw illegalArgument('endOfLine');
}
@@ -266,7 +266,7 @@ export class TextEditorEdit {
function deprecated(name: string, message: string = 'Refer to the documentation for further details.') {
return (target: Object, key: string, descriptor: TypedPropertyDescriptor<any>) => {
const originalMethod = descriptor.value;
descriptor.value = function(...args: any[]) {
descriptor.value = function (...args: any[]) {
console.warn(`[Deprecation Warning] method '${name}' is deprecated and should no longer be used. ${message}`);
return originalMethod.apply(this, args);
};
@@ -406,7 +406,7 @@ class ExtHostTextEditor implements vscode.TextEditor {
// ---- editing
edit(callback: (edit: TextEditorEdit) => void, options:{ undoStopBefore: boolean; undoStopAfter: boolean; } = { undoStopBefore: true, undoStopAfter: true }): Thenable<boolean> {
edit(callback: (edit: TextEditorEdit) => void, options: { undoStopBefore: boolean; undoStopAfter: boolean; } = { undoStopBefore: true, undoStopAfter: true }): Thenable<boolean> {
let edit = new TextEditorEdit(this._documentData.document, options);
callback(edit);
return this._applyEdit(edit);

View File

@@ -4,18 +4,18 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {dispose} from 'vs/base/common/lifecycle';
import {IDisposable} from 'vs/base/common/lifecycle';
import { dispose } from 'vs/base/common/lifecycle';
import { IDisposable } from 'vs/base/common/lifecycle';
import * as paths from 'vs/base/common/paths';
import Severity from 'vs/base/common/severity';
import {TPromise} from 'vs/base/common/winjs.base';
import {AbstractExtensionService, ActivatedExtension} from 'vs/platform/extensions/common/abstractExtensionService';
import {IMessage, IExtensionDescription} from 'vs/platform/extensions/common/extensions';
import {ExtensionsRegistry} from 'vs/platform/extensions/common/extensionsRegistry';
import {ExtHostStorage} from 'vs/workbench/api/node/extHostStorage';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import {MainContext, MainProcessExtensionServiceShape} from './extHost.protocol';
import { TPromise } from 'vs/base/common/winjs.base';
import { AbstractExtensionService, ActivatedExtension } from 'vs/platform/extensions/common/abstractExtensionService';
import { IMessage, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { ExtensionsRegistry } from 'vs/platform/extensions/common/extensionsRegistry';
import { ExtHostStorage } from 'vs/workbench/api/node/extHostStorage';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { MainContext, MainProcessExtensionServiceShape } from './extHost.protocol';
const hasOwnProperty = Object.hasOwnProperty;
@@ -148,16 +148,21 @@ export class ExtHostExtensionService extends AbstractExtensionService<ExtHostExt
return this._activatedExtensions[extensionId].exports;
}
public deactivate(extensionId: string): void {
public deactivate(extensionId: string): TPromise<void> {
let result: TPromise<void> = TPromise.as(void 0);
let extension = this._activatedExtensions[extensionId];
if (!extension) {
return;
return result;
}
// call deactivate if available
try {
if (typeof extension.module.deactivate === 'function') {
extension.module.deactivate();
result = TPromise.wrap(extension.module.deactivate()).then(null, (err) => {
// TODO: Do something with err if this is not the shutdown case
return TPromise.as(void 0);
});
}
} catch (err) {
// TODO: Do something with err if this is not the shutdown case
@@ -169,6 +174,8 @@ export class ExtHostExtensionService extends AbstractExtensionService<ExtHostExt
} catch (err) {
// TODO: Do something with err if this is not the shutdown case
}
return result;
}
public registrationDone(messages: IMessage[]): void {
@@ -194,7 +201,7 @@ export class ExtHostExtensionService extends AbstractExtensionService<ExtHostExt
let globalState = new ExtensionMemento(extensionDescription.id, true, this._storage);
let workspaceState = new ExtensionMemento(extensionDescription.id, false, this._storage);
let storagePath = this._workspaceStoragePath ? paths.normalize(paths.join(this._workspaceStoragePath, extensionDescription.id)): undefined;
let storagePath = this._workspaceStoragePath ? paths.normalize(paths.join(this._workspaceStoragePath, extensionDescription.id)) : undefined;
return TPromise.join([globalState.whenReady, workspaceState.whenReady]).then(() => {
return Object.freeze(<IExtensionContext>{

View File

@@ -4,11 +4,11 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import Event, {Emitter} from 'vs/base/common/event';
import {Disposable} from './extHostTypes';
import {match} from 'vs/base/common/glob';
import {Uri, FileSystemWatcher as _FileSystemWatcher} from 'vscode';
import {FileSystemEvents, ExtHostFileSystemEventServiceShape} from './extHost.protocol';
import Event, { Emitter } from 'vs/base/common/event';
import { Disposable } from './extHostTypes';
import { match } from 'vs/base/common/glob';
import { Uri, FileSystemWatcher as _FileSystemWatcher } from 'vscode';
import { FileSystemEvents, ExtHostFileSystemEventServiceShape } from './extHost.protocol';
export class FileSystemWatcher implements _FileSystemWatcher {
@@ -18,15 +18,15 @@ export class FileSystemWatcher implements _FileSystemWatcher {
private _disposable: Disposable;
private _config: number;
get ignoreCreateEvents(): boolean{
get ignoreCreateEvents(): boolean {
return Boolean(this._config & 0b001);
}
get ignoreChangeEvents(): boolean{
get ignoreChangeEvents(): boolean {
return Boolean(this._config & 0b010);
}
get ignoreDeleteEvents(): boolean{
get ignoreDeleteEvents(): boolean {
return Boolean(this._config & 0b100);
}

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {ExtHostHeapServiceShape} from './extHost.protocol';
import { ExtHostHeapServiceShape } from './extHost.protocol';
export class ExtHostHeapService extends ExtHostHeapServiceShape {
@@ -13,7 +13,7 @@ export class ExtHostHeapService extends ExtHostHeapServiceShape {
private _data: { [n: number]: any } = Object.create(null);
private _callbacks: { [n: number]: Function } = Object.create(null);
keep(obj:any, callback?:() => any): number {
keep(obj: any, callback?: () => any): number {
const id = ExtHostHeapService._idPool++;
this._data[id] = obj;
if (typeof callback === 'function') {

View File

@@ -5,22 +5,22 @@
'use strict';
import URI from 'vs/base/common/uri';
import {TPromise} from 'vs/base/common/winjs.base';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import { TPromise } from 'vs/base/common/winjs.base';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import * as vscode from 'vscode';
import * as TypeConverters from 'vs/workbench/api/node/extHostTypeConverters';
import {Range, Disposable, CompletionList, CompletionItem} from 'vs/workbench/api/node/extHostTypes';
import {IPosition, IRange, ISingleEditOperation} from 'vs/editor/common/editorCommon';
import { Range, Disposable, CompletionList, CompletionItem } from 'vs/workbench/api/node/extHostTypes';
import { IPosition, IRange, ISingleEditOperation } from 'vs/editor/common/editorCommon';
import * as modes from 'vs/editor/common/modes';
import {ExtHostHeapService} from 'vs/workbench/api/node/extHostHeapService';
import {ExtHostDocuments} from 'vs/workbench/api/node/extHostDocuments';
import {ExtHostCommands} from 'vs/workbench/api/node/extHostCommands';
import {ExtHostDiagnostics} from 'vs/workbench/api/node/extHostDiagnostics';
import {IWorkspaceSymbolProvider, IWorkspaceSymbol} from 'vs/workbench/parts/search/common/search';
import {asWinJsPromise, ShallowCancelThenPromise} from 'vs/base/common/async';
import {MainContext, MainThreadLanguageFeaturesShape, ExtHostLanguageFeaturesShape, ObjectIdentifier} from './extHost.protocol';
import {regExpLeadsToEndlessLoop} from 'vs/base/common/strings';
import { ExtHostHeapService } from 'vs/workbench/api/node/extHostHeapService';
import { ExtHostDocuments } from 'vs/workbench/api/node/extHostDocuments';
import { ExtHostCommands } from 'vs/workbench/api/node/extHostCommands';
import { ExtHostDiagnostics } from 'vs/workbench/api/node/extHostDiagnostics';
import { IWorkspaceSymbolProvider, IWorkspaceSymbol } from 'vs/workbench/parts/search/common/search';
import { asWinJsPromise, ShallowCancelThenPromise } from 'vs/base/common/async';
import { MainContext, MainThreadLanguageFeaturesShape, ExtHostLanguageFeaturesShape, ObjectIdentifier } from './extHost.protocol';
import { regExpLeadsToEndlessLoop } from 'vs/base/common/strings';
// --- adapter
@@ -324,7 +324,7 @@ class QuickFixAdapter {
return;
}
return commands.map((command, i) => {
return <modes.CodeAction> {
return <modes.CodeAction>{
command: TypeConverters.Command.from(command, cachedCommands),
score: i
};
@@ -395,7 +395,7 @@ class OnTypeFormattingAdapter {
const {document, version} = this._documents.getDocumentData(resource);
const pos = TypeConverters.toPosition(position);
return asWinJsPromise(token => this._provider.provideOnTypeFormattingEdits(document, pos, ch, <any> options, token)).then(value => {
return asWinJsPromise(token => this._provider.provideOnTypeFormattingEdits(document, pos, ch, <any>options, token)).then(value => {
if (Array.isArray(value)) {
return TypeConverters.TextEdit.minimalEditOperations(value, document, version);
}
@@ -509,7 +509,7 @@ class SuggestAdapter {
const doc = this._documents.getDocumentData(resource).document;
const pos = TypeConverters.toPosition(position);
return asWinJsPromise<vscode.CompletionItem[]|vscode.CompletionList>(token => this._provider.provideCompletionItems(doc, pos, token)).then(value => {
return asWinJsPromise<vscode.CompletionItem[] | vscode.CompletionList>(token => this._provider.provideCompletionItems(doc, pos, token)).then(value => {
const result: modes.ISuggestResult = {
suggestions: [],
@@ -690,7 +690,7 @@ export class ExtHostLanguageFeatures extends ExtHostLanguageFeaturesShape {
if (!(adapter instanceof ctor)) {
return TPromise.wrapError(new Error('no adapter found'));
}
return callback(<any> adapter);
return callback(<any>adapter);
}
// --- outline
@@ -902,7 +902,7 @@ export class ExtHostLanguageFeatures extends ExtHostLanguageFeaturesShape {
// --- configuration
setLanguageConfiguration(languageId:string, configuration: vscode.LanguageConfiguration): vscode.Disposable {
setLanguageConfiguration(languageId: string, configuration: vscode.LanguageConfiguration): vscode.Disposable {
let {wordPattern} = configuration;
// check for a valid word pattern

View File

@@ -4,9 +4,9 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import {MainContext, MainThreadLanguagesShape} from './extHost.protocol';
import { TPromise } from 'vs/base/common/winjs.base';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { MainContext, MainThreadLanguagesShape } from './extHost.protocol';
export class ExtHostLanguages {

View File

@@ -4,10 +4,10 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import Severity from 'vs/base/common/severity';
import vscode = require('vscode');
import {MainContext, MainThreadMessageServiceShape} from './extHost.protocol';
import { MainContext, MainThreadMessageServiceShape } from './extHost.protocol';
export class ExtHostMessageService {
@@ -17,7 +17,7 @@ export class ExtHostMessageService {
this._proxy = threadService.get(MainContext.MainThreadMessageService);
}
showMessage(severity: Severity, message: string, commands: (string|vscode.MessageItem)[]): Thenable<string|vscode.MessageItem> {
showMessage(severity: Severity, message: string, commands: (string | vscode.MessageItem)[]): Thenable<string | vscode.MessageItem> {
const items: { title: string; isCloseAffordance: boolean; handle: number; }[] = [];

View File

@@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import {MainContext, MainThreadOutputServiceShape} from './extHost.protocol';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { MainContext, MainThreadOutputServiceShape } from './extHost.protocol';
export class ExtHostOutputChannel implements vscode.OutputChannel {

View File

@@ -4,12 +4,12 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import {wireCancellationToken} from 'vs/base/common/async';
import {CancellationToken} from 'vs/base/common/cancellation';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import {QuickPickOptions, QuickPickItem, InputBoxOptions} from 'vscode';
import {MainContext, MainThreadQuickOpenShape, ExtHostQuickOpenShape, MyQuickPickItems} from './extHost.protocol';
import { TPromise } from 'vs/base/common/winjs.base';
import { wireCancellationToken } from 'vs/base/common/async';
import { CancellationToken } from 'vs/base/common/cancellation';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { QuickPickOptions, QuickPickItem, InputBoxOptions } from 'vscode';
import { MainContext, MainThreadQuickOpenShape, ExtHostQuickOpenShape, MyQuickPickItems } from './extHost.protocol';
export type Item = string | QuickPickItem;

View File

@@ -4,11 +4,11 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import {StatusbarAlignment as MainThreadStatusBarAlignment} from 'vs/platform/statusbar/common/statusbar';
import {StatusBarAlignment as ExtHostStatusBarAlignment, Disposable} from './extHostTypes';
import {StatusBarItem, StatusBarAlignment} from 'vscode';
import {MainContext, MainThreadStatusBarShape} from './extHost.protocol';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { StatusbarAlignment as MainThreadStatusBarAlignment } from 'vs/platform/statusbar/common/statusbar';
import { StatusBarAlignment as ExtHostStatusBarAlignment, Disposable } from './extHostTypes';
import { StatusBarItem, StatusBarAlignment } from 'vscode';
import { MainContext, MainThreadStatusBarShape } from './extHost.protocol';
export class ExtHostStatusBarEntry implements StatusBarItem {
private static ID_GEN = 0;

View File

@@ -4,9 +4,9 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import {MainContext, MainThreadStorageShape} from './extHost.protocol';
import { TPromise } from 'vs/base/common/winjs.base';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { MainContext, MainThreadStorageShape } from './extHost.protocol';
export class ExtHostStorage {

View File

@@ -4,11 +4,11 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {notImplemented} from 'vs/base/common/errors';
import {TPromise} from 'vs/base/common/winjs.base';
import {ITelemetryService, ITelemetryInfo, ITelemetryExperiments} from 'vs/platform/telemetry/common/telemetry';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import {MainContext, MainThreadTelemetryShape} from './extHost.protocol';
import { notImplemented } from 'vs/base/common/errors';
import { TPromise } from 'vs/base/common/winjs.base';
import { ITelemetryService, ITelemetryInfo, ITelemetryExperiments } from 'vs/platform/telemetry/common/telemetry';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { MainContext, MainThreadTelemetryShape } from './extHost.protocol';
export class RemoteTelemetryService implements ITelemetryService {

View File

@@ -4,10 +4,10 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import Event, {Emitter} from 'vs/base/common/event';
import Event, { Emitter } from 'vs/base/common/event';
import vscode = require('vscode');
import {ExtHostTerminalServiceShape, MainContext, MainThreadTerminalServiceShape} from './extHost.protocol';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import { ExtHostTerminalServiceShape, MainContext, MainThreadTerminalServiceShape } from './extHost.protocol';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
export class ExtHostTerminal implements vscode.Terminal {

View File

@@ -16,7 +16,7 @@ import { IPosition, ISelection, IRange, IDecorationOptions, ISingleEditOperation
import { IWorkspaceSymbol } from 'vs/workbench/parts/search/common/search';
import * as vscode from 'vscode';
import URI from 'vs/base/common/uri';
import { SaveReason } from 'vs/workbench/parts/files/common/files';
import { SaveReason } from 'vs/workbench/services/textfile/common/textfiles';
export interface PositionLike {
line: number;

View File

@@ -5,13 +5,13 @@
'use strict';
import URI from 'vs/base/common/uri';
import {relative, isEqualOrParent} from 'vs/base/common/paths';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import {IResourceEdit} from 'vs/editor/common/services/bulkEdit';
import {TPromise} from 'vs/base/common/winjs.base';
import {fromRange} from 'vs/workbench/api/node/extHostTypeConverters';
import {Uri, CancellationToken} from 'vscode';
import {MainContext, MainThreadWorkspaceShape} from './extHost.protocol';
import { relative, isEqualOrParent } from 'vs/base/common/paths';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { IResourceEdit } from 'vs/editor/common/services/bulkEdit';
import { TPromise } from 'vs/base/common/winjs.base';
import { fromRange } from 'vs/workbench/api/node/extHostTypeConverters';
import { Uri, CancellationToken } from 'vscode';
import { MainContext, MainThreadWorkspaceShape } from './extHost.protocol';
export class ExtHostWorkspace {
@@ -20,7 +20,7 @@ export class ExtHostWorkspace {
private _proxy: MainThreadWorkspaceShape;
private _workspacePath: string;
constructor(threadService: IThreadService, workspacePath:string) {
constructor(threadService: IThreadService, workspacePath: string) {
this._proxy = threadService.get(MainContext.MainThreadWorkspace);
this._workspacePath = workspacePath;
}

View File

@@ -4,11 +4,11 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import {ICommandService, CommandsRegistry, ICommandHandlerDescription} from 'vs/platform/commands/common/commands';
import {IDisposable} from 'vs/base/common/lifecycle';
import {TPromise} from 'vs/base/common/winjs.base';
import {ExtHostContext, MainThreadCommandsShape, ExtHostCommandsShape} from './extHost.protocol';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { ICommandService, CommandsRegistry, ICommandHandlerDescription } from 'vs/platform/commands/common/commands';
import { IDisposable } from 'vs/base/common/lifecycle';
import { TPromise } from 'vs/base/common/winjs.base';
import { ExtHostContext, MainThreadCommandsShape, ExtHostCommandsShape } from './extHost.protocol';
export class MainThreadCommands extends MainThreadCommandsShape {

View File

@@ -4,16 +4,16 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {IMarkerService, IMarkerData} from 'vs/platform/markers/common/markers';
import { IMarkerService, IMarkerData } from 'vs/platform/markers/common/markers';
import URI from 'vs/base/common/uri';
import {TPromise} from 'vs/base/common/winjs.base';
import {MainThreadDiagnosticsShape} from './extHost.protocol';
import { TPromise } from 'vs/base/common/winjs.base';
import { MainThreadDiagnosticsShape } from './extHost.protocol';
export class MainThreadDiagnostics extends MainThreadDiagnosticsShape {
private _markerService: IMarkerService;
constructor(@IMarkerService markerService: IMarkerService) {
constructor( @IMarkerService markerService: IMarkerService) {
super();
this._markerService = markerService;
}

View File

@@ -4,23 +4,23 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {onUnexpectedError} from 'vs/base/common/errors';
import {toErrorMessage} from 'vs/base/common/errorMessage';
import {EmitterEvent} from 'vs/base/common/eventEmitter';
import {IModelService} from 'vs/editor/common/services/modelService';
import { onUnexpectedError } from 'vs/base/common/errors';
import { toErrorMessage } from 'vs/base/common/errorMessage';
import { EmitterEvent } from 'vs/base/common/eventEmitter';
import { IModelService } from 'vs/editor/common/services/modelService';
import * as editorCommon from 'vs/editor/common/editorCommon';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import URI from 'vs/base/common/uri';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import {IEventService} from 'vs/platform/event/common/event';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {TextFileModelChangeEvent, ITextFileService} from 'vs/workbench/parts/files/common/files';
import {TPromise} from 'vs/base/common/winjs.base';
import {IFileService} from 'vs/platform/files/common/files';
import {IModeService} from 'vs/editor/common/services/modeService';
import {IUntitledEditorService} from 'vs/workbench/services/untitled/common/untitledEditorService';
import {ResourceEditorInput} from 'vs/workbench/common/editor/resourceEditorInput';
import {ExtHostContext, MainThreadDocumentsShape, ExtHostDocumentsShape} from './extHost.protocol';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IEventService } from 'vs/platform/event/common/event';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { TextFileModelChangeEvent, ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
import { TPromise } from 'vs/base/common/winjs.base';
import { IFileService } from 'vs/platform/files/common/files';
import { IModeService } from 'vs/editor/common/services/modeService';
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
import { ExtHostContext, MainThreadDocumentsShape, ExtHostDocumentsShape } from './extHost.protocol';
export class MainThreadDocuments extends MainThreadDocumentsShape {
private _modelService: IModelService;
@@ -198,7 +198,7 @@ export class MainThreadDocuments extends MainThreadDocumentsShape {
let input = this._untitledEditorService.createOrGet(asFileUri);
return input.resolve(true).then(model => {
if (input.getResource().toString() !== uri.toString()) {
throw new Error(`expected URI ${uri.toString() } BUT GOT ${input.getResource().toString() }`);
throw new Error(`expected URI ${uri.toString()} BUT GOT ${input.getResource().toString()}`);
}
if (!this._modelIsSynced[uri.toString()]) {
throw new Error(`expected URI ${uri.toString()} to have come to LIFE`);
@@ -212,7 +212,7 @@ export class MainThreadDocuments extends MainThreadDocumentsShape {
// --- virtual document logic
$registerTextContentProvider(handle:number, scheme: string): void {
$registerTextContentProvider(handle: number, scheme: string): void {
this._resourceContentProvider[handle] = ResourceEditorInput.registerResourceContentProvider(scheme, {
provideTextContent: (uri: URI): TPromise<editorCommon.IModel> => {
return this._proxy.$provideTextDocumentContent(handle, uri).then(value => {
@@ -252,6 +252,10 @@ export class MainThreadDocuments extends MainThreadDocumentsShape {
if (!this._editorService.isVisible(input, true)) {
toBeDisposed.push(resource);
}
if (input) {
input.dispose();
}
});
})).then(() => {
for (let resource of toBeDisposed) {

View File

@@ -5,21 +5,21 @@
'use strict';
import URI from 'vs/base/common/uri';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import {TPromise} from 'vs/base/common/winjs.base';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import {ISingleEditOperation, ISelection, IRange, IEditor, EditorType, ICommonCodeEditor, ICommonDiffEditor, IDecorationRenderOptions, IDecorationOptions} from 'vs/editor/common/editorCommon';
import {ICodeEditorService} from 'vs/editor/common/services/codeEditorService';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {IEditorGroupService} from 'vs/workbench/services/group/common/groupService';
import {Position as EditorPosition} from 'vs/platform/editor/common/editor';
import {IModelService} from 'vs/editor/common/services/modelService';
import {MainThreadEditorsTracker, TextEditorRevealType, MainThreadTextEditor, IApplyEditsOptions, ITextEditorConfigurationUpdate} from 'vs/workbench/api/node/mainThreadEditorsTracker';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IEventService} from 'vs/platform/event/common/event';
import {equals as arrayEquals} from 'vs/base/common/arrays';
import {equals as objectEquals} from 'vs/base/common/objects';
import {ExtHostContext, MainThreadEditorsShape, ExtHostEditorsShape, ITextEditorPositionData} from './extHost.protocol';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { TPromise } from 'vs/base/common/winjs.base';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { ISingleEditOperation, ISelection, IRange, IEditor, EditorType, ICommonCodeEditor, ICommonDiffEditor, IDecorationRenderOptions, IDecorationOptions } from 'vs/editor/common/editorCommon';
import { ICodeEditorService } from 'vs/editor/common/services/codeEditorService';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { Position as EditorPosition } from 'vs/platform/editor/common/editor';
import { IModelService } from 'vs/editor/common/services/modelService';
import { MainThreadEditorsTracker, TextEditorRevealType, MainThreadTextEditor, IApplyEditsOptions, ITextEditorConfigurationUpdate } from 'vs/workbench/api/node/mainThreadEditorsTracker';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IEventService } from 'vs/platform/event/common/event';
import { equals as arrayEquals } from 'vs/base/common/arrays';
import { equals as objectEquals } from 'vs/base/common/objects';
import { ExtHostContext, MainThreadEditorsShape, ExtHostEditorsShape, ITextEditorPositionData } from './extHost.protocol';
export class MainThreadEditors extends MainThreadEditorsShape {
@@ -281,7 +281,7 @@ export class MainThreadEditors extends MainThreadEditorsShape {
return TPromise.as(null);
}
$tryApplyEdits(id: string, modelVersionId: number, edits: ISingleEditOperation[], opts:IApplyEditsOptions): TPromise<boolean> {
$tryApplyEdits(id: string, modelVersionId: number, edits: ISingleEditOperation[], opts: IApplyEditsOptions): TPromise<boolean> {
if (!this._textEditorsMap[id]) {
return TPromise.wrapError('TextEditor disposed');
}

View File

@@ -5,16 +5,16 @@
'use strict';
import EditorCommon = require('vs/editor/common/editorCommon');
import Event, {Emitter} from 'vs/base/common/event';
import {IEditor} from 'vs/platform/editor/common/editor';
import {ICodeEditorService} from 'vs/editor/common/services/codeEditorService';
import {IModelService} from 'vs/editor/common/services/modelService';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import {RunOnceScheduler} from 'vs/base/common/async';
import {IdGenerator} from 'vs/base/common/idGenerator';
import {Range} from 'vs/editor/common/core/range';
import {Selection} from 'vs/editor/common/core/selection';
import {EndOfLine, TextEditorLineNumbersStyle} from 'vs/workbench/api/node/extHostTypes';
import Event, { Emitter } from 'vs/base/common/event';
import { IEditor } from 'vs/platform/editor/common/editor';
import { ICodeEditorService } from 'vs/editor/common/services/codeEditorService';
import { IModelService } from 'vs/editor/common/services/modelService';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { RunOnceScheduler } from 'vs/base/common/async';
import { IdGenerator } from 'vs/base/common/idGenerator';
import { Range } from 'vs/editor/common/core/range';
import { Selection } from 'vs/editor/common/core/selection';
import { EndOfLine, TextEditorLineNumbersStyle } from 'vs/workbench/api/node/extHostTypes';
export interface ITextEditorConfigurationUpdate {
tabSize?: number | string;
@@ -29,7 +29,7 @@ export interface IResolvedTextEditorConfiguration {
lineNumbers: TextEditorLineNumbersStyle;
}
function configurationsEqual(a:IResolvedTextEditorConfiguration, b:IResolvedTextEditorConfiguration) {
function configurationsEqual(a: IResolvedTextEditorConfiguration, b: IResolvedTextEditorConfiguration) {
if (a && !b || !a && b) {
return false;
}
@@ -86,9 +86,9 @@ export class MainThreadTextEditor {
constructor(
id: string,
model:EditorCommon.IModel,
codeEditor:EditorCommon.ICommonCodeEditor,
focusTracker:IFocusTracker,
model: EditorCommon.IModel,
codeEditor: EditorCommon.ICommonCodeEditor,
focusTracker: IFocusTracker,
modelService: IModelService
) {
this._id = id;
@@ -101,14 +101,14 @@ export class MainThreadTextEditor {
this._onSelectionChanged = new Emitter<ISelectionChangeEvent>();
this._onConfigurationChanged = new Emitter<IResolvedTextEditorConfiguration>();
this._lastSelection = [ new Selection(1,1,1,1) ];
this._setConfiguration(this._readConfiguration(this._model, this._codeEditor));
this._lastSelection = [new Selection(1, 1, 1, 1)];
this._modelListeners = [];
this._modelListeners.push(this._model.onDidChangeOptions((e) => {
this._setConfiguration(this._readConfiguration(this._model, this._codeEditor));
}));
this.setCodeEditor(codeEditor);
this._setConfiguration(this._readConfiguration(this._model, this._codeEditor));
}
public dispose(): void {
@@ -126,11 +126,11 @@ export class MainThreadTextEditor {
return this._model;
}
public hasCodeEditor(codeEditor:EditorCommon.ICommonCodeEditor): boolean {
public hasCodeEditor(codeEditor: EditorCommon.ICommonCodeEditor): boolean {
return (this._codeEditor === codeEditor);
}
public setCodeEditor(codeEditor:EditorCommon.ICommonCodeEditor): void {
public setCodeEditor(codeEditor: EditorCommon.ICommonCodeEditor): void {
if (this.hasCodeEditor(codeEditor)) {
// Nothing to do...
return;
@@ -188,7 +188,7 @@ export class MainThreadTextEditor {
return this._lastSelection;
}
public setSelections(selections:EditorCommon.ISelection[]): void {
public setSelections(selections: EditorCommon.ISelection[]): void {
if (this._codeEditor) {
this._codeEditor.setSelections(selections);
return;
@@ -201,7 +201,7 @@ export class MainThreadTextEditor {
return this._configuration;
}
private _setIndentConfiguration(newConfiguration:ITextEditorConfigurationUpdate): void {
private _setIndentConfiguration(newConfiguration: ITextEditorConfigurationUpdate): void {
if (newConfiguration.tabSize === 'auto' || newConfiguration.insertSpaces === 'auto') {
// one of the options was set to 'auto' => detect indentation
@@ -240,7 +240,7 @@ export class MainThreadTextEditor {
this._model.updateOptions(newOpts);
}
public setConfiguration(newConfiguration:ITextEditorConfigurationUpdate): void {
public setConfiguration(newConfiguration: ITextEditorConfigurationUpdate): void {
this._setIndentConfiguration(newConfiguration);
if (newConfiguration.cursorStyle) {
@@ -280,7 +280,7 @@ export class MainThreadTextEditor {
}
}
public setDecorations(key: string, ranges:EditorCommon.IDecorationOptions[]): void {
public setDecorations(key: string, ranges: EditorCommon.IDecorationOptions[]): void {
if (!this._codeEditor) {
console.warn('setDecorations on invisible editor');
return;
@@ -288,7 +288,7 @@ export class MainThreadTextEditor {
this._codeEditor.setDecorations(key, ranges);
}
public revealRange(range:EditorCommon.IRange, revealType:TextEditorRevealType): void {
public revealRange(range: EditorCommon.IRange, revealType: TextEditorRevealType): void {
if (!this._codeEditor) {
console.warn('revealRange on invisible editor');
return;
@@ -304,7 +304,7 @@ export class MainThreadTextEditor {
}
}
private _readConfiguration(model:EditorCommon.IModel, codeEditor:EditorCommon.ICommonCodeEditor): IResolvedTextEditorConfiguration {
private _readConfiguration(model: EditorCommon.IModel, codeEditor: EditorCommon.ICommonCodeEditor): IResolvedTextEditorConfiguration {
if (model.isDisposed()) {
// shutdown time
return this._configuration;
@@ -333,7 +333,7 @@ export class MainThreadTextEditor {
};
}
private _setConfiguration(newConfiguration:IResolvedTextEditorConfiguration): void {
private _setConfiguration(newConfiguration: IResolvedTextEditorConfiguration): void {
if (configurationsEqual(this._configuration, newConfiguration)) {
return;
}
@@ -355,7 +355,7 @@ export class MainThreadTextEditor {
return editor.getControl() === this._codeEditor;
}
public applyEdits(versionIdCheck:number, edits:EditorCommon.ISingleEditOperation[], opts:IApplyEditsOptions): boolean {
public applyEdits(versionIdCheck: number, edits: EditorCommon.ISingleEditOperation[], opts: IApplyEditsOptions): boolean {
if (this._model.getVersionId() !== versionIdCheck) {
console.warn('Model has changed in the meantime!');
// throw new Error('Model has changed in the meantime!');
@@ -405,10 +405,10 @@ export class MainThreadEditorsTracker {
private _codeEditorService: ICodeEditorService;
private _modelService: IModelService;
private _updateMapping: RunOnceScheduler;
private _editorModelChangeListeners: {[editorId:string]:IDisposable;};
private _editorModelChangeListeners: { [editorId: string]: IDisposable; };
private _model2TextEditors: {
[modelUri:string]: MainThreadTextEditor[];
[modelUri: string]: MainThreadTextEditor[];
};
private _focusedTextEditorId: string;
private _visibleTextEditorIds: string[];
@@ -420,8 +420,8 @@ export class MainThreadEditorsTracker {
private _focusTracker: IFocusTracker;
constructor(
editorService:ICodeEditorService,
modelService:IModelService
editorService: ICodeEditorService,
modelService: IModelService
) {
this._codeEditorService = editorService;
this._modelService = modelService;
@@ -476,7 +476,7 @@ export class MainThreadEditorsTracker {
let allModels = this._modelService.getModels();
// Same filter as in extHostDocuments
allModels = allModels.filter((model) => !model.isTooLargeForHavingARichMode());
let allModelsMap: { [modelUri:string]: EditorCommon.IModel; } = Object.create(null);
let allModelsMap: { [modelUri: string]: EditorCommon.IModel; } = Object.create(null);
allModels.forEach((model) => {
allModelsMap[model.uri.toString()] = model;
});
@@ -602,7 +602,7 @@ export class MainThreadEditorsTracker {
return result;
}
private _setFocusedTextEditorId(focusedTextEditorId:string): void {
private _setFocusedTextEditorId(focusedTextEditorId: string): void {
if (this._focusedTextEditorId === focusedTextEditorId) {
// no change
return;
@@ -674,7 +674,7 @@ export class MainThreadEditorsTracker {
return this._onDidChangeFocusedTextEditor.event;
}
public findTextEditorIdFor(codeEditor:EditorCommon.ICommonCodeEditor): string {
public findTextEditorIdFor(codeEditor: EditorCommon.ICommonCodeEditor): string {
let modelUris = Object.keys(this._model2TextEditors);
for (let i = 0, len = modelUris.length; i < len; i++) {
let editors = this._model2TextEditors[modelUris[i]];
@@ -688,23 +688,23 @@ export class MainThreadEditorsTracker {
return null;
}
public registerTextEditorDecorationType(key:string, options: EditorCommon.IDecorationRenderOptions): void {
public registerTextEditorDecorationType(key: string, options: EditorCommon.IDecorationRenderOptions): void {
this._codeEditorService.registerDecorationType(key, options);
}
public removeTextEditorDecorationType(key:string): void {
public removeTextEditorDecorationType(key: string): void {
this._codeEditorService.removeDecorationType(key);
}
}
interface IVisibleModels {
[modelUri:string]: {
[modelUri: string]: {
model: EditorCommon.IModel;
codeEditors: EditorCommon.ICommonCodeEditor[];
};
}
function strcmp(a:string, b:string): number {
function strcmp(a: string, b: string): number {
if (a < b) {
return -1;
}

View File

@@ -5,7 +5,7 @@
'use strict';
import * as errors from 'vs/base/common/errors';
import {MainThreadErrorsShape} from './extHost.protocol';
import { MainThreadErrorsShape } from './extHost.protocol';
export class MainThreadErrors extends MainThreadErrorsShape {

View File

@@ -5,14 +5,14 @@
'use strict';
import Severity from 'vs/base/common/severity';
import {TPromise} from 'vs/base/common/winjs.base';
import {AbstractExtensionService, ActivatedExtension} from 'vs/platform/extensions/common/abstractExtensionService';
import {IMessage, IExtensionDescription, IExtensionsStatus} from 'vs/platform/extensions/common/extensions';
import {ExtensionsRegistry} from 'vs/platform/extensions/common/extensionsRegistry';
import {IMessageService} from 'vs/platform/message/common/message';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import {ExtHostContext, ExtHostExtensionServiceShape} from './extHost.protocol';
import {IEnvironmentService} from 'vs/platform/environment/common/environment';
import { TPromise } from 'vs/base/common/winjs.base';
import { AbstractExtensionService, ActivatedExtension } from 'vs/platform/extensions/common/abstractExtensionService';
import { IMessage, IExtensionDescription, IExtensionsStatus } from 'vs/platform/extensions/common/extensions';
import { ExtensionsRegistry } from 'vs/platform/extensions/common/extensionsRegistry';
import { IMessageService } from 'vs/platform/message/common/message';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { ExtHostContext, ExtHostExtensionServiceShape } from './extHost.protocol';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
/**
* Represents a failed extension in the ext host.

View File

@@ -4,11 +4,11 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {FileChangesEvent, FileChangeType} from 'vs/platform/files/common/files';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import {IEventService} from 'vs/platform/event/common/event';
import {RunOnceScheduler} from 'vs/base/common/async';
import {ExtHostContext, ExtHostFileSystemEventServiceShape, FileSystemEvents} from './extHost.protocol';
import { FileChangesEvent, FileChangeType } from 'vs/platform/files/common/files';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { IEventService } from 'vs/platform/event/common/event';
import { RunOnceScheduler } from 'vs/base/common/async';
import { ExtHostContext, ExtHostFileSystemEventServiceShape, FileSystemEvents } from './extHost.protocol';
export class MainThreadFileSystemEventService {

View File

@@ -5,10 +5,10 @@
'use strict';
import {IDisposable} from 'vs/base/common/lifecycle';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import {ExtHostContext} from './extHost.protocol';
import {onDidGarbageCollectSignals, consumeSignals} from 'gc-signals';
import { IDisposable } from 'vs/base/common/lifecycle';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { ExtHostContext } from './extHost.protocol';
import { onDidGarbageCollectSignals, consumeSignals } from 'gc-signals';
export class MainThreadHeapService {

View File

@@ -4,20 +4,20 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import {IDisposable} from 'vs/base/common/lifecycle';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import { TPromise } from 'vs/base/common/winjs.base';
import { IDisposable } from 'vs/base/common/lifecycle';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import * as vscode from 'vscode';
import {IReadOnlyModel, ISingleEditOperation} from 'vs/editor/common/editorCommon';
import { IReadOnlyModel, ISingleEditOperation } from 'vs/editor/common/editorCommon';
import * as modes from 'vs/editor/common/modes';
import {WorkspaceSymbolProviderRegistry, IWorkspaceSymbolProvider, IWorkspaceSymbol} from 'vs/workbench/parts/search/common/search';
import {wireCancellationToken} from 'vs/base/common/async';
import {CancellationToken} from 'vs/base/common/cancellation';
import {Position as EditorPosition} from 'vs/editor/common/core/position';
import {Range as EditorRange} from 'vs/editor/common/core/range';
import {ExtHostContext, MainThreadLanguageFeaturesShape, ExtHostLanguageFeaturesShape, ObjectIdentifier} from './extHost.protocol';
import {LanguageConfigurationRegistry, LanguageConfiguration} from 'vs/editor/common/modes/languageConfigurationRegistry';
import {trackGarbageCollection} from 'gc-signals';
import { WorkspaceSymbolProviderRegistry, IWorkspaceSymbolProvider, IWorkspaceSymbol } from 'vs/workbench/parts/search/common/search';
import { wireCancellationToken } from 'vs/base/common/async';
import { CancellationToken } from 'vs/base/common/cancellation';
import { Position as EditorPosition } from 'vs/editor/common/core/position';
import { Range as EditorRange } from 'vs/editor/common/core/range';
import { ExtHostContext, MainThreadLanguageFeaturesShape, ExtHostLanguageFeaturesShape, ObjectIdentifier } from './extHost.protocol';
import { LanguageConfigurationRegistry, LanguageConfiguration } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { trackGarbageCollection } from 'gc-signals';
export class MainThreadLanguageFeatures extends MainThreadLanguageFeaturesShape {
@@ -42,7 +42,7 @@ export class MainThreadLanguageFeatures extends MainThreadLanguageFeaturesShape
$registerOutlineSupport(handle: number, selector: vscode.DocumentSelector): TPromise<any> {
this._registrations[handle] = modes.DocumentSymbolProviderRegistry.register(selector, <modes.DocumentSymbolProvider>{
provideDocumentSymbols: (model:IReadOnlyModel, token: CancellationToken): Thenable<modes.SymbolInformation[]> => {
provideDocumentSymbols: (model: IReadOnlyModel, token: CancellationToken): Thenable<modes.SymbolInformation[]> => {
return wireCancellationToken(token, this._proxy.$provideDocumentSymbols(handle, model.uri));
}
});
@@ -53,10 +53,10 @@ export class MainThreadLanguageFeatures extends MainThreadLanguageFeaturesShape
$registerCodeLensSupport(handle: number, selector: vscode.DocumentSelector): TPromise<any> {
this._registrations[handle] = modes.CodeLensProviderRegistry.register(selector, <modes.CodeLensProvider>{
provideCodeLenses: (model:IReadOnlyModel, token: CancellationToken): modes.ICodeLensSymbol[] | Thenable<modes.ICodeLensSymbol[]> => {
provideCodeLenses: (model: IReadOnlyModel, token: CancellationToken): modes.ICodeLensSymbol[] | Thenable<modes.ICodeLensSymbol[]> => {
return wireCancellationToken(token, this._proxy.$provideCodeLenses(handle, model.uri));
},
resolveCodeLens: (model:IReadOnlyModel, codeLens: modes.ICodeLensSymbol, token: CancellationToken): modes.ICodeLensSymbol | Thenable<modes.ICodeLensSymbol> => {
resolveCodeLens: (model: IReadOnlyModel, codeLens: modes.ICodeLensSymbol, token: CancellationToken): modes.ICodeLensSymbol | Thenable<modes.ICodeLensSymbol> => {
return wireCancellationToken(token, this._proxy.$resolveCodeLens(handle, model.uri, codeLens));
}
});
@@ -78,7 +78,7 @@ export class MainThreadLanguageFeatures extends MainThreadLanguageFeaturesShape
$registerHoverProvider(handle: number, selector: vscode.DocumentSelector): TPromise<any> {
this._registrations[handle] = modes.HoverProviderRegistry.register(selector, <modes.HoverProvider>{
provideHover: (model:IReadOnlyModel, position:EditorPosition, token:CancellationToken): Thenable<modes.Hover> => {
provideHover: (model: IReadOnlyModel, position: EditorPosition, token: CancellationToken): Thenable<modes.Hover> => {
return wireCancellationToken(token, this._proxy.$provideHover(handle, model.uri, position));
}
});
@@ -100,7 +100,7 @@ export class MainThreadLanguageFeatures extends MainThreadLanguageFeaturesShape
$registerReferenceSupport(handle: number, selector: vscode.DocumentSelector): TPromise<any> {
this._registrations[handle] = modes.ReferenceProviderRegistry.register(selector, <modes.ReferenceProvider>{
provideReferences: (model:IReadOnlyModel, position:EditorPosition, context: modes.ReferenceContext, token: CancellationToken): Thenable<modes.Location[]> => {
provideReferences: (model: IReadOnlyModel, position: EditorPosition, context: modes.ReferenceContext, token: CancellationToken): Thenable<modes.Location[]> => {
return wireCancellationToken(token, this._proxy.$provideReferences(handle, model.uri, position, context));
}
});
@@ -111,7 +111,7 @@ export class MainThreadLanguageFeatures extends MainThreadLanguageFeaturesShape
$registerQuickFixSupport(handle: number, selector: vscode.DocumentSelector): TPromise<any> {
this._registrations[handle] = modes.CodeActionProviderRegistry.register(selector, <modes.CodeActionProvider>{
provideCodeActions: (model:IReadOnlyModel, range:EditorRange, token: CancellationToken): Thenable<modes.CodeAction[]> => {
provideCodeActions: (model: IReadOnlyModel, range: EditorRange, token: CancellationToken): Thenable<modes.CodeAction[]> => {
return wireCancellationToken(token, this._proxy.$provideCodeActions(handle, model.uri, range));
}
});
@@ -175,7 +175,7 @@ export class MainThreadLanguageFeatures extends MainThreadLanguageFeaturesShape
$registerRenameSupport(handle: number, selector: vscode.DocumentSelector): TPromise<any> {
this._registrations[handle] = modes.RenameProviderRegistry.register(selector, <modes.RenameProvider>{
provideRenameEdits: (model:IReadOnlyModel, position:EditorPosition, newName: string, token: CancellationToken): Thenable<modes.WorkspaceEdit> => {
provideRenameEdits: (model: IReadOnlyModel, position: EditorPosition, newName: string, token: CancellationToken): Thenable<modes.WorkspaceEdit> => {
return wireCancellationToken(token, this._proxy.$provideRenameEdits(handle, model.uri, position, newName));
}
});
@@ -187,7 +187,7 @@ export class MainThreadLanguageFeatures extends MainThreadLanguageFeaturesShape
$registerSuggestSupport(handle: number, selector: vscode.DocumentSelector, triggerCharacters: string[]): TPromise<any> {
this._registrations[handle] = modes.SuggestRegistry.register(selector, <modes.ISuggestSupport>{
triggerCharacters: triggerCharacters,
provideCompletionItems: (model:IReadOnlyModel, position:EditorPosition, token:CancellationToken): Thenable<modes.ISuggestResult> => {
provideCompletionItems: (model: IReadOnlyModel, position: EditorPosition, token: CancellationToken): Thenable<modes.ISuggestResult> => {
return wireCancellationToken(token, this._proxy.$provideCompletionItems(handle, model.uri, position)).then(result => {
if (result && result.suggestions) {
for (const suggestion of result.suggestions) {
@@ -197,7 +197,7 @@ export class MainThreadLanguageFeatures extends MainThreadLanguageFeaturesShape
return result;
});
},
resolveCompletionItem: (model:IReadOnlyModel, position:EditorPosition, suggestion: modes.ISuggestion, token: CancellationToken): Thenable<modes.ISuggestion> => {
resolveCompletionItem: (model: IReadOnlyModel, position: EditorPosition, suggestion: modes.ISuggestion, token: CancellationToken): Thenable<modes.ISuggestion> => {
return wireCancellationToken(token, this._proxy.$resolveCompletionItem(handle, model.uri, position, suggestion));
}
});
@@ -211,7 +211,7 @@ export class MainThreadLanguageFeatures extends MainThreadLanguageFeaturesShape
signatureHelpTriggerCharacters: triggerCharacter,
provideSignatureHelp: (model:IReadOnlyModel, position:EditorPosition, token:CancellationToken): Thenable<modes.SignatureHelp> => {
provideSignatureHelp: (model: IReadOnlyModel, position: EditorPosition, token: CancellationToken): Thenable<modes.SignatureHelp> => {
return wireCancellationToken(token, this._proxy.$provideSignatureHelp(handle, model.uri, position));
}

View File

@@ -4,9 +4,9 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import {IModeService} from 'vs/editor/common/services/modeService';
import {MainThreadLanguagesShape} from './extHost.protocol';
import { TPromise } from 'vs/base/common/winjs.base';
import { IModeService } from 'vs/editor/common/services/modeService';
import { MainThreadLanguagesShape } from './extHost.protocol';
export class MainThreadLanguages extends MainThreadLanguagesShape {

View File

@@ -5,17 +5,17 @@
'use strict';
import nls = require('vs/nls');
import {IMessageService} from 'vs/platform/message/common/message';
import { IMessageService } from 'vs/platform/message/common/message';
import Severity from 'vs/base/common/severity';
import {Action} from 'vs/base/common/actions';
import {TPromise as Promise} from 'vs/base/common/winjs.base';
import {MainThreadMessageServiceShape} from './extHost.protocol';
import { Action } from 'vs/base/common/actions';
import { TPromise as Promise } from 'vs/base/common/winjs.base';
import { MainThreadMessageServiceShape } from './extHost.protocol';
export class MainThreadMessageService extends MainThreadMessageServiceShape {
private _messageService: IMessageService;
constructor(@IMessageService messageService:IMessageService) {
constructor( @IMessageService messageService: IMessageService) {
super();
this._messageService = messageService;
}

View File

@@ -4,12 +4,12 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import {Registry} from 'vs/platform/platform';
import {IOutputService, IOutputChannel, OUTPUT_PANEL_ID, Extensions, IOutputChannelRegistry} from 'vs/workbench/parts/output/common/output';
import {IPartService} from 'vs/workbench/services/part/common/partService';
import {IPanelService} from 'vs/workbench/services/panel/common/panelService';
import {MainThreadOutputServiceShape} from './extHost.protocol';
import { TPromise } from 'vs/base/common/winjs.base';
import { Registry } from 'vs/platform/platform';
import { IOutputService, IOutputChannel, OUTPUT_PANEL_ID, Extensions, IOutputChannelRegistry } from 'vs/workbench/parts/output/common/output';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import { MainThreadOutputServiceShape } from './extHost.protocol';
export class MainThreadOutputService extends MainThreadOutputServiceShape {
@@ -17,7 +17,7 @@ export class MainThreadOutputService extends MainThreadOutputServiceShape {
private _partService: IPartService;
private _panelService: IPanelService;
constructor(@IOutputService outputService: IOutputService,
constructor( @IOutputService outputService: IOutputService,
@IPartService partService: IPartService,
@IPanelService panelService: IPanelService
) {
@@ -52,7 +52,7 @@ export class MainThreadOutputService extends MainThreadOutputServiceShape {
public $close(channelId: string): TPromise<void> {
const panel = this._panelService.getActivePanel();
if (panel && panel.getId() === OUTPUT_PANEL_ID && channelId === this._outputService.getActiveChannel().id ) {
if (panel && panel.getId() === OUTPUT_PANEL_ID && channelId === this._outputService.getActiveChannel().id) {
this._partService.setPanelHidden(true);
}

View File

@@ -4,12 +4,12 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import {asWinJsPromise} from 'vs/base/common/async';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import {IQuickOpenService, IPickOptions, IInputOptions} from 'vs/workbench/services/quickopen/common/quickOpenService';
import {InputBoxOptions} from 'vscode';
import {ExtHostContext, MainThreadQuickOpenShape, ExtHostQuickOpenShape, MyQuickPickItems} from './extHost.protocol';
import { TPromise } from 'vs/base/common/winjs.base';
import { asWinJsPromise } from 'vs/base/common/async';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { IQuickOpenService, IPickOptions, IInputOptions } from 'vs/workbench/services/quickopen/common/quickOpenService';
import { InputBoxOptions } from 'vscode';
import { ExtHostContext, MainThreadQuickOpenShape, ExtHostQuickOpenShape, MyQuickPickItems } from './extHost.protocol';
export class MainThreadQuickOpen extends MainThreadQuickOpenShape {

View File

@@ -9,7 +9,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
import { sequence } from 'vs/base/common/async';
import { ICodeEditorService } from 'vs/editor/common/services/codeEditorService';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { ISaveParticipant, ITextFileEditorModel } from 'vs/workbench/parts/files/common/files';
import { ISaveParticipant, ITextFileEditorModel, SaveReason } from 'vs/workbench/services/textfile/common/textfiles';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IPosition, IModel, ICommonCodeEditor, ISingleEditOperation, IIdentifiedSingleEditOperation } from 'vs/editor/common/editorCommon';
import { Range } from 'vs/editor/common/core/range';
@@ -18,9 +18,8 @@ import { trimTrailingWhitespace } from 'vs/editor/common/commands/trimTrailingWh
import { getDocumentRangeFormattingEdits } from 'vs/editor/contrib/format/common/format';
import { EditOperationsCommand } from 'vs/editor/contrib/format/common/formatCommand';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { TextFileEditorModel } from 'vs/workbench/parts/files/common/editors/textFileEditorModel';
import { TextFileEditorModel } from 'vs/workbench/services/textfile/common/textFileEditorModel';
import { ExtHostContext, ExtHostDocumentSaveParticipantShape } from './extHost.protocol';
import { SaveReason } from 'vs/workbench/parts/files/common/files';
class TrimWhitespaceParticipant implements ISaveParticipant {

View File

@@ -4,9 +4,9 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {IStatusbarService, StatusbarAlignment as MainThreadStatusBarAlignment} from 'vs/platform/statusbar/common/statusbar';
import {IDisposable} from 'vs/base/common/lifecycle';
import {MainThreadStatusBarShape} from './extHost.protocol';
import { IStatusbarService, StatusbarAlignment as MainThreadStatusBarAlignment } from 'vs/platform/statusbar/common/statusbar';
import { IDisposable } from 'vs/base/common/lifecycle';
import { MainThreadStatusBarShape } from './extHost.protocol';
export class MainThreadStatusBar extends MainThreadStatusBarShape {
private mapIdToDisposable: { [id: number]: IDisposable };

View File

@@ -4,9 +4,9 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import {IStorageService, StorageScope} from 'vs/platform/storage/common/storage';
import {MainThreadStorageShape} from './extHost.protocol';
import { TPromise } from 'vs/base/common/winjs.base';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { MainThreadStorageShape } from './extHost.protocol';
export class MainThreadStorage extends MainThreadStorageShape {

View File

@@ -4,9 +4,9 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import {ITelemetryService, ITelemetryInfo} from 'vs/platform/telemetry/common/telemetry';
import {MainThreadTelemetryShape} from './extHost.protocol';
import { TPromise } from 'vs/base/common/winjs.base';
import { ITelemetryService, ITelemetryInfo } from 'vs/platform/telemetry/common/telemetry';
import { MainThreadTelemetryShape } from './extHost.protocol';
/**
* Helper always instantiated in the main process to receive telemetry events from remote telemetry services

View File

@@ -4,11 +4,11 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import {ITerminalService, ITerminalInstance} from 'vs/workbench/parts/terminal/electron-browser/terminal';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import {TPromise} from 'vs/base/common/winjs.base';
import {ExtHostContext, ExtHostTerminalServiceShape, MainThreadTerminalServiceShape} from './extHost.protocol';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { ITerminalService, ITerminalInstance } from 'vs/workbench/parts/terminal/electron-browser/terminal';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { TPromise } from 'vs/base/common/winjs.base';
import { ExtHostContext, ExtHostTerminalServiceShape, MainThreadTerminalServiceShape } from './extHost.protocol';
export class MainThreadTerminalService extends MainThreadTerminalServiceShape {

View File

@@ -4,17 +4,17 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {isPromiseCanceledError} from 'vs/base/common/errors';
import {ISearchService, QueryType} from 'vs/platform/search/common/search';
import {IWorkspaceContextService, IWorkspace} from 'vs/platform/workspace/common/workspace';
import {IEventService} from 'vs/platform/event/common/event';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {ITextFileService} from 'vs/workbench/parts/files/common/files';
import {ICommonCodeEditor} from 'vs/editor/common/editorCommon';
import {bulkEdit, IResourceEdit} from 'vs/editor/common/services/bulkEdit';
import {TPromise} from 'vs/base/common/winjs.base';
import {Uri} from 'vscode';
import {MainThreadWorkspaceShape} from './extHost.protocol';
import { isPromiseCanceledError } from 'vs/base/common/errors';
import { ISearchService, QueryType } from 'vs/platform/search/common/search';
import { IWorkspaceContextService, IWorkspace } from 'vs/platform/workspace/common/workspace';
import { IEventService } from 'vs/platform/event/common/event';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
import { ICommonCodeEditor } from 'vs/editor/common/editorCommon';
import { bulkEdit, IResourceEdit } from 'vs/editor/common/services/bulkEdit';
import { TPromise } from 'vs/base/common/winjs.base';
import { Uri } from 'vscode';
import { MainThreadWorkspaceShape } from './extHost.protocol';
export class MainThreadWorkspace extends MainThreadWorkspaceShape {
@@ -22,8 +22,8 @@ export class MainThreadWorkspace extends MainThreadWorkspaceShape {
private _searchService: ISearchService;
private _workspace: IWorkspace;
private _textFileService: ITextFileService;
private _editorService:IWorkbenchEditorService;
private _eventService:IEventService;
private _editorService: IWorkbenchEditorService;
private _eventService: IEventService;
constructor(
@ISearchService searchService: ISearchService,
@@ -88,7 +88,7 @@ export class MainThreadWorkspace extends MainThreadWorkspaceShape {
let codeEditor: ICommonCodeEditor;
let editor = this._editorService.getActiveEditor();
if (editor) {
let candidate = <ICommonCodeEditor> editor.getControl();
let candidate = <ICommonCodeEditor>editor.getControl();
if (typeof candidate.getEditorType === 'function') {
// enough proof
codeEditor = candidate;

View File

@@ -4,15 +4,15 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import {Registry} from 'vs/platform/platform';
import { TPromise } from 'vs/base/common/winjs.base';
import { Registry } from 'vs/platform/platform';
import types = require('vs/base/common/types');
import collections = require('vs/base/common/collections');
import {Action, IAction} from 'vs/base/common/actions';
import {BaseActionItem, Separator} from 'vs/base/browser/ui/actionbar/actionbar';
import {IActionProvider} from 'vs/base/parts/tree/browser/actionsRenderer';
import {ITree} from 'vs/base/parts/tree/browser/tree';
import {IInstantiationService, IConstructorSignature0} from 'vs/platform/instantiation/common/instantiation';
import { Action, IAction } from 'vs/base/common/actions';
import { BaseActionItem, Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { IActionProvider } from 'vs/base/parts/tree/browser/actionsRenderer';
import { ITree } from 'vs/base/parts/tree/browser/tree';
import { IInstantiationService, IConstructorSignature0 } from 'vs/platform/instantiation/common/instantiation';
/**
* The action bar contributor allows to add actions to an actionbar in a given context.
@@ -93,7 +93,7 @@ export class ContributableActionProvider implements IActionProvider {
private registry: IActionBarRegistry;
constructor() {
this.registry = (<IActionBarRegistry> Registry.as(Extensions.Actionbar));
this.registry = (<IActionBarRegistry>Registry.as(Extensions.Actionbar));
}
private toContext(tree: ITree, element: any): any {
@@ -188,7 +188,7 @@ export function prepareActions(actions: IAction[]): IAction[] {
// Patch order if not provided
for (let l = 0; l < actions.length; l++) {
let a = <any> actions[l];
let a = <any>actions[l];
if (types.isUndefinedOrNull(a.order)) {
a.order = l;
}
@@ -304,7 +304,7 @@ class ActionBarRegistry implements IActionBarRegistry {
private createActionBarContributor(scope: string, ctor: IConstructorSignature0<ActionBarContributor>): void {
let instance = this.instantiationService.createInstance(ctor);
let target = <ActionBarContributor[]> collections.lookupOrInsert(this.actionBarContributorInstances, scope, []);
let target = <ActionBarContributor[]>collections.lookupOrInsert(this.actionBarContributorInstances, scope, []);
target.push(instance);
}

View File

@@ -4,30 +4,30 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import { TPromise } from 'vs/base/common/winjs.base';
import nls = require('vs/nls');
import URI from 'vs/base/common/uri';
import network = require('vs/base/common/network');
import labels = require('vs/base/common/labels');
import {Registry} from 'vs/platform/platform';
import {Action} from 'vs/base/common/actions';
import { Registry } from 'vs/platform/platform';
import { Action } from 'vs/base/common/actions';
import strings = require('vs/base/common/strings');
import {IWorkbenchActionRegistry, Extensions} from 'vs/workbench/common/actionRegistry';
import {StringEditorInput} from 'vs/workbench/common/editor/stringEditorInput';
import {getDefaultValuesContent} from 'vs/platform/configuration/common/model';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {IWorkspaceConfigurationService, WORKSPACE_CONFIG_DEFAULT_PATH} from 'vs/workbench/services/configuration/common/configuration';
import {Position} from 'vs/platform/editor/common/editor';
import {IEditorGroupService} from 'vs/workbench/services/group/common/groupService';
import {IStorageService, StorageScope} from 'vs/platform/storage/common/storage';
import {IFileService, IFileOperationResult, FileOperationResult} from 'vs/platform/files/common/files';
import {IMessageService, Severity, CloseAction} from 'vs/platform/message/common/message';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {SyncActionDescriptor} from 'vs/platform/actions/common/actions';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IEnvironmentService} from 'vs/platform/environment/common/environment';
import {KeyMod, KeyCode} from 'vs/base/common/keyCodes';
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actionRegistry';
import { StringEditorInput } from 'vs/workbench/common/editor/stringEditorInput';
import { getDefaultValuesContent } from 'vs/platform/configuration/common/model';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IWorkspaceConfigurationService, WORKSPACE_CONFIG_DEFAULT_PATH } from 'vs/workbench/services/configuration/common/configuration';
import { Position } from 'vs/platform/editor/common/editor';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { IFileService, IFileOperationResult, FileOperationResult } from 'vs/platform/files/common/files';
import { IMessageService, Severity, CloseAction } from 'vs/platform/message/common/message';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
interface IWorkbenchSettingsConfiguration {
workbench: {
@@ -57,9 +57,9 @@ export class BaseTwoEditorsAction extends Action {
}
protected createIfNotExists(resource: URI, contents: string): TPromise<boolean> {
return this.fileService.resolveContent(resource, { acceptTextOnly: true }).then(null, (error) => {
return this.fileService.resolveContent(resource, { acceptTextOnly: true }).then(null, error => {
if ((<IFileOperationResult>error).fileOperationResult === FileOperationResult.FILE_NOT_FOUND) {
return this.fileService.updateContent(resource, contents).then(null, (error) => {
return this.fileService.updateContent(resource, contents).then(null, error => {
return TPromise.wrapError(new Error(nls.localize('fail.createSettings', "Unable to create '{0}' ({1}).", labels.getPathLabel(resource, this.contextService), error)));
});
}
@@ -72,7 +72,7 @@ export class BaseTwoEditorsAction extends Action {
// Create as needed and open in editor
return this.createIfNotExists(editableResource, defaultEditableContents).then(() => {
return this.editorService.createInput({ resource: editableResource }).then((typedRightHandEditableInput) => {
return this.editorService.createInput({ resource: editableResource }).then(typedRightHandEditableInput => {
const editors = [
{ input: leftHandDefaultInput, position: Position.LEFT, options: { pinned: true } },
{ input: typedRightHandEditableInput, position: Position.CENTER, options: { pinned: true } }
@@ -150,9 +150,9 @@ export class OpenGlobalSettingsAction extends BaseOpenSettingsAction {
message: nls.localize('workspaceHasSettings', "The currently opened folder contains workspace settings that may override user settings"),
actions: [
new Action('open.workspaceSettings', nls.localize('openWorkspaceSettings', "Open Workspace Settings"), null, true, () => {
let editorCount = this.editorService.getVisibleEditors().length;
const editorCount = this.editorService.getVisibleEditors().length;
return this.editorService.createInput({ resource: this.contextService.toResource(WORKSPACE_CONFIG_DEFAULT_PATH) }).then((typedInput) => {
return this.editorService.createInput({ resource: this.contextService.toResource(WORKSPACE_CONFIG_DEFAULT_PATH) }).then(typedInput => {
return this.editorService.openEditor(typedInput, { pinned: true }, editorCount === 2 ? Position.RIGHT : editorCount === 1 ? Position.CENTER : void 0);
});
}),
@@ -167,7 +167,7 @@ export class OpenGlobalSettingsAction extends BaseOpenSettingsAction {
}
// Open settings
let emptySettingsHeader = nls.localize('emptySettingsHeader', "Place your settings in this file to overwrite the default settings");
const emptySettingsHeader = nls.localize('emptySettingsHeader', "Place your settings in this file to overwrite the default settings");
return this.open('// ' + emptySettingsHeader + '\n{\n}', URI.file(this.environmentService.appSettingsPath));
}
@@ -195,7 +195,7 @@ export class OpenGlobalKeybindingsAction extends BaseTwoEditorsAction {
}
public run(event?: any): TPromise<void> {
let emptyContents = '// ' + nls.localize('emptyKeybindingsHeader', "Place your key bindings in this file to overwrite the defaults") + '\n[\n]';
const emptyContents = '// ' + nls.localize('emptyKeybindingsHeader', "Place your key bindings in this file to overwrite the defaults") + '\n[\n]';
return this.openTwoEditors(DefaultKeybindingsInput.getInstance(this.instantiationService, this.keybindingService), URI.file(this.environmentService.appKeybindingsPath), emptyContents);
}
@@ -213,7 +213,7 @@ export class OpenWorkspaceSettingsAction extends BaseOpenSettingsAction {
return;
}
let emptySettingsHeader = [
const emptySettingsHeader = [
'// ' + nls.localize('emptySettingsHeader1', "Place your settings in this file to overwrite default and user settings."),
'{',
'}'
@@ -228,8 +228,8 @@ class DefaultSettingsInput extends StringEditorInput {
public static getInstance(instantiationService: IInstantiationService, configurationService: IWorkspaceConfigurationService): DefaultSettingsInput {
if (!DefaultSettingsInput.INSTANCE) {
let editorConfig = configurationService.getConfiguration<any>();
let defaults = getDefaultValuesContent(editorConfig.editor.insertSpaces ? strings.repeat(' ', editorConfig.editor.tabSize) : '\t');
const editorConfig = configurationService.getConfiguration<any>();
const defaults = getDefaultValuesContent(editorConfig.editor.insertSpaces ? strings.repeat(' ', editorConfig.editor.tabSize) : '\t');
let defaultsHeader = '// ' + nls.localize('defaultSettingsHeader', "Overwrite settings by placing them into your settings file.");
defaultsHeader += '\n// ' + nls.localize('defaultSettingsHeader2', "See http://go.microsoft.com/fwlink/?LinkId=808995 for the most commonly used settings.");
@@ -249,8 +249,8 @@ class DefaultKeybindingsInput extends StringEditorInput {
public static getInstance(instantiationService: IInstantiationService, keybindingService: IKeybindingService): DefaultKeybindingsInput {
if (!DefaultKeybindingsInput.INSTANCE) {
let defaultsHeader = '// ' + nls.localize('defaultKeybindingsHeader', "Overwrite key bindings by placing them into your key bindings file.");
let defaultContents = keybindingService.getDefaultKeybindings();
const defaultsHeader = '// ' + nls.localize('defaultKeybindingsHeader', "Overwrite key bindings by placing them into your key bindings file.");
const defaultContents = keybindingService.getDefaultKeybindings();
DefaultKeybindingsInput.INSTANCE = instantiationService.createInstance(DefaultKeybindingsInput, nls.localize('defaultKeybindings', "Default Keyboard Shortcuts"), null, defaultsHeader + '\n' + defaultContents, 'application/json', false);
}

View File

@@ -4,28 +4,42 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import { TPromise } from 'vs/base/common/winjs.base';
import nls = require('vs/nls');
import {Registry} from 'vs/platform/platform';
import {Action} from 'vs/base/common/actions';
import {SyncActionDescriptor} from 'vs/platform/actions/common/actions';
import {IWorkbenchActionRegistry, Extensions} from 'vs/workbench/common/actionRegistry';
import {IPartService, Position} from 'vs/workbench/services/part/common/partService';
import { Registry } from 'vs/platform/platform';
import { Action } from 'vs/base/common/actions';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actionRegistry';
import { IConfigurationEditingService, ConfigurationTarget } from 'vs/workbench/services/configuration/common/configurationEditing';
import { IPartService, Position } from 'vs/workbench/services/part/common/partService';
export class ToggleSidebarPositionAction extends Action {
public static ID = 'workbench.action.toggleSidebarPosition';
public static LABEL = nls.localize('togglePosition', "Toggle Side Bar Position");
public static LABEL = nls.localize('toggleLocation', "Toggle Side Bar Location");
constructor(id: string, label: string, @IPartService private partService: IPartService) {
private static sidebarPositionConfigurationKey = 'workbench.sideBar.location';
constructor(
id: string,
label: string,
@IPartService private partService: IPartService,
@IMessageService private messageService: IMessageService,
@IConfigurationEditingService private configurationEditingService: IConfigurationEditingService
) {
super(id, label);
this.enabled = !!this.partService;
this.enabled = !!this.partService && !!this.configurationEditingService;
}
public run(): TPromise<any> {
let position = this.partService.getSideBarPosition();
this.partService.setSideBarPosition(position === Position.LEFT ? Position.RIGHT : Position.LEFT);
const position = this.partService.getSideBarPosition();
const newPositionValue = (position === Position.LEFT) ? 'right' : 'left';
this.configurationEditingService.writeConfiguration(ConfigurationTarget.USER, { key: ToggleSidebarPositionAction.sidebarPositionConfigurationKey, value: newPositionValue }).then(null, error => {
this.messageService.show(Severity.Error, error);
});
return TPromise.as(null);
}

View File

@@ -4,28 +4,32 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import { TPromise } from 'vs/base/common/winjs.base';
import nls = require('vs/nls');
import {Registry} from 'vs/platform/platform';
import {Action} from 'vs/base/common/actions';
import {SyncActionDescriptor} from 'vs/platform/actions/common/actions';
import {IWorkbenchActionRegistry, Extensions} from 'vs/workbench/common/actionRegistry';
import {IPartService} from 'vs/workbench/services/part/common/partService';
import {KeyMod, KeyCode} from 'vs/base/common/keyCodes';
import { Registry } from 'vs/platform/platform';
import { Action } from 'vs/base/common/actions';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actionRegistry';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
export class ToggleSidebarVisibilityAction extends Action {
public static ID = 'workbench.action.toggleSidebarVisibility';
public static LABEL = nls.localize('toggleSidebar', "Toggle Side Bar Visibility");
constructor(id: string, label: string, @IPartService private partService: IPartService) {
constructor(
id: string,
label: string,
@IPartService private partService: IPartService
) {
super(id, label);
this.enabled = !!this.partService;
}
public run(): TPromise<any> {
let hideSidebar = !this.partService.isSideBarHidden();
const hideSidebar = !this.partService.isSideBarHidden();
this.partService.setSideBarHidden(hideSidebar);
return TPromise.as(null);

View File

@@ -4,27 +4,31 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import { TPromise } from 'vs/base/common/winjs.base';
import nls = require('vs/nls');
import {Registry} from 'vs/platform/platform';
import {Action} from 'vs/base/common/actions';
import {SyncActionDescriptor} from 'vs/platform/actions/common/actions';
import {IWorkbenchActionRegistry, Extensions} from 'vs/workbench/common/actionRegistry';
import {IPartService} from 'vs/workbench/services/part/common/partService';
import { Registry } from 'vs/platform/platform';
import { Action } from 'vs/base/common/actions';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actionRegistry';
import { IPartService } from 'vs/workbench/services/part/common/partService';
export class ToggleStatusbarVisibilityAction extends Action {
public static ID = 'workbench.action.toggleStatusbarVisibility';
public static LABEL = nls.localize('toggleStatusbar', "Toggle Status Bar Visibility");
constructor(id: string, label: string, @IPartService private partService: IPartService) {
constructor(
id: string,
label: string,
@IPartService private partService: IPartService
) {
super(id, label);
this.enabled = !!this.partService;
}
public run(): TPromise<any> {
let hideStatusbar = !this.partService.isStatusBarHidden();
const hideStatusbar = !this.partService.isStatusBarHidden();
this.partService.setStatusBarHidden(hideStatusbar);
return TPromise.as(null);

View File

@@ -3,16 +3,16 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import {TPromise} from 'vs/base/common/winjs.base';
import {Dimension, Builder} from 'vs/base/browser/builder';
import {IAction, IActionRunner, ActionRunner} from 'vs/base/common/actions';
import {IActionItem} from 'vs/base/browser/ui/actionbar/actionbar';
import {WorkbenchComponent} from 'vs/workbench/common/component';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {AsyncDescriptor} from 'vs/platform/instantiation/common/descriptors';
import {IComposite} from 'vs/workbench/common/composite';
import {IEditorControl} from 'vs/platform/editor/common/editor';
import Event, {Emitter} from 'vs/base/common/event';
import { TPromise } from 'vs/base/common/winjs.base';
import { Dimension, Builder } from 'vs/base/browser/builder';
import { IAction, IActionRunner, ActionRunner } from 'vs/base/common/actions';
import { IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { WorkbenchComponent } from 'vs/workbench/common/component';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { AsyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { IComposite } from 'vs/workbench/common/composite';
import { IEditorControl } from 'vs/platform/editor/common/editor';
import Event, { Emitter } from 'vs/base/common/event';
/**
* Composites are layed out in the sidebar and panel part of the workbench. At a time only one composite

View File

@@ -7,17 +7,17 @@
import uri from 'vs/base/common/uri';
import paths = require('vs/base/common/paths');
import {IconLabel, IIconLabelOptions, IIconLabelCreationOptions} from 'vs/base/browser/ui/iconLabel/iconLabel';
import {IExtensionService} from 'vs/platform/extensions/common/extensions';
import {IModeService} from 'vs/editor/common/services/modeService';
import {IEditorInput} from 'vs/platform/editor/common/editor';
import {getResource} from 'vs/workbench/common/editor';
import {getPathLabel} from 'vs/base/common/labels';
import {PLAINTEXT_MODE_ID} from 'vs/editor/common/modes/modesRegistry';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import {IModelService} from 'vs/editor/common/services/modelService';
import { IconLabel, IIconLabelOptions, IIconLabelCreationOptions } from 'vs/base/browser/ui/iconLabel/iconLabel';
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
import { IModeService } from 'vs/editor/common/services/modeService';
import { IEditorInput } from 'vs/platform/editor/common/editor';
import { getResource } from 'vs/workbench/common/editor';
import { getPathLabel } from 'vs/base/common/labels';
import { PLAINTEXT_MODE_ID } from 'vs/editor/common/modes/modesRegistry';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IModelService } from 'vs/editor/common/services/modelService';
export interface IEditorLabel {
name: string;

View File

@@ -4,19 +4,19 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {Dimension, Builder, Box} from 'vs/base/browser/builder';
import {Part} from 'vs/workbench/browser/part';
import {QuickOpenController} from 'vs/workbench/browser/parts/quickopen/quickOpenController';
import {Sash, ISashEvent, IVerticalSashLayoutProvider, IHorizontalSashLayoutProvider, Orientation} from 'vs/base/browser/ui/sash/sash';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {IPartService, Position} from 'vs/workbench/services/part/common/partService';
import {IViewletService} from 'vs/workbench/services/viewlet/common/viewletService';
import {IStorageService, StorageScope} from 'vs/platform/storage/common/storage';
import {IContextViewService} from 'vs/platform/contextview/browser/contextView';
import {IEventService} from 'vs/platform/event/common/event';
import {IThemeService} from 'vs/workbench/services/themes/common/themeService';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import {IEditorGroupService} from 'vs/workbench/services/group/common/groupService';
import { Dimension, Builder, Box } from 'vs/base/browser/builder';
import { Part } from 'vs/workbench/browser/part';
import { QuickOpenController } from 'vs/workbench/browser/parts/quickopen/quickOpenController';
import { Sash, ISashEvent, IVerticalSashLayoutProvider, IHorizontalSashLayoutProvider, Orientation } from 'vs/base/browser/ui/sash/sash';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IPartService, Position } from 'vs/workbench/services/part/common/partService';
import { IViewletService } from 'vs/workbench/services/viewlet/common/viewletService';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { IEventService } from 'vs/platform/event/common/event';
import { IThemeService } from 'vs/workbench/services/themes/common/themeService';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
const DEFAULT_MIN_PART_WIDTH = 170;
const DEFAULT_MIN_PANEL_PART_HEIGHT = 77;

View File

@@ -4,10 +4,10 @@
*--------------------------------------------------------------------------------------------*/
import * as DOM from 'vs/base/browser/dom';
import {Registry} from 'vs/platform/platform';
import {TPromise} from 'vs/base/common/winjs.base';
import {IPanel} from 'vs/workbench/common/panel';
import {Composite, CompositeDescriptor, CompositeRegistry} from 'vs/workbench/browser/composite';
import { Registry } from 'vs/platform/platform';
import { TPromise } from 'vs/base/common/winjs.base';
import { IPanel } from 'vs/workbench/common/panel';
import { Composite, CompositeDescriptor, CompositeRegistry } from 'vs/workbench/browser/composite';
import { Action } from 'vs/base/common/actions';
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import { IPartService } from 'vs/workbench/services/part/common/partService';
@@ -92,7 +92,7 @@ export abstract class TogglePanelAction extends Action {
}
private isPanelShowing(): boolean {
let panel= this.panelService.getActivePanel();
let panel = this.panelService.getActivePanel();
return panel && panel.getId() === this.panelId;
}

View File

@@ -6,8 +6,8 @@
'use strict';
import 'vs/css!./media/part';
import {Dimension, Builder} from 'vs/base/browser/builder';
import {WorkbenchComponent} from 'vs/workbench/common/component';
import { Dimension, Builder } from 'vs/base/browser/builder';
import { WorkbenchComponent } from 'vs/workbench/common/component';
/**
* Parts are layed out in the workbench and have their own layout that arranges a title,

View File

@@ -7,12 +7,12 @@
import 'vs/css!./media/activityaction';
import nls = require('vs/nls');
import {Builder, $} from 'vs/base/browser/builder';
import {DelayedDragHandler} from 'vs/base/browser/dnd';
import {Action} from 'vs/base/common/actions';
import {BaseActionItem} from 'vs/base/browser/ui/actionbar/actionbar';
import {ProgressBadge, TextBadge, NumberBadge, IconBadge, IBadge} from 'vs/workbench/services/activity/common/activityService';
import Event, {Emitter} from 'vs/base/common/event';
import { Builder, $ } from 'vs/base/browser/builder';
import { DelayedDragHandler } from 'vs/base/browser/dnd';
import { Action } from 'vs/base/common/actions';
import { BaseActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { ProgressBadge, TextBadge, NumberBadge, IconBadge, IBadge } from 'vs/workbench/services/activity/common/activityService';
import Event, { Emitter } from 'vs/base/common/event';
export class ActivityAction extends Action {

View File

@@ -7,21 +7,21 @@
import 'vs/css!./media/activitybarpart';
import nls = require('vs/nls');
import {TPromise} from 'vs/base/common/winjs.base';
import {Builder, $} from 'vs/base/browser/builder';
import {Action} from 'vs/base/common/actions';
import { TPromise } from 'vs/base/common/winjs.base';
import { Builder, $ } from 'vs/base/browser/builder';
import { Action } from 'vs/base/common/actions';
import errors = require('vs/base/common/errors');
import {ActionsOrientation, ActionBar, IActionItem} from 'vs/base/browser/ui/actionbar/actionbar';
import {Registry} from 'vs/platform/platform';
import {IComposite} from 'vs/workbench/common/composite';
import {ViewletDescriptor, ViewletRegistry, Extensions as ViewletExtensions} from 'vs/workbench/browser/viewlet';
import {Part} from 'vs/workbench/browser/part';
import {ActivityAction, ActivityActionItem} from 'vs/workbench/browser/parts/activitybar/activityAction';
import {IViewletService} from 'vs/workbench/services/viewlet/common/viewletService';
import {IActivityService, IBadge} from 'vs/workbench/services/activity/common/activityService';
import {IPartService} from 'vs/workbench/services/part/common/partService';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import { ActionsOrientation, ActionBar, IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { Registry } from 'vs/platform/platform';
import { IComposite } from 'vs/workbench/common/composite';
import { ViewletDescriptor, ViewletRegistry, Extensions as ViewletExtensions } from 'vs/workbench/browser/viewlet';
import { Part } from 'vs/workbench/browser/part';
import { ActivityAction, ActivityActionItem } from 'vs/workbench/browser/parts/activitybar/activityAction';
import { IViewletService } from 'vs/workbench/services/viewlet/common/viewletService';
import { IActivityService, IBadge } from 'vs/workbench/services/activity/common/activityService';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
export class ActivitybarPart extends Part implements IActivityService {
public _serviceBrand: any;

View File

@@ -7,33 +7,33 @@ import 'vs/css!./media/compositepart';
import nls = require('vs/nls');
import timer = require('vs/base/common/timer');
import uuid = require('vs/base/common/uuid');
import {TPromise} from 'vs/base/common/winjs.base';
import {Registry} from 'vs/platform/platform';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import {Dimension, Builder, $} from 'vs/base/browser/builder';
import { TPromise } from 'vs/base/common/winjs.base';
import { Registry } from 'vs/platform/platform';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { Dimension, Builder, $ } from 'vs/base/browser/builder';
import events = require('vs/base/common/events');
import strings = require('vs/base/common/strings');
import {Emitter} from 'vs/base/common/event';
import { Emitter } from 'vs/base/common/event';
import types = require('vs/base/common/types');
import errors = require('vs/base/common/errors');
import {CONTEXT as ToolBarContext, ToolBar} from 'vs/base/browser/ui/toolbar/toolbar';
import {IActionItem, ActionsOrientation} from 'vs/base/browser/ui/actionbar/actionbar';
import {ProgressBar} from 'vs/base/browser/ui/progressbar/progressbar';
import {IActionBarRegistry, Extensions, prepareActions} from 'vs/workbench/browser/actionBarRegistry';
import {Action, IAction} from 'vs/base/common/actions';
import {Part} from 'vs/workbench/browser/part';
import {Composite, CompositeRegistry} from 'vs/workbench/browser/composite';
import {IComposite} from 'vs/workbench/common/composite';
import {WorkbenchProgressService} from 'vs/workbench/services/progress/browser/progressService';
import {IPartService} from 'vs/workbench/services/part/common/partService';
import {IStorageService, StorageScope} from 'vs/platform/storage/common/storage';
import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {ServiceCollection} from 'vs/platform/instantiation/common/serviceCollection';
import {IMessageService, Severity} from 'vs/platform/message/common/message';
import {IProgressService} from 'vs/platform/progress/common/progress';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import { CONTEXT as ToolBarContext, ToolBar } from 'vs/base/browser/ui/toolbar/toolbar';
import { IActionItem, ActionsOrientation } from 'vs/base/browser/ui/actionbar/actionbar';
import { ProgressBar } from 'vs/base/browser/ui/progressbar/progressbar';
import { IActionBarRegistry, Extensions, prepareActions } from 'vs/workbench/browser/actionBarRegistry';
import { Action, IAction } from 'vs/base/common/actions';
import { Part } from 'vs/workbench/browser/part';
import { Composite, CompositeRegistry } from 'vs/workbench/browser/composite';
import { IComposite } from 'vs/workbench/common/composite';
import { WorkbenchProgressService } from 'vs/workbench/services/progress/browser/progressService';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import { IProgressService } from 'vs/platform/progress/common/progress';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
export abstract class CompositePart<T extends Composite> extends Part {
private instantiatedCompositeListeners: IDisposable[];

View File

@@ -4,18 +4,18 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import {Action, IAction} from 'vs/base/common/actions';
import {ActionBarContributor} from 'vs/workbench/browser/actionBarRegistry';
import { TPromise } from 'vs/base/common/winjs.base';
import { Action, IAction } from 'vs/base/common/actions';
import { ActionBarContributor } from 'vs/workbench/browser/actionBarRegistry';
import types = require('vs/base/common/types');
import {Builder} from 'vs/base/browser/builder';
import {Registry} from 'vs/platform/platform';
import {Panel} from 'vs/workbench/browser/panel';
import {EditorInput, IFileEditorInput, EditorOptions, IEditorDescriptor, IEditorInputFactory, IEditorRegistry, Extensions} from 'vs/workbench/common/editor';
import {IEditor, Position, POSITIONS} from 'vs/platform/editor/common/editor';
import {IInstantiationService, IConstructorSignature0} from 'vs/platform/instantiation/common/instantiation';
import {SyncDescriptor, AsyncDescriptor} from 'vs/platform/instantiation/common/descriptors';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import { Builder } from 'vs/base/browser/builder';
import { Registry } from 'vs/platform/platform';
import { Panel } from 'vs/workbench/browser/panel';
import { EditorInput, IFileEditorInput, EditorOptions, IEditorDescriptor, IEditorInputFactory, IEditorRegistry, Extensions } from 'vs/workbench/common/editor';
import { IEditor, Position, POSITIONS } from 'vs/platform/editor/common/editor';
import { IInstantiationService, IConstructorSignature0 } from 'vs/platform/instantiation/common/instantiation';
import { SyncDescriptor, AsyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
/**
* The base class of editors in the workbench. Editors register themselves for specific editor inputs.
@@ -86,7 +86,7 @@ export abstract class BaseEditor extends Panel implements IEditor {
public create(parent: Builder): void; // create is sync for editors
public create(parent: Builder): TPromise<void>;
public create(parent: Builder): TPromise<void> {
let res = super.create(parent);
const res = super.create(parent);
// Create Editor
this.createEditor(parent);
@@ -105,7 +105,7 @@ export abstract class BaseEditor extends Panel implements IEditor {
public setVisible(visible: boolean, position?: Position): void; // setVisible is sync for editors
public setVisible(visible: boolean, position?: Position): TPromise<void>;
public setVisible(visible: boolean, position: Position = null): TPromise<void> {
let promise = super.setVisible(visible);
const promise = super.setVisible(visible);
// Propagate to Editor
this.setEditorVisible(visible, position);
@@ -185,7 +185,7 @@ class EditorRegistry implements IEditorRegistry {
this.instantiationService = service;
for (let key in this.editorInputFactoryConstructors) {
let element = this.editorInputFactoryConstructors[key];
const element = this.editorInputFactoryConstructors[key];
this.createEditorInputFactory(key, element);
}
@@ -193,7 +193,7 @@ class EditorRegistry implements IEditorRegistry {
}
private createEditorInputFactory(editorInputId: string, ctor: IConstructorSignature0<IEditorInputFactory>): void {
let instance = this.instantiationService.createInstance(ctor);
const instance = this.instantiationService.createInstance(ctor);
this.editorInputFactoryInstances[editorInputId] = instance;
}
@@ -215,14 +215,14 @@ class EditorRegistry implements IEditorRegistry {
}
public getEditor(input: EditorInput): EditorDescriptor {
let findEditorDescriptors = (input: EditorInput, byInstanceOf?: boolean): EditorDescriptor[]=> {
let matchingDescriptors: EditorDescriptor[] = [];
const findEditorDescriptors = (input: EditorInput, byInstanceOf?: boolean): EditorDescriptor[] => {
const matchingDescriptors: EditorDescriptor[] = [];
for (let i = 0; i < this.editors.length; i++) {
let editor = this.editors[i];
let inputDescriptors = <SyncDescriptor<EditorInput>[]>editor[INPUT_DESCRIPTORS_PROPERTY];
const editor = this.editors[i];
const inputDescriptors = <SyncDescriptor<EditorInput>[]>editor[INPUT_DESCRIPTORS_PROPERTY];
for (let j = 0; j < inputDescriptors.length; j++) {
let inputClass = inputDescriptors[j].ctor;
const inputClass = inputDescriptors[j].ctor;
// Direct check on constructor type (ignores prototype chain)
if (!byInstanceOf && (<any>input).constructor === inputClass) {
@@ -250,11 +250,11 @@ class EditorRegistry implements IEditorRegistry {
return matchingDescriptors;
};
let descriptors = findEditorDescriptors(input);
const descriptors = findEditorDescriptors(input);
if (descriptors && descriptors.length > 0) {
// Ask the input for its preferred Editor
let preferredEditorId = input.getPreferredEditorId(descriptors.map(d => d.getId()));
const preferredEditorId = input.getPreferredEditorId(descriptors.map(d => d.getId()));
if (preferredEditorId) {
return this.getEditorById(preferredEditorId);
}
@@ -268,7 +268,7 @@ class EditorRegistry implements IEditorRegistry {
public getEditorById(editorId: string): EditorDescriptor {
for (let i = 0; i < this.editors.length; i++) {
let editor = this.editors[i];
const editor = this.editors[i];
if (editor.getId() === editorId) {
return editor;
}
@@ -286,11 +286,11 @@ class EditorRegistry implements IEditorRegistry {
}
public getEditorInputs(): any[] {
let inputClasses: any[] = [];
const inputClasses: any[] = [];
for (let i = 0; i < this.editors.length; i++) {
let editor = this.editors[i];
let editorInputDescriptors = <SyncDescriptor<EditorInput>[]>editor[INPUT_DESCRIPTORS_PROPERTY];
inputClasses.push(...editorInputDescriptors.map(descriptor=> descriptor.ctor));
const editor = this.editors[i];
const editorInputDescriptors = <SyncDescriptor<EditorInput>[]>editor[INPUT_DESCRIPTORS_PROPERTY];
inputClasses.push(...editorInputDescriptors.map(descriptor => descriptor.ctor));
}
return inputClasses;
@@ -346,7 +346,7 @@ export class EditorInputActionContributor extends ActionBarContributor {
}
private createPositionArray(): any[] {
let array: any[] = [];
const array: any[] = [];
for (let i = 0; i < POSITIONS.length; i++) {
array[i] = {};
@@ -371,7 +371,7 @@ export class EditorInputActionContributor extends ActionBarContributor {
private doClearInputsFromCache(cache: { [id: string]: IEditorInputAction[] }): void {
for (let key in cache) {
if (cache.hasOwnProperty(key)) {
let cachedActions = cache[key];
const cachedActions = cache[key];
cachedActions.forEach((action) => {
action.input = null;
action.position = null;
@@ -412,9 +412,9 @@ export class EditorInputActionContributor extends ActionBarContributor {
this.clearInputsFromCache(context.position, true /* primary actions */);
// First consult cache
let editorInput = context.input;
let editorPosition = context.position;
let cachedActions = this.mapEditorInputActionContextToPrimaryActions[context.position][this.toId(context)];
const editorInput = context.input;
const editorPosition = context.position;
const cachedActions = this.mapEditorInputActionContextToPrimaryActions[context.position][this.toId(context)];
if (cachedActions) {
// Update the input field and position in all actions to indicate this change and return
@@ -427,7 +427,7 @@ export class EditorInputActionContributor extends ActionBarContributor {
}
// Otherwise collect and keep in cache
let actions = this.getActionsForEditorInput(context);
const actions = this.getActionsForEditorInput(context);
actions.forEach((action) => {
action.input = editorInput;
action.position = editorPosition;
@@ -470,9 +470,9 @@ export class EditorInputActionContributor extends ActionBarContributor {
this.clearInputsFromCache(context.position, false /* secondary actions */);
// First consult cache
let editorInput = context.input;
let editorPosition = context.position;
let cachedActions = this.mapEditorInputActionContextToSecondaryActions[context.position][this.toId(context)];
const editorInput = context.input;
const editorPosition = context.position;
const cachedActions = this.mapEditorInputActionContextToSecondaryActions[context.position][this.toId(context)];
if (cachedActions) {
// Update the input field and position in all actions to indicate this change and return
@@ -485,7 +485,7 @@ export class EditorInputActionContributor extends ActionBarContributor {
}
// Otherwise collect and keep in cache
let actions = this.getSecondaryActionsForEditorInput(context);
const actions = this.getSecondaryActionsForEditorInput(context);
actions.forEach((action) => {
action.input = editorInput;
action.position = editorPosition;

View File

@@ -6,28 +6,28 @@
'use strict';
import 'vs/css!./media/binarydiffeditor';
import Event, {Emitter} from 'vs/base/common/event';
import {TPromise} from 'vs/base/common/winjs.base';
import Event, { Emitter } from 'vs/base/common/event';
import { TPromise } from 'vs/base/common/winjs.base';
import nls = require('vs/nls');
import URI from 'vs/base/common/uri';
import {Sash, ISashEvent, IVerticalSashLayoutProvider} from 'vs/base/browser/ui/sash/sash';
import {Dimension, Builder, $} from 'vs/base/browser/builder';
import {ResourceViewer} from 'vs/base/browser/ui/resourceviewer/resourceViewer';
import {DomScrollableElement} from 'vs/base/browser/ui/scrollbar/scrollableElement';
import {BaseEditor} from 'vs/workbench/browser/parts/editor/baseEditor';
import {EditorInput, EditorOptions} from 'vs/workbench/common/editor';
import {BinaryEditorModel} from 'vs/workbench/common/editor/binaryEditorModel';
import {DiffEditorModel} from 'vs/workbench/common/editor/diffEditorModel';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {ScrollbarVisibility} from 'vs/base/common/scrollable';
import { Sash, ISashEvent, IVerticalSashLayoutProvider } from 'vs/base/browser/ui/sash/sash';
import { Dimension, Builder, $ } from 'vs/base/browser/builder';
import { ResourceViewer } from 'vs/base/browser/ui/resourceviewer/resourceViewer';
import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
import { EditorInput, EditorOptions, BINARY_DIFF_EDITOR_ID } from 'vs/workbench/common/editor';
import { BinaryEditorModel } from 'vs/workbench/common/editor/binaryEditorModel';
import { DiffEditorModel } from 'vs/workbench/common/editor/diffEditorModel';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
/**
* An implementation of editor for diffing binary files like images or videos.
*/
export class BinaryResourceDiffEditor extends BaseEditor implements IVerticalSashLayoutProvider {
public static ID = 'workbench.editors.binaryResourceDiffEditor';
public static ID = BINARY_DIFF_EDITOR_ID;
private static MIN_CONTAINER_WIDTH = 100;
@@ -64,7 +64,7 @@ export class BinaryResourceDiffEditor extends BaseEditor implements IVerticalSas
public createEditor(parent: Builder): void {
// Left Container for Binary
let leftBinaryContainerElement = document.createElement('div');
const leftBinaryContainerElement = document.createElement('div');
leftBinaryContainerElement.className = 'binary-container';
this.leftBinaryContainer = $(leftBinaryContainerElement);
this.leftBinaryContainer.tabindex(0); // enable focus support from the editor part (do not remove)
@@ -82,7 +82,7 @@ export class BinaryResourceDiffEditor extends BaseEditor implements IVerticalSas
this.sash.addListener2('reset', () => this.onSashReset());
// Right Container for Binary
let rightBinaryContainerElement = document.createElement('div');
const rightBinaryContainerElement = document.createElement('div');
rightBinaryContainerElement.className = 'binary-container';
this.rightBinaryContainer = $(rightBinaryContainerElement);
this.rightBinaryContainer.tabindex(0); // enable focus support from the editor part (do not remove)
@@ -94,11 +94,11 @@ export class BinaryResourceDiffEditor extends BaseEditor implements IVerticalSas
}
public setInput(input: EditorInput, options: EditorOptions): TPromise<void> {
let oldInput = this.getInput();
const oldInput = this.getInput();
super.setInput(input, options);
// Detect options
let forceOpen = options && options.forceOpen;
const forceOpen = options && options.forceOpen;
// Same Input
if (!forceOpen && input.matches(oldInput)) {
@@ -119,11 +119,11 @@ export class BinaryResourceDiffEditor extends BaseEditor implements IVerticalSas
}
// Render original
let original = <BinaryEditorModel>resolvedModel.originalModel;
const original = <BinaryEditorModel>resolvedModel.originalModel;
this.renderInput(original.getName(), original.getResource(), original.getSize(), original.getETag(), true);
// Render modified
let modified = <BinaryEditorModel>resolvedModel.modifiedModel;
const modified = <BinaryEditorModel>resolvedModel.modifiedModel;
this.renderInput(modified.getName(), modified.getResource(), modified.getSize(), modified.getETag(), false);
});
}
@@ -138,8 +138,8 @@ export class BinaryResourceDiffEditor extends BaseEditor implements IVerticalSas
}
// Pass to ResourceViewer
let container = isOriginal ? this.leftBinaryContainer : this.rightBinaryContainer;
let scrollbar = isOriginal ? this.leftScrollbar : this.rightScrollbar;
const container = isOriginal ? this.leftBinaryContainer : this.rightBinaryContainer;
const scrollbar = isOriginal ? this.leftScrollbar : this.rightScrollbar;
ResourceViewer.show({ name, resource, size, etag }, container, scrollbar, (meta) => this.handleMetadataChanged(meta, isOriginal));
}
@@ -172,14 +172,14 @@ export class BinaryResourceDiffEditor extends BaseEditor implements IVerticalSas
}
public layout(dimension: Dimension): void {
let oldDimension = this.dimension;
const oldDimension = this.dimension;
this.dimension = dimension;
// Calculate left hand container width based on sash move or fallback to 50% by default
if (!this.leftContainerWidth || !oldDimension) {
this.leftContainerWidth = this.dimension.width / 2;
} else {
let sashRatio = this.leftContainerWidth / oldDimension.width;
const sashRatio = this.leftContainerWidth / oldDimension.width;
this.leftContainerWidth = this.dimension.width * sashRatio;
}
@@ -208,7 +208,7 @@ export class BinaryResourceDiffEditor extends BaseEditor implements IVerticalSas
private onSashDrag(e: ISashEvent): void {
// Update Widths and keep in bounds of MIN_CONTAINER_WIDTH for both sides
let newLeftContainerWidth = this.startLeftContainerWidth + e.currentX - e.startX;
const newLeftContainerWidth = this.startLeftContainerWidth + e.currentX - e.startX;
this.leftContainerWidth = Math.max(BinaryResourceDiffEditor.MIN_CONTAINER_WIDTH, newLeftContainerWidth);
if (this.dimension.width - this.leftContainerWidth < BinaryResourceDiffEditor.MIN_CONTAINER_WIDTH) {
this.leftContainerWidth = this.dimension.width - BinaryResourceDiffEditor.MIN_CONTAINER_WIDTH;

View File

@@ -6,17 +6,17 @@
'use strict';
import nls = require('vs/nls');
import Event, {Emitter} from 'vs/base/common/event';
import {TPromise} from 'vs/base/common/winjs.base';
import {Dimension, Builder, $} from 'vs/base/browser/builder';
import {ResourceViewer} from 'vs/base/browser/ui/resourceviewer/resourceViewer';
import {EditorModel, EditorInput, EditorOptions} from 'vs/workbench/common/editor';
import {BaseEditor} from 'vs/workbench/browser/parts/editor/baseEditor';
import {BinaryEditorModel} from 'vs/workbench/common/editor/binaryEditorModel';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {DomScrollableElement} from 'vs/base/browser/ui/scrollbar/scrollableElement';
import {ScrollbarVisibility} from 'vs/base/common/scrollable';
import Event, { Emitter } from 'vs/base/common/event';
import { TPromise } from 'vs/base/common/winjs.base';
import { Dimension, Builder, $ } from 'vs/base/browser/builder';
import { ResourceViewer } from 'vs/base/browser/ui/resourceviewer/resourceViewer';
import { EditorModel, EditorInput, EditorOptions } from 'vs/workbench/common/editor';
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
import { BinaryEditorModel } from 'vs/workbench/common/editor/binaryEditorModel';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
/*
* This class is only intended to be subclassed and not instantiated.
@@ -49,7 +49,7 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor {
public createEditor(parent: Builder): void {
// Container for Binary
let binaryContainerElement = document.createElement('div');
const binaryContainerElement = document.createElement('div');
binaryContainerElement.className = 'binary-container';
this.binaryContainer = $(binaryContainerElement);
this.binaryContainer.tabindex(0); // enable focus support from the editor part (do not remove)
@@ -60,11 +60,11 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor {
}
public setInput(input: EditorInput, options: EditorOptions): TPromise<void> {
let oldInput = this.getInput();
const oldInput = this.getInput();
super.setInput(input, options);
// Detect options
let forceOpen = options && options.forceOpen;
const forceOpen = options && options.forceOpen;
// Same Input
if (!forceOpen && input.matches(oldInput)) {
@@ -85,7 +85,7 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor {
}
// Render Input
let model = <BinaryEditorModel>resolvedModel;
const model = <BinaryEditorModel>resolvedModel;
ResourceViewer.show({ name: model.getName(), resource: model.getResource(), size: model.getSize(), etag: model.getETag() }, this.binaryContainer, this.scrollbar, (meta) => this.handleMetadataChanged(meta));
return TPromise.as<void>(null);

View File

@@ -4,31 +4,32 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {Registry} from 'vs/platform/platform';
import { Registry } from 'vs/platform/platform';
import nls = require('vs/nls');
import {Action, IAction} from 'vs/base/common/actions';
import {IEditorQuickOpenEntry, IQuickOpenRegistry, Extensions as QuickOpenExtensions, QuickOpenHandlerDescriptor} from 'vs/workbench/browser/quickopen';
import {StatusbarItemDescriptor, StatusbarAlignment, IStatusbarRegistry, Extensions as StatusExtensions} from 'vs/workbench/browser/parts/statusbar/statusbar';
import {EditorDescriptor} from 'vs/workbench/browser/parts/editor/baseEditor';
import {IEditorRegistry, Extensions as EditorExtensions} from 'vs/workbench/common/editor';
import {StringEditorInput} from 'vs/workbench/common/editor/stringEditorInput';
import {StringEditor} from 'vs/workbench/browser/parts/editor/stringEditor';
import {DiffEditorInput} from 'vs/workbench/common/editor/diffEditorInput';
import {UntitledEditorInput} from 'vs/workbench/common/editor/untitledEditorInput';
import {ResourceEditorInput} from 'vs/workbench/common/editor/resourceEditorInput';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {KeybindingsRegistry} from 'vs/platform/keybinding/common/keybindingsRegistry';
import {TextDiffEditor} from 'vs/workbench/browser/parts/editor/textDiffEditor';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {BinaryResourceDiffEditor} from 'vs/workbench/browser/parts/editor/binaryDiffEditor';
import {IEditorGroupService} from 'vs/workbench/services/group/common/groupService';
import {ChangeEncodingAction, ChangeEOLAction, ChangeModeAction, EditorStatus} from 'vs/workbench/browser/parts/editor/editorStatus';
import {IWorkbenchActionRegistry, Extensions as ActionExtensions} from 'vs/workbench/common/actionRegistry';
import {Scope, IActionBarRegistry, Extensions as ActionBarExtensions, ActionBarContributor} from 'vs/workbench/browser/actionBarRegistry';
import {SyncActionDescriptor} from 'vs/platform/actions/common/actions';
import {SyncDescriptor} from 'vs/platform/instantiation/common/descriptors';
import {KeyMod, KeyChord, KeyCode} from 'vs/base/common/keyCodes';
import {CloseEditorsInGroupAction, CloseEditorsInOtherGroupsAction, CloseAllEditorsAction, MoveGroupLeftAction, MoveGroupRightAction, SplitEditorAction, KeepEditorAction, CloseOtherEditorsInGroupAction, OpenToSideAction,
import { Action, IAction } from 'vs/base/common/actions';
import { IEditorQuickOpenEntry, IQuickOpenRegistry, Extensions as QuickOpenExtensions, QuickOpenHandlerDescriptor } from 'vs/workbench/browser/quickopen';
import { StatusbarItemDescriptor, StatusbarAlignment, IStatusbarRegistry, Extensions as StatusExtensions } from 'vs/workbench/browser/parts/statusbar/statusbar';
import { EditorDescriptor } from 'vs/workbench/browser/parts/editor/baseEditor';
import { IEditorRegistry, Extensions as EditorExtensions } from 'vs/workbench/common/editor';
import { StringEditorInput } from 'vs/workbench/common/editor/stringEditorInput';
import { StringEditor } from 'vs/workbench/browser/parts/editor/stringEditor';
import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { TextDiffEditor } from 'vs/workbench/browser/parts/editor/textDiffEditor';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { BinaryResourceDiffEditor } from 'vs/workbench/browser/parts/editor/binaryDiffEditor';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { ChangeEncodingAction, ChangeEOLAction, ChangeModeAction, EditorStatus } from 'vs/workbench/browser/parts/editor/editorStatus';
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actionRegistry';
import { Scope, IActionBarRegistry, Extensions as ActionBarExtensions, ActionBarContributor } from 'vs/workbench/browser/actionBarRegistry';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes';
import {
CloseEditorsInGroupAction, CloseEditorsInOtherGroupsAction, CloseAllEditorsAction, MoveGroupLeftAction, MoveGroupRightAction, SplitEditorAction, KeepEditorAction, CloseOtherEditorsInGroupAction, OpenToSideAction,
NavigateBetweenGroupsAction, FocusActiveGroupAction, FocusFirstGroupAction, FocusSecondGroupAction, FocusThirdGroupAction, EvenGroupWidthsAction, MaximizeGroupAction, MinimizeOtherGroupsAction, FocusPreviousGroup, FocusNextGroup, ShowEditorsInLeftGroupAction,
toEditorQuickOpenEntry, CloseLeftEditorsInGroupAction, CloseRightEditorsInGroupAction, OpenNextEditor, OpenPreviousEditor, NavigateBackwardsAction, NavigateForwardAction, ReopenClosedEditorAction, OpenPreviousRecentlyUsedEditorInGroupAction, NAVIGATE_IN_LEFT_GROUP_PREFIX,
OpenPreviousEditorFromHistoryAction, ShowAllEditorsAction, NAVIGATE_ALL_EDITORS_GROUP_PREFIX, ClearEditorHistoryAction, ShowEditorsInCenterGroupAction, MoveEditorRightInGroupAction,
@@ -95,15 +96,15 @@ export class QuickOpenActionContributor extends ActionBarContributor {
}
public hasActions(context: any): boolean {
let entry = this.getEntry(context);
const entry = this.getEntry(context);
return !!entry;
}
public getActions(context: any): IAction[] {
let actions: Action[] = [];
const actions: Action[] = [];
let entry = this.getEntry(context);
const entry = this.getEntry(context);
if (entry) {
if (!this.openToSideActionInstance) {
this.openToSideActionInstance = this.instantiationService.createInstance(OpenToSideAction);

View File

@@ -4,22 +4,22 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import { TPromise } from 'vs/base/common/winjs.base';
import nls = require('vs/nls');
import {Action} from 'vs/base/common/actions';
import {EditorInput, getUntitledOrFileResource, TextEditorOptions, EditorOptions, IEditorIdentifier, IEditorContext, ActiveEditorMoveArguments, ActiveEditorMovePositioning, EditorCommands} from 'vs/workbench/common/editor';
import {QuickOpenEntryGroup} from 'vs/base/parts/quickopen/browser/quickOpenModel';
import {EditorQuickOpenEntry, EditorQuickOpenEntryGroup, IEditorQuickOpenEntry, QuickOpenAction} from 'vs/workbench/browser/quickopen';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {IQuickOpenService} from 'vs/workbench/services/quickopen/common/quickOpenService';
import {IPartService} from 'vs/workbench/services/part/common/partService';
import {Position, IEditor, Direction, IResourceInput, IEditorInput} from 'vs/platform/editor/common/editor';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IHistoryService} from 'vs/workbench/services/history/common/history';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IEditorGroupService, GroupArrangement} from 'vs/workbench/services/group/common/groupService';
import {BaseTextEditor} from 'vs/workbench/browser/parts/editor/textEditor';
import {ICommandService} from 'vs/platform/commands/common/commands';
import { Action } from 'vs/base/common/actions';
import { EditorInput, getUntitledOrFileResource, TextEditorOptions, EditorOptions, IEditorIdentifier, IEditorContext, ActiveEditorMoveArguments, ActiveEditorMovePositioning, EditorCommands } from 'vs/workbench/common/editor';
import { QuickOpenEntryGroup } from 'vs/base/parts/quickopen/browser/quickOpenModel';
import { EditorQuickOpenEntry, EditorQuickOpenEntryGroup, IEditorQuickOpenEntry, QuickOpenAction } from 'vs/workbench/browser/quickopen';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IQuickOpenService } from 'vs/workbench/services/quickopen/common/quickOpenService';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { Position, IEditor, Direction, IResourceInput, IEditorInput } from 'vs/platform/editor/common/editor';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IHistoryService } from 'vs/workbench/services/history/common/history';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IEditorGroupService, GroupArrangement } from 'vs/workbench/services/group/common/groupService';
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
import { ICommandService } from 'vs/platform/commands/common/commands';
export class SplitEditorAction extends Action {
@@ -190,9 +190,13 @@ export class FocusFirstGroupAction extends Action {
const history = this.historyService.getHistory();
for (let input of history) {
// For now only support to open resources from history to the side
if (!!getUntitledOrFileResource(input)) {
return this.editorService.openEditor(input, null, Position.LEFT);
// For now only support to open files from history to the side
if (input instanceof EditorInput) {
if (!!getUntitledOrFileResource(input)) {
return this.editorService.openEditor(input, null, Position.LEFT);
}
} else {
return this.editorService.openEditor(input as IResourceInput, Position.LEFT);
}
}
@@ -259,8 +263,12 @@ export abstract class BaseFocusSideGroupAction extends Action {
for (let input of history) {
// For now only support to open files from history to the side
if (!!getUntitledOrFileResource(input)) {
return this.editorService.openEditor(input, { pinned: true }, this.getTargetEditorSide());
if (input instanceof EditorInput) {
if (!!getUntitledOrFileResource(input)) {
return this.editorService.openEditor(input, { pinned: true }, this.getTargetEditorSide());
}
} else {
return this.editorService.openEditor({ resource: (input as IResourceInput).resource, options: { pinned: true } }, this.getTargetEditorSide());
}
}
}
@@ -924,17 +932,7 @@ export class ReopenClosedEditorAction extends Action {
}
public run(): TPromise<any> {
const stacks = this.editorGroupService.getStacksModel();
// Find an editor that was closed and is currently not opened in the group
let lastClosedEditor = this.historyService.popLastClosedEditor();
while (lastClosedEditor && stacks.activeGroup && stacks.activeGroup.indexOf(lastClosedEditor.editor) >= 0) {
lastClosedEditor = this.historyService.popLastClosedEditor();
}
if (lastClosedEditor) {
this.editorService.openEditor(lastClosedEditor.editor, { pinned: true, index: lastClosedEditor.index });
}
this.historyService.reopenLastClosedEditor();
return TPromise.as(false);
}

View File

@@ -5,19 +5,19 @@
import * as nls from 'vs/nls';
import * as types from 'vs/base/common/types';
import {ServicesAccessor} from 'vs/platform/instantiation/common/instantiation';
import {KeybindingsRegistry} from 'vs/platform/keybinding/common/keybindingsRegistry';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IEditorGroupService} from 'vs/workbench/services/group/common/groupService';
import {IWorkbenchEditorConfiguration, ActiveEditorMoveArguments, ActiveEditorMovePositioning, ActiveEditorMovePositioningBy, EditorCommands} from 'vs/workbench/common/editor';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {IEditor, Position, POSITIONS} from 'vs/platform/editor/common/editor';
import {EditorContextKeys} from 'vs/editor/common/editorCommon';
import {TextCompareEditorVisible, TextDiffEditor} from 'vs/workbench/browser/parts/editor/textDiffEditor';
import {EditorStacksModel} from 'vs/workbench/common/editor/editorStacksModel';
import {ICommandService} from 'vs/platform/commands/common/commands';
import {IMessageService, Severity, CloseAction} from 'vs/platform/message/common/message';
import {Action} from 'vs/base/common/actions';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { IWorkbenchEditorConfiguration, ActiveEditorMoveArguments, ActiveEditorMovePositioning, ActiveEditorMovePositioningBy, EditorCommands } from 'vs/workbench/common/editor';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IEditor, Position, POSITIONS } from 'vs/platform/editor/common/editor';
import { EditorContextKeys } from 'vs/editor/common/editorCommon';
import { TextCompareEditorVisible, TextDiffEditor } from 'vs/workbench/browser/parts/editor/textDiffEditor';
import { EditorStacksModel } from 'vs/workbench/common/editor/editorStacksModel';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IMessageService, Severity, CloseAction } from 'vs/platform/message/common/message';
import { Action } from 'vs/base/common/actions';
export function setup() {
registerActiveEditorMoveCommand();
@@ -191,7 +191,6 @@ function registerDiffEditorCommands(): void {
});
}
// TODO@Ben remove eventually
function handleCommandDeprecations(): void {
const mapDeprecatedCommands = {
'workbench.action.focusFirstEditor': 'workbench.action.focusFirstEditorGroup',

View File

@@ -7,38 +7,38 @@
import 'vs/css!./media/editorpart';
import 'vs/workbench/browser/parts/editor/editor.contribution';
import {TPromise} from 'vs/base/common/winjs.base';
import {Registry} from 'vs/platform/platform';
import { TPromise } from 'vs/base/common/winjs.base';
import { Registry } from 'vs/platform/platform';
import timer = require('vs/base/common/timer');
import {Dimension, Builder, $} from 'vs/base/browser/builder';
import { Dimension, Builder, $ } from 'vs/base/browser/builder';
import nls = require('vs/nls');
import strings = require('vs/base/common/strings');
import arrays = require('vs/base/common/arrays');
import types = require('vs/base/common/types');
import errors = require('vs/base/common/errors');
import {toErrorMessage} from 'vs/base/common/errorMessage';
import {Scope as MementoScope} from 'vs/workbench/common/memento';
import {Part} from 'vs/workbench/browser/part';
import {BaseEditor, EditorDescriptor} from 'vs/workbench/browser/parts/editor/baseEditor';
import {IEditorRegistry, Extensions as EditorExtensions, EditorInput, EditorOptions, ConfirmResult, EditorInputEvent, IWorkbenchEditorConfiguration, IEditorDescriptor, TextEditorOptions} from 'vs/workbench/common/editor';
import {SideBySideEditorControl, Rochade, ISideBySideEditorControl, ProgressState} from 'vs/workbench/browser/parts/editor/sideBySideEditorControl';
import {WorkbenchProgressService} from 'vs/workbench/services/progress/browser/progressService';
import {GroupArrangement} from 'vs/workbench/services/group/common/groupService';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IEditorPart} from 'vs/workbench/services/editor/browser/editorService';
import {IPartService} from 'vs/workbench/services/part/common/partService';
import {Position, POSITIONS, Direction} from 'vs/platform/editor/common/editor';
import {IStorageService} from 'vs/platform/storage/common/storage';
import {DiffEditorInput} from 'vs/workbench/common/editor/diffEditorInput';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {ServiceCollection} from 'vs/platform/instantiation/common/serviceCollection';
import {IMessageService, IMessageWithAction, Severity} from 'vs/platform/message/common/message';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IEditorGroupService} from 'vs/workbench/services/group/common/groupService';
import {IProgressService} from 'vs/platform/progress/common/progress';
import {BaseTextEditor} from 'vs/workbench/browser/parts/editor/textEditor';
import {EditorStacksModel, EditorGroup, EditorIdentifier} from 'vs/workbench/common/editor/editorStacksModel';
import Event, {Emitter} from 'vs/base/common/event';
import { toErrorMessage } from 'vs/base/common/errorMessage';
import { Scope as MementoScope } from 'vs/workbench/common/memento';
import { Part } from 'vs/workbench/browser/part';
import { BaseEditor, EditorDescriptor } from 'vs/workbench/browser/parts/editor/baseEditor';
import { IEditorRegistry, Extensions as EditorExtensions, EditorInput, EditorOptions, ConfirmResult, EditorInputEvent, IWorkbenchEditorConfiguration, IEditorDescriptor, TextEditorOptions } from 'vs/workbench/common/editor';
import { SideBySideEditorControl, Rochade, ISideBySideEditorControl, ProgressState } from 'vs/workbench/browser/parts/editor/sideBySideEditorControl';
import { WorkbenchProgressService } from 'vs/workbench/services/progress/browser/progressService';
import { GroupArrangement } from 'vs/workbench/services/group/common/groupService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IEditorPart } from 'vs/workbench/services/editor/browser/editorService';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { Position, POSITIONS, Direction } from 'vs/platform/editor/common/editor';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { IMessageService, IMessageWithAction, Severity } from 'vs/platform/message/common/message';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { IProgressService } from 'vs/platform/progress/common/progress';
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
import { EditorStacksModel, EditorGroup, EditorIdentifier } from 'vs/workbench/common/editor/editorStacksModel';
import Event, { Emitter } from 'vs/base/common/event';
class ProgressMonitor {
@@ -678,7 +678,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
editors.push(editor.modifiedInput);
}
return editors.reduce((prev, e) => prev += this.stacks.count(editor), 0);
return editors.reduce((prev, e) => prev += this.stacks.count(e), 0);
}
public getStacksModel(): EditorStacksModel {

View File

@@ -5,26 +5,26 @@
'use strict';
import 'vs/css!./media/editorpicker';
import {TPromise} from 'vs/base/common/winjs.base';
import { TPromise } from 'vs/base/common/winjs.base';
import nls = require('vs/nls');
import labels = require('vs/base/common/labels');
import URI from 'vs/base/common/uri';
import errors = require('vs/base/common/errors');
import strings = require('vs/base/common/strings');
import {IIconLabelOptions} from 'vs/base/browser/ui/iconLabel/iconLabel';
import {IAutoFocus, Mode, IEntryRunContext, IQuickNavigateConfiguration} from 'vs/base/parts/quickopen/common/quickOpen';
import {QuickOpenModel, QuickOpenEntry, QuickOpenEntryGroup} from 'vs/base/parts/quickopen/browser/quickOpenModel';
import { IIconLabelOptions } from 'vs/base/browser/ui/iconLabel/iconLabel';
import { IAutoFocus, Mode, IEntryRunContext, IQuickNavigateConfiguration } from 'vs/base/parts/quickopen/common/quickOpen';
import { QuickOpenModel, QuickOpenEntry, QuickOpenEntryGroup } from 'vs/base/parts/quickopen/browser/quickOpenModel';
import scorer = require('vs/base/common/scorer');
import {IModeService} from 'vs/editor/common/services/modeService';
import {getIconClasses} from 'vs/workbench/browser/labels';
import {IModelService} from 'vs/editor/common/services/modelService';
import {QuickOpenHandler} from 'vs/workbench/browser/quickopen';
import {Position} from 'vs/platform/editor/common/editor';
import {IEditorGroupService} from 'vs/workbench/services/group/common/groupService';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {EditorInput, asFileEditorInput, IEditorGroup, IEditorStacksModel} from 'vs/workbench/common/editor';
import { IModeService } from 'vs/editor/common/services/modeService';
import { getIconClasses } from 'vs/workbench/browser/labels';
import { IModelService } from 'vs/editor/common/services/modelService';
import { QuickOpenHandler } from 'vs/workbench/browser/quickopen';
import { Position } from 'vs/platform/editor/common/editor';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { EditorInput, asFileEditorInput, IEditorGroup, IEditorStacksModel } from 'vs/workbench/common/editor';
export class EditorPickerEntry extends QuickOpenEntryGroup {
private stacks: IEditorStacksModel;
@@ -120,8 +120,8 @@ export abstract class BaseEditorPicker extends QuickOpenHandler {
return true;
}
let resource = e.getResource();
let targetToMatch = resource ? labels.getPathLabel(e.getResource(), this.contextService) : e.getLabel();
const resource = e.getResource();
const targetToMatch = resource ? labels.getPathLabel(e.getResource(), this.contextService) : e.getLabel();
if (!scorer.matches(targetToMatch, normalizedSearchValueLowercase)) {
return false;
}

View File

@@ -7,45 +7,44 @@
import 'vs/css!./media/editorstatus';
import nls = require('vs/nls');
import {TPromise} from 'vs/base/common/winjs.base';
import {$, append, runAtThisOrScheduleAtNextAnimationFrame} from 'vs/base/browser/dom';
import { TPromise } from 'vs/base/common/winjs.base';
import { $, append, runAtThisOrScheduleAtNextAnimationFrame } from 'vs/base/browser/dom';
import strings = require('vs/base/common/strings');
import paths = require('vs/base/common/paths');
import types = require('vs/base/common/types');
import uri from 'vs/base/common/uri';
import errors = require('vs/base/common/errors');
import {IStatusbarItem} from 'vs/workbench/browser/parts/statusbar/statusbar';
import {Action} from 'vs/base/common/actions';
import {language, LANGUAGE_DEFAULT} from 'vs/base/common/platform';
import {IMode} from 'vs/editor/common/modes';
import {UntitledEditorInput} from 'vs/workbench/common/editor/untitledEditorInput';
import {IFileEditorInput, EncodingMode, IEncodingSupport, asFileEditorInput, getUntitledOrFileResource} from 'vs/workbench/common/editor';
import {IDisposable, combinedDisposable, dispose} from 'vs/base/common/lifecycle';
import {IMessageService, Severity} from 'vs/platform/message/common/message';
import {IUntitledEditorService} from 'vs/workbench/services/untitled/common/untitledEditorService';
import {IConfigurationEditingService, ConfigurationTarget} from 'vs/workbench/services/configuration/common/configurationEditing';
import {IEditorAction, ICommonCodeEditor, IModelContentChangedEvent, IModelOptionsChangedEvent, IModelModeChangedEvent, ICursorPositionChangedEvent} from 'vs/editor/common/editorCommon';
import {ICodeEditor, IDiffEditor} from 'vs/editor/browser/editorBrowser';
import {TrimTrailingWhitespaceAction} from 'vs/editor/contrib/linesOperations/common/linesOperations';
import {EndOfLineSequence, EditorType, IModel, IDiffEditorModel, IEditor} from 'vs/editor/common/editorCommon';
import {IndentUsingSpaces, IndentUsingTabs, DetectIndentation, IndentationToSpacesAction, IndentationToTabsAction} from 'vs/editor/contrib/indentation/common/indentation';
import {BaseTextEditor} from 'vs/workbench/browser/parts/editor/textEditor';
import {BaseBinaryResourceEditor} from 'vs/workbench/browser/parts/editor/binaryEditor';
import {BinaryResourceDiffEditor} from 'vs/workbench/browser/parts/editor/binaryDiffEditor';
import {IEditor as IBaseEditor} from 'vs/platform/editor/common/editor';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {IQuickOpenService, IPickOpenEntry, IFilePickOpenEntry} from 'vs/workbench/services/quickopen/common/quickOpenService';
import {IWorkspaceConfigurationService} from 'vs/workbench/services/configuration/common/configuration';
import {IFilesConfiguration, SUPPORTED_ENCODINGS} from 'vs/platform/files/common/files';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IModeService} from 'vs/editor/common/services/modeService';
import {IModelService} from 'vs/editor/common/services/modelService';
import {StyleMutator} from 'vs/base/browser/styleMutator';
import {Selection} from 'vs/editor/common/core/selection';
import {IEditorGroupService} from 'vs/workbench/services/group/common/groupService';
import {TabFocus} from 'vs/editor/common/config/commonEditorConfig';
import {ITextFileService} from 'vs/workbench/parts/files/common/files'; // TODO@Ben layer breaker
import { IStatusbarItem } from 'vs/workbench/browser/parts/statusbar/statusbar';
import { Action } from 'vs/base/common/actions';
import { language, LANGUAGE_DEFAULT } from 'vs/base/common/platform';
import { IMode } from 'vs/editor/common/modes';
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
import { IFileEditorInput, EncodingMode, IEncodingSupport, asFileEditorInput, getUntitledOrFileResource } from 'vs/workbench/common/editor';
import { IDisposable, combinedDisposable, dispose } from 'vs/base/common/lifecycle';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { IConfigurationEditingService, ConfigurationTarget } from 'vs/workbench/services/configuration/common/configurationEditing';
import { IEditorAction, ICommonCodeEditor, IModelContentChangedEvent, IModelOptionsChangedEvent, IModelModeChangedEvent, ICursorPositionChangedEvent } from 'vs/editor/common/editorCommon';
import { ICodeEditor, IDiffEditor } from 'vs/editor/browser/editorBrowser';
import { TrimTrailingWhitespaceAction } from 'vs/editor/contrib/linesOperations/common/linesOperations';
import { EndOfLineSequence, EditorType, IModel, IDiffEditorModel, IEditor } from 'vs/editor/common/editorCommon';
import { IndentUsingSpaces, IndentUsingTabs, DetectIndentation, IndentationToSpacesAction, IndentationToTabsAction } from 'vs/editor/contrib/indentation/common/indentation';
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
import { BaseBinaryResourceEditor } from 'vs/workbench/browser/parts/editor/binaryEditor';
import { BinaryResourceDiffEditor } from 'vs/workbench/browser/parts/editor/binaryDiffEditor';
import { IEditor as IBaseEditor } from 'vs/platform/editor/common/editor';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IQuickOpenService, IPickOpenEntry, IFilePickOpenEntry } from 'vs/workbench/services/quickopen/common/quickOpenService';
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
import { IFilesConfiguration, SUPPORTED_ENCODINGS } from 'vs/platform/files/common/files';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IModeService } from 'vs/editor/common/services/modeService';
import { IModelService } from 'vs/editor/common/services/modelService';
import { StyleMutator } from 'vs/base/browser/styleMutator';
import { Selection } from 'vs/editor/common/core/selection';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { TabFocus } from 'vs/editor/common/config/commonEditorConfig';
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
function getCodeEditor(editorWidget: IEditor): ICommonCodeEditor {
if (editorWidget) {
@@ -760,6 +759,14 @@ export class ChangeModeAction extends Action {
return this.quickOpenService.pick(picks, { placeHolder: nls.localize('pickLanguage', "Select Language Mode") }).then(language => {
if (language) {
// User decided to permanently configure associations, return right after
if (language === configureModeAssociations) {
this.configureFileAssociation(fileinput.getResource());
return;
}
// Change mode for active editor
activeEditor = this.editorService.getActiveEditor();
if (activeEditor instanceof BaseTextEditor) {
const editorWidget = activeEditor.getControl();
@@ -780,8 +787,6 @@ export class ChangeModeAction extends Action {
let mode: TPromise<IMode>;
if (language === autoDetectMode) {
mode = this.modeService.getOrCreateModeByFilenameOrFirstLine(getUntitledOrFileResource(activeEditor.input, true).fsPath, textModel.getLineContent(1));
} else if (language === configureModeAssociations) {
this.configureFileAssociation(fileinput.getResource());
} else {
mode = this.modeService.getOrCreateModeByLanguageName(language.label);
}

View File

@@ -7,10 +7,10 @@
import 'vs/css!./media/notabstitle';
import errors = require('vs/base/common/errors');
import {IEditorGroup, getResource} from 'vs/workbench/common/editor';
import { IEditorGroup, getResource } from 'vs/workbench/common/editor';
import DOM = require('vs/base/browser/dom');
import {TitleControl} from 'vs/workbench/browser/parts/editor/titleControl';
import {EditorLabel} from 'vs/workbench/browser/labels';
import { TitleControl } from 'vs/workbench/browser/parts/editor/titleControl';
import { EditorLabel } from 'vs/workbench/browser/labels';
export class NoTabsTitleControl extends TitleControl {
private titleContainer: HTMLElement;

View File

@@ -7,35 +7,35 @@
import 'vs/css!./media/sidebyside';
import arrays = require('vs/base/common/arrays');
import Event, {Emitter} from 'vs/base/common/event';
import {StandardMouseEvent} from 'vs/base/browser/mouseEvent';
import Event, { Emitter } from 'vs/base/common/event';
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import types = require('vs/base/common/types');
import {Dimension, Builder, $} from 'vs/base/browser/builder';
import {Sash, ISashEvent, IVerticalSashLayoutProvider} from 'vs/base/browser/ui/sash/sash';
import {ProgressBar} from 'vs/base/browser/ui/progressbar/progressbar';
import {BaseEditor} from 'vs/workbench/browser/parts/editor/baseEditor';
import { Dimension, Builder, $ } from 'vs/base/browser/builder';
import { Sash, ISashEvent, IVerticalSashLayoutProvider } from 'vs/base/browser/ui/sash/sash';
import { ProgressBar } from 'vs/base/browser/ui/progressbar/progressbar';
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
import DOM = require('vs/base/browser/dom');
import URI from 'vs/base/common/uri';
import errors = require('vs/base/common/errors');
import {RunOnceScheduler} from 'vs/base/common/async';
import {isMacintosh} from 'vs/base/common/platform';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {Position, POSITIONS} from 'vs/platform/editor/common/editor';
import {IEditorGroupService, GroupArrangement} from 'vs/workbench/services/group/common/groupService';
import {BaseTextEditor} from 'vs/workbench/browser/parts/editor/textEditor';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {ServiceCollection} from 'vs/platform/instantiation/common/serviceCollection';
import {IContextKeyService} from 'vs/platform/contextkey/common/contextkey';
import {IExtensionService} from 'vs/platform/extensions/common/extensions';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import {TabsTitleControl} from 'vs/workbench/browser/parts/editor/tabsTitleControl';
import {TitleControl} from 'vs/workbench/browser/parts/editor/titleControl';
import {NoTabsTitleControl} from 'vs/workbench/browser/parts/editor/noTabsTitleControl';
import {IEditorStacksModel, IStacksModelChangeEvent, IWorkbenchEditorConfiguration, IEditorGroup, EditorOptions, TextEditorOptions, IEditorIdentifier} from 'vs/workbench/common/editor';
import {ITitleAreaControl} from 'vs/workbench/browser/parts/editor/titleControl';
import {extractResources} from 'vs/base/browser/dnd';
import { RunOnceScheduler } from 'vs/base/common/async';
import { isMacintosh } from 'vs/base/common/platform';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { Position, POSITIONS } from 'vs/platform/editor/common/editor';
import { IEditorGroupService, GroupArrangement } from 'vs/workbench/services/group/common/groupService';
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { TabsTitleControl } from 'vs/workbench/browser/parts/editor/tabsTitleControl';
import { TitleControl } from 'vs/workbench/browser/parts/editor/titleControl';
import { NoTabsTitleControl } from 'vs/workbench/browser/parts/editor/noTabsTitleControl';
import { IEditorStacksModel, IStacksModelChangeEvent, IWorkbenchEditorConfiguration, IEditorGroup, EditorOptions, TextEditorOptions, IEditorIdentifier } from 'vs/workbench/common/editor';
import { ITitleAreaControl } from 'vs/workbench/browser/parts/editor/titleControl';
import { extractResources } from 'vs/base/browser/dnd';
export enum Rochade {
NONE,
@@ -223,8 +223,9 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
POSITIONS.forEach(position => {
const titleAreaControl = this.getTitleAreaControl(position);
const context = this.stacks.groupAt(position);
const hasContext = titleAreaControl.hasContext();
titleAreaControl.setContext(context);
if (!context && titleAreaControl.hasContext()) {
if (!context && hasContext) {
titleAreaControl.refresh(); // clear out the control if the context is no longer present and there was a context
}
});
@@ -787,7 +788,7 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
if (showTabs) {
titleContainer.addClass('tabs');
}
if (showIcons)  {
if (showIcons) {
titleContainer.addClass('show-file-icons');
}
this.hookTitleDragListener(titleContainer);

View File

@@ -4,26 +4,26 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import { TPromise } from 'vs/base/common/winjs.base';
import nls = require('vs/nls');
import types = require('vs/base/common/types');
import {ICodeEditor} from 'vs/editor/browser/editorBrowser';
import {IEditorOptions, IEditorViewState} from 'vs/editor/common/editorCommon';
import {TextEditorOptions, EditorModel, EditorInput, EditorOptions} from 'vs/workbench/common/editor';
import {BaseTextEditorModel} from 'vs/workbench/common/editor/textEditorModel';
import {UntitledEditorInput} from 'vs/workbench/common/editor/untitledEditorInput';
import {BaseTextEditor} from 'vs/workbench/browser/parts/editor/textEditor';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { IEditorOptions, IEditorViewState } from 'vs/editor/common/editorCommon';
import { TextEditorOptions, EditorModel, EditorInput, EditorOptions } from 'vs/workbench/common/editor';
import { BaseTextEditorModel } from 'vs/workbench/common/editor/textEditorModel';
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
import URI from 'vs/base/common/uri';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {IStorageService} from 'vs/platform/storage/common/storage';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IEventService} from 'vs/platform/event/common/event';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IMessageService} from 'vs/platform/message/common/message';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {IThemeService} from 'vs/workbench/services/themes/common/themeService';
import {IUntitledEditorService} from 'vs/workbench/services/untitled/common/untitledEditorService';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IEventService } from 'vs/platform/event/common/event';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IMessageService } from 'vs/platform/message/common/message';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IThemeService } from 'vs/workbench/services/themes/common/themeService';
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
/**
* An editor implementation that is capable of showing string inputs or promise inputs that resolve to a string.
@@ -69,17 +69,17 @@ export class StringEditor extends BaseTextEditor {
}
public setInput(input: EditorInput, options: EditorOptions): TPromise<void> {
let oldInput = this.getInput();
const oldInput = this.getInput();
super.setInput(input, options);
// Detect options
let forceOpen = options && options.forceOpen;
const forceOpen = options && options.forceOpen;
// Same Input
if (!forceOpen && input.matches(oldInput)) {
// TextOptions (avoiding instanceof here for a reason, do not change!)
let textOptions = <TextEditorOptions>options;
const textOptions = <TextEditorOptions>options;
if (textOptions && types.isFunction(textOptions.apply)) {
textOptions.apply(this.getControl());
}
@@ -106,20 +106,20 @@ export class StringEditor extends BaseTextEditor {
}
// Set Editor Model
let textEditor = this.getControl();
let textEditorModel = (<BaseTextEditorModel>resolvedModel).textEditorModel;
const textEditor = this.getControl();
const textEditorModel = (<BaseTextEditorModel>resolvedModel).textEditorModel;
textEditor.setModel(textEditorModel);
// Apply Options from TextOptions
let optionsGotApplied = false;
let textOptions = <TextEditorOptions>options;
const textOptions = <TextEditorOptions>options;
if (textOptions && types.isFunction(textOptions.apply)) {
optionsGotApplied = textOptions.apply(textEditor);
}
// Otherwise restore View State
if (!optionsGotApplied && input instanceof UntitledEditorInput) {
let viewState = this.mapResourceToEditorViewState[input.getResource().toString()];
const viewState = this.mapResourceToEditorViewState[input.getResource().toString()];
if (viewState) {
textEditor.restoreViewState(viewState);
}
@@ -131,16 +131,16 @@ export class StringEditor extends BaseTextEditor {
}
protected getCodeEditorOptions(): IEditorOptions {
let options = super.getCodeEditorOptions();
const options = super.getCodeEditorOptions();
let input = this.getInput();
let isUntitled = input instanceof UntitledEditorInput;
let isReadonly = !isUntitled; // all string editors are readonly except for the untitled one
const input = this.getInput();
const isUntitled = input instanceof UntitledEditorInput;
const isReadonly = !isUntitled; // all string editors are readonly except for the untitled one
options.readOnly = isReadonly;
let ariaLabel: string;
let inputName = input && input.getName();
const inputName = input && input.getName();
if (isReadonly) {
ariaLabel = inputName ? nls.localize('readonlyEditorWithInputAriaLabel', "{0}. Readonly text editor.", inputName) : nls.localize('readonlyEditorAriaLabel', "Readonly text editor.");
} else {
@@ -157,12 +157,12 @@ export class StringEditor extends BaseTextEditor {
* If smart reveal is true will only reveal the last line if the line before last is visible #3351
*/
public revealLastLine(smartReveal = false): void {
let codeEditor = <ICodeEditor>this.getControl();
let model = codeEditor.getModel();
const codeEditor = <ICodeEditor>this.getControl();
const model = codeEditor.getModel();
const lineBeforeLastRevealed = codeEditor.getScrollTop() + codeEditor.getLayoutInfo().height >= codeEditor.getScrollHeight();
if (model && (!smartReveal || lineBeforeLastRevealed)) {
let lastLine = model.getLineCount();
const lastLine = model.getLineCount();
codeEditor.revealLine(lastLine);
}
}

View File

@@ -9,32 +9,32 @@ import 'vs/css!./media/tabstitle';
import nls = require('vs/nls');
import errors = require('vs/base/common/errors');
import DOM = require('vs/base/browser/dom');
import {isMacintosh} from 'vs/base/common/platform';
import {MIME_BINARY} from 'vs/base/common/mime';
import {Position, IEditorInput} from 'vs/platform/editor/common/editor';
import {IEditorGroup, IEditorIdentifier, asFileEditorInput, getResource} from 'vs/workbench/common/editor';
import {StandardKeyboardEvent} from 'vs/base/browser/keyboardEvent';
import {KeyCode} from 'vs/base/common/keyCodes';
import {EditorLabel} from 'vs/workbench/browser/labels';
import {ActionBar} from 'vs/base/browser/ui/actionbar/actionbar';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
import {IEditorGroupService} from 'vs/workbench/services/group/common/groupService';
import {IUntitledEditorService} from 'vs/workbench/services/untitled/common/untitledEditorService';
import {IMessageService} from 'vs/platform/message/common/message';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IContextKeyService} from 'vs/platform/contextkey/common/contextkey';
import {IMenuService} from 'vs/platform/actions/common/actions';
import {TitleControl} from 'vs/workbench/browser/parts/editor/titleControl';
import {IQuickOpenService} from 'vs/workbench/services/quickopen/common/quickOpenService';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import {ScrollableElement} from 'vs/base/browser/ui/scrollbar/scrollableElement';
import {ScrollbarVisibility} from 'vs/base/common/scrollable';
import {extractResources} from 'vs/base/browser/dnd';
import {LinkedMap} from 'vs/base/common/map';
import { isMacintosh } from 'vs/base/common/platform';
import { MIME_BINARY } from 'vs/base/common/mime';
import { Position, IEditorInput } from 'vs/platform/editor/common/editor';
import { IEditorGroup, IEditorIdentifier, asFileEditorInput, getResource } from 'vs/workbench/common/editor';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeyCode } from 'vs/base/common/keyCodes';
import { EditorLabel } from 'vs/workbench/browser/labels';
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { IMessageService } from 'vs/platform/message/common/message';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IMenuService } from 'vs/platform/actions/common/actions';
import { TitleControl } from 'vs/workbench/browser/parts/editor/titleControl';
import { IQuickOpenService } from 'vs/workbench/services/quickopen/common/quickOpenService';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { ScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
import { extractResources } from 'vs/base/browser/dnd';
import { LinkedMap } from 'vs/base/common/map';
import paths = require('vs/base/common/paths');
interface IEditorInputLabel {

View File

@@ -6,36 +6,36 @@
'use strict';
import 'vs/css!./media/textdiffeditor';
import {TPromise} from 'vs/base/common/winjs.base';
import { TPromise } from 'vs/base/common/winjs.base';
import nls = require('vs/nls');
import {Builder} from 'vs/base/browser/builder';
import {Action, IAction} from 'vs/base/common/actions';
import {onUnexpectedError} from 'vs/base/common/errors';
import { Builder } from 'vs/base/browser/builder';
import { Action, IAction } from 'vs/base/common/actions';
import { onUnexpectedError } from 'vs/base/common/errors';
import types = require('vs/base/common/types');
import {Position} from 'vs/platform/editor/common/editor';
import {IDiffEditor} from 'vs/editor/browser/editorBrowser';
import {IDiffEditorOptions, IEditorOptions} from 'vs/editor/common/editorCommon';
import {BaseTextEditor} from 'vs/workbench/browser/parts/editor/textEditor';
import {TextEditorOptions, TextDiffEditorOptions, EditorModel, EditorInput, EditorOptions} from 'vs/workbench/common/editor';
import {StringEditorInput} from 'vs/workbench/common/editor/stringEditorInput';
import {ResourceEditorInput} from 'vs/workbench/common/editor/resourceEditorInput';
import {DiffEditorInput} from 'vs/workbench/common/editor/diffEditorInput';
import {DiffNavigator} from 'vs/editor/contrib/diffNavigator/common/diffNavigator';
import {DiffEditorWidget} from 'vs/editor/browser/widget/diffEditorWidget';
import {TextDiffEditorModel} from 'vs/workbench/common/editor/textDiffEditorModel';
import {DelegatingWorkbenchEditorService} from 'vs/workbench/services/editor/browser/editorService';
import {IFileOperationResult, FileOperationResult} from 'vs/platform/files/common/files';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {IStorageService} from 'vs/platform/storage/common/storage';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IEventService} from 'vs/platform/event/common/event';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {ServiceCollection} from 'vs/platform/instantiation/common/serviceCollection';
import {IMessageService} from 'vs/platform/message/common/message';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {RawContextKey, IContextKeyService, IContextKey} from 'vs/platform/contextkey/common/contextkey';
import {IThemeService} from 'vs/workbench/services/themes/common/themeService';
import { Position } from 'vs/platform/editor/common/editor';
import { IDiffEditor } from 'vs/editor/browser/editorBrowser';
import { IDiffEditorOptions, IEditorOptions } from 'vs/editor/common/editorCommon';
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
import { TextEditorOptions, TextDiffEditorOptions, EditorModel, EditorInput, EditorOptions, TEXT_DIFF_EDITOR_ID } from 'vs/workbench/common/editor';
import { StringEditorInput } from 'vs/workbench/common/editor/stringEditorInput';
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
import { DiffNavigator } from 'vs/editor/contrib/diffNavigator/common/diffNavigator';
import { DiffEditorWidget } from 'vs/editor/browser/widget/diffEditorWidget';
import { TextDiffEditorModel } from 'vs/workbench/common/editor/textDiffEditorModel';
import { DelegatingWorkbenchEditorService } from 'vs/workbench/services/editor/browser/editorService';
import { IFileOperationResult, FileOperationResult } from 'vs/platform/files/common/files';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IEventService } from 'vs/platform/event/common/event';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { IMessageService } from 'vs/platform/message/common/message';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { RawContextKey, IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { IThemeService } from 'vs/workbench/services/themes/common/themeService';
export const TextCompareEditorVisible = new RawContextKey<boolean>('textCompareEditorVisible', false);
@@ -44,7 +44,7 @@ export const TextCompareEditorVisible = new RawContextKey<boolean>('textCompareE
*/
export class TextDiffEditor extends BaseTextEditor {
public static ID = 'workbench.editors.textDiffEditor';
public static ID = TEXT_DIFF_EDITOR_ID;
private diffNavigator: DiffNavigator;
private nextDiffAction: NavigateAction;
@@ -84,11 +84,11 @@ export class TextDiffEditor extends BaseTextEditor {
this.previousDiffAction = new NavigateAction(this, false);
// Support navigation within the diff editor by overriding the editor service within
let delegatingEditorService = this.instantiationService.createInstance(DelegatingWorkbenchEditorService, (input: EditorInput, options?: EditorOptions, arg3?: any) => {
const delegatingEditorService = this.instantiationService.createInstance(DelegatingWorkbenchEditorService, (input: EditorInput, options?: EditorOptions, arg3?: any) => {
// Check if arg4 is a position argument that differs from this editors position
if (types.isUndefinedOrNull(arg3) || arg3 === false || arg3 === this.position) {
let activeDiffInput = <DiffEditorInput>this.getInput();
const activeDiffInput = <DiffEditorInput>this.getInput();
if (input && options && activeDiffInput) {
// Input matches modified side of the diff editor: perform the action on modified side
@@ -98,7 +98,7 @@ export class TextDiffEditor extends BaseTextEditor {
// Input matches original side of the diff editor: perform the action on original side
else if (input.matches(activeDiffInput.originalInput)) {
let originalEditor = this.getControl().getOriginalEditor();
const originalEditor = this.getControl().getOriginalEditor();
if (options instanceof TextEditorOptions) {
(<TextEditorOptions>options).apply(originalEditor);
@@ -112,23 +112,23 @@ export class TextDiffEditor extends BaseTextEditor {
});
// Create a special child of instantiator that will delegate all calls to openEditor() to the same diff editor if the input matches with the modified one
let diffEditorInstantiator = this.instantiationService.createChild(new ServiceCollection([IWorkbenchEditorService, delegatingEditorService]));
const diffEditorInstantiator = this.instantiationService.createChild(new ServiceCollection([IWorkbenchEditorService, delegatingEditorService]));
return diffEditorInstantiator.createInstance(DiffEditorWidget, parent.getHTMLElement(), this.getCodeEditorOptions());
}
public setInput(input: EditorInput, options: EditorOptions): TPromise<void> {
let oldInput = this.getInput();
const oldInput = this.getInput();
super.setInput(input, options);
// Detect options
let forceOpen = options && options.forceOpen;
const forceOpen = options && options.forceOpen;
// Same Input
if (!forceOpen && input.matches(oldInput)) {
// TextOptions (avoiding instanceof here for a reason, do not change!)
let textOptions = <TextEditorOptions>options;
const textOptions = <TextEditorOptions>options;
if (textOptions && types.isFunction(textOptions.apply)) {
textOptions.apply(<IDiffEditor>this.getControl());
}
@@ -155,13 +155,13 @@ export class TextDiffEditor extends BaseTextEditor {
}
// Editor
let diffEditor = <IDiffEditor>this.getControl();
const diffEditor = <IDiffEditor>this.getControl();
diffEditor.setModel((<TextDiffEditorModel>resolvedModel).textDiffEditorModel);
// Respect text diff editor options
let autoRevealFirstChange = true;
if (options instanceof TextDiffEditorOptions) {
let textDiffOptions = (<TextDiffEditorOptions>options);
const textDiffOptions = (<TextDiffEditorOptions>options);
autoRevealFirstChange = !types.isUndefinedOrNull(textDiffOptions.autoRevealFirstChange) ? textDiffOptions.autoRevealFirstChange : autoRevealFirstChange;
}
@@ -195,10 +195,10 @@ export class TextDiffEditor extends BaseTextEditor {
private openAsBinary(input: EditorInput, options: EditorOptions): boolean {
if (input instanceof DiffEditorInput) {
let originalInput = input.originalInput;
let modifiedInput = input.modifiedInput;
const originalInput = input.originalInput;
const modifiedInput = input.modifiedInput;
let binaryDiffInput = new DiffEditorInput(input.getName(), input.getDescription(), originalInput, modifiedInput, true);
const binaryDiffInput = new DiffEditorInput(input.getName(), input.getDescription(), originalInput, modifiedInput, true);
this.editorService.openEditor(binaryDiffInput, options, this.position).done(null, onUnexpectedError);
@@ -209,17 +209,17 @@ export class TextDiffEditor extends BaseTextEditor {
}
protected getCodeEditorOptions(): IEditorOptions {
let options: IDiffEditorOptions = super.getCodeEditorOptions();
const options: IDiffEditorOptions = super.getCodeEditorOptions();
let input = this.input;
const input = this.input;
if (input instanceof DiffEditorInput) {
let modifiedInput = input.modifiedInput;
let readOnly = modifiedInput instanceof StringEditorInput || modifiedInput instanceof ResourceEditorInput;
const modifiedInput = input.modifiedInput;
const readOnly = modifiedInput instanceof StringEditorInput || modifiedInput instanceof ResourceEditorInput;
options.readOnly = readOnly;
let ariaLabel: string;
let inputName = input && input.getName();
const inputName = input && input.getName();
if (readOnly) {
ariaLabel = inputName ? nls.localize('readonlyEditorWithInputAriaLabel', "{0}. Readonly text compare editor.", inputName) : nls.localize('readonlyEditorAriaLabel', "Readonly text compare editor.");
} else {
@@ -236,7 +236,7 @@ export class TextDiffEditor extends BaseTextEditor {
private isFileBinaryError(error: Error): boolean;
private isFileBinaryError(error: any): boolean {
if (types.isArray(error)) {
let errors = <Error[]>error;
const errors = <Error[]>error;
return errors.some((e) => this.isFileBinaryError(e));
}
@@ -275,16 +275,16 @@ export class TextDiffEditor extends BaseTextEditor {
}
public getSecondaryActions(): IAction[] {
let actions = super.getSecondaryActions();
const actions = super.getSecondaryActions();
const control = this.getControl();
let inlineModeActive = control && !control.renderSideBySide;
let inlineLabel = nls.localize('inlineDiffLabel', "Switch to Inline View");
let sideBySideLabel = nls.localize('sideBySideDiffLabel', "Switch to Side by Side View");
const inlineLabel = nls.localize('inlineDiffLabel', "Switch to Inline View");
const sideBySideLabel = nls.localize('sideBySideDiffLabel', "Switch to Side by Side View");
// Action to toggle editor mode from inline to side by side
let toggleEditorModeAction = new Action('toggle.diff.editorMode', inlineModeActive ? sideBySideLabel : inlineLabel, null, true, () => {
const toggleEditorModeAction = new Action('toggle.diff.editorMode', inlineModeActive ? sideBySideLabel : inlineLabel, null, true, () => {
this.getControl().updateOptions(<IDiffEditorOptions>{
renderSideBySide: inlineModeActive
});

View File

@@ -5,26 +5,26 @@
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import {Dimension, Builder} from 'vs/base/browser/builder';
import { TPromise } from 'vs/base/common/winjs.base';
import { Dimension, Builder } from 'vs/base/browser/builder';
import objects = require('vs/base/common/objects');
import {CodeEditor} from 'vs/editor/browser/codeEditor';
import {EditorInput, EditorOptions} from 'vs/workbench/common/editor';
import {BaseEditor} from 'vs/workbench/browser/parts/editor/baseEditor';
import {EditorConfiguration} from 'vs/editor/common/config/commonEditorConfig';
import {IEditor, IEditorOptions} from 'vs/editor/common/editorCommon';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {IFilesConfiguration} from 'vs/platform/files/common/files';
import {Position} from 'vs/platform/editor/common/editor';
import {IStorageService} from 'vs/platform/storage/common/storage';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IEventService} from 'vs/platform/event/common/event';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IMessageService} from 'vs/platform/message/common/message';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {IThemeService} from 'vs/workbench/services/themes/common/themeService';
import {Selection} from 'vs/editor/common/core/selection';
import { CodeEditor } from 'vs/editor/browser/codeEditor';
import { EditorInput, EditorOptions } from 'vs/workbench/common/editor';
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
import { EditorConfiguration } from 'vs/editor/common/config/commonEditorConfig';
import { IEditor, IEditorOptions } from 'vs/editor/common/editorCommon';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IFilesConfiguration } from 'vs/platform/files/common/files';
import { Position } from 'vs/platform/editor/common/editor';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IEventService } from 'vs/platform/event/common/event';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IMessageService } from 'vs/platform/message/common/message';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IThemeService } from 'vs/workbench/services/themes/common/themeService';
import { Selection } from 'vs/editor/common/core/selection';
/**
* The base class of editors that leverage the text editor for the editing experience. This class is only intended to

View File

@@ -7,36 +7,36 @@
import 'vs/css!./media/titlecontrol';
import nls = require('vs/nls');
import {Registry} from 'vs/platform/platform';
import {Scope, IActionBarRegistry, Extensions, prepareActions} from 'vs/workbench/browser/actionBarRegistry';
import {IAction, Action} from 'vs/base/common/actions';
import { Registry } from 'vs/platform/platform';
import { Scope, IActionBarRegistry, Extensions, prepareActions } from 'vs/workbench/browser/actionBarRegistry';
import { IAction, Action } from 'vs/base/common/actions';
import errors = require('vs/base/common/errors');
import DOM = require('vs/base/browser/dom');
import {TPromise} from 'vs/base/common/winjs.base';
import {BaseEditor, IEditorInputActionContext} from 'vs/workbench/browser/parts/editor/baseEditor';
import {RunOnceScheduler} from 'vs/base/common/async';
import {isCommonCodeEditor, isCommonDiffEditor} from 'vs/editor/common/editorCommon';
import { TPromise } from 'vs/base/common/winjs.base';
import { BaseEditor, IEditorInputActionContext } from 'vs/workbench/browser/parts/editor/baseEditor';
import { RunOnceScheduler } from 'vs/base/common/async';
import { isCommonCodeEditor, isCommonDiffEditor } from 'vs/editor/common/editorCommon';
import arrays = require('vs/base/common/arrays');
import {IEditorStacksModel, IEditorGroup, IEditorIdentifier, EditorInput, IWorkbenchEditorConfiguration, IStacksModelChangeEvent, getResource} from 'vs/workbench/common/editor';
import {EventType as BaseEventType} from 'vs/base/common/events';
import {IActionItem, ActionsOrientation, Separator} from 'vs/base/browser/ui/actionbar/actionbar';
import {ToolBar} from 'vs/base/browser/ui/toolbar/toolbar';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IEditorGroupService} from 'vs/workbench/services/group/common/groupService';
import {IMessageService, Severity} from 'vs/platform/message/common/message';
import {StandardMouseEvent} from 'vs/base/browser/mouseEvent';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IQuickOpenService} from 'vs/workbench/services/quickopen/common/quickOpenService';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IContextKeyService} from 'vs/platform/contextkey/common/contextkey';
import {CloseEditorsInGroupAction, SplitEditorAction, CloseEditorAction, KeepEditorAction, CloseOtherEditorsInGroupAction, CloseRightEditorsInGroupAction, ShowEditorsInGroupAction} from 'vs/workbench/browser/parts/editor/editorActions';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import {createActionItem, fillInActions} from 'vs/platform/actions/browser/menuItemActionItem';
import {IMenuService, MenuId} from 'vs/platform/actions/common/actions';
import {ResourceContextKey} from 'vs/platform/actions/common/resourceContextKey';
import { IEditorStacksModel, IEditorGroup, IEditorIdentifier, EditorInput, IWorkbenchEditorConfiguration, IStacksModelChangeEvent, getResource } from 'vs/workbench/common/editor';
import { EventType as BaseEventType } from 'vs/base/common/events';
import { IActionItem, ActionsOrientation, Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IQuickOpenService } from 'vs/workbench/services/quickopen/common/quickOpenService';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { CloseEditorsInGroupAction, SplitEditorAction, CloseEditorAction, KeepEditorAction, CloseOtherEditorsInGroupAction, CloseRightEditorsInGroupAction, ShowEditorsInGroupAction } from 'vs/workbench/browser/parts/editor/editorActions';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { createActionItem, fillInActions } from 'vs/platform/actions/browser/menuItemActionItem';
import { IMenuService, MenuId, IMenu } from 'vs/platform/actions/common/actions';
import { ResourceContextKey } from 'vs/platform/actions/common/resourceContextKey';
export interface IToolbarActions {
primary: IAction[];
@@ -90,6 +90,8 @@ export abstract class TitleControl implements ITitleAreaControl {
private resourceContext: ResourceContextKey;
private disposeOnEditorActions: IDisposable[] = [];
private contextMenu: IMenu;
constructor(
@IContextMenuService protected contextMenuService: IContextMenuService,
@IInstantiationService protected instantiationService: IInstantiationService,
@@ -114,6 +116,9 @@ export abstract class TitleControl implements ITitleAreaControl {
this.resourceContext = instantiationService.createInstance(ResourceContextKey);
this.contextMenu = this.menuService.createMenu(MenuId.EditorTitleContext, this.contextKeyService);
this.toDispose.push(this.contextMenu);
this.initActions();
this.registerListeners();
}
@@ -417,6 +422,12 @@ export abstract class TitleControl implements ITitleAreaControl {
}
protected onContextMenu(identifier: IEditorIdentifier, e: Event, node: HTMLElement): void {
// Update the resource context
const currentContext = this.resourceContext.get();
this.resourceContext.set(identifier.editor && getResource(identifier.editor));
// Find target anchor
let anchor: HTMLElement | { x: number, y: number } = node;
if (e instanceof MouseEvent) {
const event = new StandardMouseEvent(e);
@@ -434,6 +445,9 @@ export abstract class TitleControl implements ITitleAreaControl {
}
return null;
},
onHide: (cancel) => {
this.resourceContext.set(currentContext); // restore previous context
}
});
}
@@ -462,6 +476,9 @@ export abstract class TitleControl implements ITitleAreaControl {
actions.push(new Separator(), this.pinEditorAction);
}
// Fill in contributed actions
fillInActions(this.contextMenu, actions);
return actions;
}

View File

@@ -5,27 +5,27 @@
import 'vs/css!./media/panelpart';
import nls = require('vs/nls');
import {TPromise} from 'vs/base/common/winjs.base';
import {KeyMod, KeyCode} from 'vs/base/common/keyCodes';
import {Action, IAction} from 'vs/base/common/actions';
import { TPromise } from 'vs/base/common/winjs.base';
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
import { Action, IAction } from 'vs/base/common/actions';
import Event from 'vs/base/common/event';
import {Builder} from 'vs/base/browser/builder';
import {Registry} from 'vs/platform/platform';
import {ActivityAction} from 'vs/workbench/browser/parts/activitybar/activityAction';
import {Scope} from 'vs/workbench/browser/actionBarRegistry';
import {SyncActionDescriptor} from 'vs/platform/actions/common/actions';
import {IWorkbenchActionRegistry, Extensions as WorkbenchExtensions} from 'vs/workbench/common/actionRegistry';
import {IPanel} from 'vs/workbench/common/panel';
import {CompositePart} from 'vs/workbench/browser/parts/compositePart';
import {Panel, PanelRegistry, Extensions as PanelExtensions} from 'vs/workbench/browser/panel';
import {IPanelService} from 'vs/workbench/services/panel/common/panelService';
import {IPartService} from 'vs/workbench/services/part/common/partService';
import {IStorageService} from 'vs/platform/storage/common/storage';
import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
import {IMessageService} from 'vs/platform/message/common/message';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import { Builder } from 'vs/base/browser/builder';
import { Registry } from 'vs/platform/platform';
import { ActivityAction } from 'vs/workbench/browser/parts/activitybar/activityAction';
import { Scope } from 'vs/workbench/browser/actionBarRegistry';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { IWorkbenchActionRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/actionRegistry';
import { IPanel } from 'vs/workbench/common/panel';
import { CompositePart } from 'vs/workbench/browser/parts/compositePart';
import { Panel, PanelRegistry, Extensions as PanelExtensions } from 'vs/workbench/browser/panel';
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IMessageService } from 'vs/platform/message/common/message';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
export class PanelPart extends CompositePart<Panel> implements IPanelService {

View File

@@ -7,43 +7,45 @@
import 'vs/css!./media/quickopen';
import 'vs/workbench/browser/parts/quickopen/quickopen.contribution';
import {TPromise, ValueCallback} from 'vs/base/common/winjs.base';
import { TPromise, ValueCallback } from 'vs/base/common/winjs.base';
import nls = require('vs/nls');
import {Dimension, withElementById} from 'vs/base/browser/builder';
import { Dimension, withElementById } from 'vs/base/browser/builder';
import strings = require('vs/base/common/strings');
import filters = require('vs/base/common/filters');
import DOM = require('vs/base/browser/dom');
import URI from 'vs/base/common/uri';
import uuid = require('vs/base/common/uuid');
import types = require('vs/base/common/types');
import {IIconLabelOptions} from 'vs/base/browser/ui/iconLabel/iconLabel';
import {CancellationToken} from 'vs/base/common/cancellation';
import {Mode, IEntryRunContext, IAutoFocus, IQuickNavigateConfiguration, IModel} from 'vs/base/parts/quickopen/common/quickOpen';
import {QuickOpenEntry, QuickOpenModel, QuickOpenEntryGroup} from 'vs/base/parts/quickopen/browser/quickOpenModel';
import {QuickOpenWidget, HideReason} from 'vs/base/parts/quickopen/browser/quickOpenWidget';
import {ContributableActionProvider} from 'vs/workbench/browser/actionBarRegistry';
import { IIconLabelOptions } from 'vs/base/browser/ui/iconLabel/iconLabel';
import { CancellationToken } from 'vs/base/common/cancellation';
import { Mode, IEntryRunContext, IAutoFocus, IQuickNavigateConfiguration, IModel } from 'vs/base/parts/quickopen/common/quickOpen';
import { QuickOpenEntry, QuickOpenModel, QuickOpenEntryGroup } from 'vs/base/parts/quickopen/browser/quickOpenModel';
import { QuickOpenWidget, HideReason } from 'vs/base/parts/quickopen/browser/quickOpenWidget';
import { ContributableActionProvider } from 'vs/workbench/browser/actionBarRegistry';
import labels = require('vs/base/common/labels');
import paths = require('vs/base/common/paths');
import {Registry} from 'vs/platform/platform';
import {IModeService} from 'vs/editor/common/services/modeService';
import {getIconClasses} from 'vs/workbench/browser/labels';
import {IModelService} from 'vs/editor/common/services/modelService';
import {EditorInput, getUntitledOrFileResource, IWorkbenchEditorConfiguration} from 'vs/workbench/common/editor';
import {WorkbenchComponent} from 'vs/workbench/common/component';
import Event, {Emitter} from 'vs/base/common/event';
import {IPartService} from 'vs/workbench/services/part/common/partService';
import {KeyMod} from 'vs/base/common/keyCodes';
import {QuickOpenHandler, QuickOpenHandlerDescriptor, IQuickOpenRegistry, Extensions, EditorQuickOpenEntry} from 'vs/workbench/browser/quickopen';
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
import { Registry } from 'vs/platform/platform';
import { IResourceInput, IEditorInput } from 'vs/platform/editor/common/editor';
import { IModeService } from 'vs/editor/common/services/modeService';
import { getIconClasses } from 'vs/workbench/browser/labels';
import { IModelService } from 'vs/editor/common/services/modelService';
import { EditorInput, getUntitledOrFileResource, IWorkbenchEditorConfiguration } from 'vs/workbench/common/editor';
import { WorkbenchComponent } from 'vs/workbench/common/component';
import Event, { Emitter } from 'vs/base/common/event';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { KeyMod } from 'vs/base/common/keyCodes';
import { QuickOpenHandler, QuickOpenHandlerDescriptor, IQuickOpenRegistry, Extensions, EditorQuickOpenEntry } from 'vs/workbench/browser/quickopen';
import errors = require('vs/base/common/errors');
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {IPickOpenEntry, IFilePickOpenEntry, IInputOptions, IQuickOpenService, IPickOptions, IShowOptions} from 'vs/workbench/services/quickopen/common/quickOpenService';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IMessageService, Severity} from 'vs/platform/message/common/message';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {IContextKeyService, RawContextKey, IContextKey} from 'vs/platform/contextkey/common/contextkey';
import {IHistoryService} from 'vs/workbench/services/history/common/history';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IPickOpenEntry, IFilePickOpenEntry, IInputOptions, IQuickOpenService, IPickOptions, IShowOptions } from 'vs/workbench/services/quickopen/common/quickOpenService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { IHistoryService } from 'vs/workbench/services/history/common/history';
const HELP_PREFIX = '?';
const QUICK_OPEN_MODE = new RawContextKey<boolean>('inQuickOpen', false);
@@ -744,14 +746,28 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe
const results: QuickOpenEntry[] = [];
history.forEach(input => {
const resource = getUntitledOrFileResource(input);
let resource: URI;
if (input instanceof EditorInput) {
resource = getUntitledOrFileResource(input);
} else {
resource = (input as IResourceInput).resource;
}
if (!resource) {
return; //For now, only support to match on inputs that provide resource information
}
let searchTargetToMatch: string;
if (searchInPath) {
searchTargetToMatch = labels.getPathLabel(resource, this.contextService);
} else if (input instanceof EditorInput) {
searchTargetToMatch = input.getName();
} else {
searchTargetToMatch = paths.basename((input as IResourceInput).resource.fsPath);
}
// Check if this entry is a match for the search value
const targetToMatch = searchInPath ? labels.getPathLabel(resource, this.contextService) : input.getName();
if (!filters.matchesFuzzy(searchValue, targetToMatch)) {
if (!filters.matchesFuzzy(searchValue, searchTargetToMatch)) {
return;
}
@@ -1018,28 +1034,42 @@ export class EditorHistoryEntryGroup extends QuickOpenEntryGroup {
}
export class EditorHistoryEntry extends EditorQuickOpenEntry {
private input: EditorInput;
private input: IEditorInput | IResourceInput;
private resource: URI;
private label: string;
private description: string;
constructor(
input: EditorInput,
input: IEditorInput | IResourceInput,
@IWorkbenchEditorService editorService: IWorkbenchEditorService,
@IModeService private modeService: IModeService,
@IModelService private modelService: IModelService,
@ITextFileService private textFileService: ITextFileService,
@IWorkspaceContextService contextService: IWorkspaceContextService,
@IConfigurationService private configurationService: IConfigurationService
) {
super(editorService);
this.input = input;
this.resource = getUntitledOrFileResource(input);
if (input instanceof EditorInput) {
this.resource = getUntitledOrFileResource(input);
this.label = input.getName();
this.description = input.getDescription();
} else {
const resourceInput = input as IResourceInput;
this.resource = resourceInput.resource;
this.label = paths.basename(resourceInput.resource.fsPath);
this.description = labels.getPathLabel(paths.dirname(this.resource.fsPath), contextService);
}
}
public getIcon(): string {
return this.input.isDirty() ? 'dirty' : '';
return this.resource && this.textFileService.isDirty(this.resource) ? 'dirty' : '';
}
public getLabel(): string {
return this.input.getName();
return this.label;
}
public getLabelOptions(): IIconLabelOptions {
@@ -1053,27 +1083,27 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
}
public getDescription(): string {
return this.input.getDescription();
return this.description;
}
public getResource(): URI {
return this.resource;
}
public getInput(): EditorInput {
public getInput(): IEditorInput | IResourceInput {
return this.input;
}
public matches(input: EditorInput): boolean {
return this.input.matches(input);
}
public run(mode: Mode, context: IEntryRunContext): boolean {
if (mode === Mode.OPEN) {
const sideBySide = !context.quickNavigateConfiguration && context.keymods.indexOf(KeyMod.CtrlCmd) >= 0;
const pinned = !this.configurationService.getConfiguration<IWorkbenchEditorConfiguration>().workbench.editor.enablePreviewFromQuickOpen;
this.editorService.openEditor(this.input, { pinned }, sideBySide).done(null, errors.onUnexpectedError);
if (this.input instanceof EditorInput) {
this.editorService.openEditor(this.input, { pinned }, sideBySide).done(null, errors.onUnexpectedError);
} else {
this.editorService.openEditor({ resource: (this.input as IResourceInput).resource, options: { pinned: true } }, sideBySide);
}
return true;
}

View File

@@ -4,18 +4,18 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {Registry} from 'vs/platform/platform';
import {TPromise} from 'vs/base/common/winjs.base';
import { Registry } from 'vs/platform/platform';
import { TPromise } from 'vs/base/common/winjs.base';
import nls = require('vs/nls');
import {Action} from 'vs/base/common/actions';
import {IQuickOpenService} from 'vs/workbench/services/quickopen/common/quickOpenService';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IKeybindings} from 'vs/platform/keybinding/common/keybinding';
import {ContextKeyExpr} from 'vs/platform/contextkey/common/contextkey';
import {SyncActionDescriptor} from 'vs/platform/actions/common/actions';
import {KeyMod, KeyCode} from 'vs/base/common/keyCodes';
import {IWorkbenchActionRegistry, Extensions as ActionExtensions} from 'vs/workbench/common/actionRegistry';
import {KeybindingsRegistry} from 'vs/platform/keybinding/common/keybindingsRegistry';
import { Action } from 'vs/base/common/actions';
import { IQuickOpenService } from 'vs/workbench/services/quickopen/common/quickOpenService';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IKeybindings } from 'vs/platform/keybinding/common/keybinding';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actionRegistry';
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
export class GlobalQuickOpenAction extends Action {

View File

@@ -4,25 +4,25 @@
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./media/sidebarpart';
import {TPromise} from 'vs/base/common/winjs.base';
import { TPromise } from 'vs/base/common/winjs.base';
import nls = require('vs/nls');
import {Registry} from 'vs/platform/platform';
import {Action} from 'vs/base/common/actions';
import {CompositePart} from 'vs/workbench/browser/parts/compositePart';
import {Viewlet, ViewletRegistry, Extensions as ViewletExtensions} from 'vs/workbench/browser/viewlet';
import {IWorkbenchActionRegistry, Extensions as ActionExtensions} from 'vs/workbench/common/actionRegistry';
import {SyncActionDescriptor} from 'vs/platform/actions/common/actions';
import {IViewletService} from 'vs/workbench/services/viewlet/common/viewletService';
import {IPartService} from 'vs/workbench/services/part/common/partService';
import {IViewlet} from 'vs/workbench/common/viewlet';
import {Scope} from 'vs/workbench/browser/actionBarRegistry';
import {IStorageService} from 'vs/platform/storage/common/storage';
import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
import {IMessageService} from 'vs/platform/message/common/message';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {KeyMod, KeyCode} from 'vs/base/common/keyCodes';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import { Registry } from 'vs/platform/platform';
import { Action } from 'vs/base/common/actions';
import { CompositePart } from 'vs/workbench/browser/parts/compositePart';
import { Viewlet, ViewletRegistry, Extensions as ViewletExtensions } from 'vs/workbench/browser/viewlet';
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actionRegistry';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { IViewletService } from 'vs/workbench/services/viewlet/common/viewletService';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { IViewlet } from 'vs/workbench/common/viewlet';
import { Scope } from 'vs/workbench/browser/actionBarRegistry';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IMessageService } from 'vs/platform/message/common/message';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import Event from 'vs/base/common/event';
export class SidebarPart extends CompositePart<Viewlet> implements IViewletService {

View File

@@ -4,13 +4,13 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {Registry} from 'vs/platform/platform';
import {IDisposable} from 'vs/base/common/lifecycle';
import { Registry } from 'vs/platform/platform';
import { IDisposable } from 'vs/base/common/lifecycle';
/* tslint:disable:no-unused-variable */
import statusbarService = require('vs/platform/statusbar/common/statusbar');
/* tslint:enable:no-unused-variable */
import {SyncDescriptor0, createSyncDescriptor} from 'vs/platform/instantiation/common/descriptors';
import {IConstructorSignature0} from 'vs/platform/instantiation/common/instantiation';
import { SyncDescriptor0, createSyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { IConstructorSignature0 } from 'vs/platform/instantiation/common/instantiation';
export interface IStatusbarItem {
render(element: HTMLElement): IDisposable;

View File

@@ -8,22 +8,22 @@
import 'vs/css!./media/statusbarpart';
import dom = require('vs/base/browser/dom');
import nls = require('vs/nls');
import {toErrorMessage} from 'vs/base/common/errorMessage';
import {TPromise} from 'vs/base/common/winjs.base';
import {dispose, IDisposable} from 'vs/base/common/lifecycle';
import {Builder, $} from 'vs/base/browser/builder';
import {OcticonLabel} from 'vs/base/browser/ui/octiconLabel/octiconLabel';
import {Registry} from 'vs/platform/platform';
import {ICommandService} from 'vs/platform/commands/common/commands';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {Part} from 'vs/workbench/browser/part';
import {IWorkbenchActionRegistry, Extensions as ActionExtensions} from 'vs/workbench/common/actionRegistry';
import {StatusbarAlignment, IStatusbarRegistry, Extensions, IStatusbarItem} from 'vs/workbench/browser/parts/statusbar/statusbar';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IMessageService, Severity} from 'vs/platform/message/common/message';
import {IStatusbarService, IStatusbarEntry} from 'vs/platform/statusbar/common/statusbar';
import {getCodeEditor} from 'vs/editor/common/services/codeEditorService';
import { toErrorMessage } from 'vs/base/common/errorMessage';
import { TPromise } from 'vs/base/common/winjs.base';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import { Builder, $ } from 'vs/base/browser/builder';
import { OcticonLabel } from 'vs/base/browser/ui/octiconLabel/octiconLabel';
import { Registry } from 'vs/platform/platform';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { Part } from 'vs/workbench/browser/part';
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actionRegistry';
import { StatusbarAlignment, IStatusbarRegistry, Extensions, IStatusbarItem } from 'vs/workbench/browser/parts/statusbar/statusbar';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import { IStatusbarService, IStatusbarEntry } from 'vs/platform/statusbar/common/statusbar';
import { getCodeEditor } from 'vs/editor/common/services/codeEditorService';
export class StatusbarPart extends Part implements IStatusbarService {

View File

@@ -5,22 +5,22 @@
'use strict';
import nls = require('vs/nls');
import {TPromise} from 'vs/base/common/winjs.base';
import { TPromise } from 'vs/base/common/winjs.base';
import filters = require('vs/base/common/filters');
import arrays = require('vs/base/common/arrays');
import strings = require('vs/base/common/strings');
import types = require('vs/base/common/types');
import errors = require('vs/base/common/errors');
import {Registry} from 'vs/platform/platform';
import {Action} from 'vs/base/common/actions';
import {KeyMod} from 'vs/base/common/keyCodes';
import {Mode, IEntryRunContext, IAutoFocus, IModel, IQuickNavigateConfiguration} from 'vs/base/parts/quickopen/common/quickOpen';
import {QuickOpenEntry, IHighlight, QuickOpenEntryGroup, QuickOpenModel} from 'vs/base/parts/quickopen/browser/quickOpenModel';
import {EditorOptions, EditorInput} from 'vs/workbench/common/editor';
import {IResourceInput, IEditorInput} from 'vs/platform/editor/common/editor';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {IQuickOpenService} from 'vs/workbench/services/quickopen/common/quickOpenService';
import {AsyncDescriptor} from 'vs/platform/instantiation/common/descriptors';
import { Registry } from 'vs/platform/platform';
import { Action } from 'vs/base/common/actions';
import { KeyMod } from 'vs/base/common/keyCodes';
import { Mode, IEntryRunContext, IAutoFocus, IModel, IQuickNavigateConfiguration } from 'vs/base/parts/quickopen/common/quickOpen';
import { QuickOpenEntry, IHighlight, QuickOpenEntryGroup, QuickOpenModel } from 'vs/base/parts/quickopen/browser/quickOpenModel';
import { EditorOptions, EditorInput } from 'vs/workbench/common/editor';
import { IResourceInput, IEditorInput } from 'vs/platform/editor/common/editor';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IQuickOpenService } from 'vs/workbench/services/quickopen/common/quickOpenService';
import { AsyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
export class QuickOpenHandler {
@@ -311,7 +311,7 @@ class CommandEntry extends QuickOpenEntry {
return false;
}
this.quickOpenService.show(`${ this.prefix } ${ this.command.aliases[0]} `);
this.quickOpenService.show(`${this.prefix} ${this.command.aliases[0]} `);
return false;
}
}

View File

@@ -4,26 +4,26 @@
*--------------------------------------------------------------------------------------------*/
import nls = require('vs/nls');
import {TPromise} from 'vs/base/common/winjs.base';
import { TPromise } from 'vs/base/common/winjs.base';
import DOM = require('vs/base/browser/dom');
import errors = require('vs/base/common/errors');
import {Registry} from 'vs/platform/platform';
import {Dimension, Builder, $} from 'vs/base/browser/builder';
import {IAction, IActionRunner, Action} from 'vs/base/common/actions';
import {IActionItem, ActionsOrientation} from 'vs/base/browser/ui/actionbar/actionbar';
import {ITree, IFocusEvent, ISelectionEvent} from 'vs/base/parts/tree/browser/tree';
import {prepareActions} from 'vs/workbench/browser/actionBarRegistry';
import {ToolBar} from 'vs/base/browser/ui/toolbar/toolbar';
import {DelayedDragHandler} from 'vs/base/browser/dnd';
import {dispose, IDisposable} from 'vs/base/common/lifecycle';
import {CollapsibleView, CollapsibleState, FixedCollapsibleView, IView} from 'vs/base/browser/ui/splitview/splitview';
import {IViewletService} from 'vs/workbench/services/viewlet/common/viewletService';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {IViewlet} from 'vs/workbench/common/viewlet';
import {Composite, CompositeDescriptor, CompositeRegistry} from 'vs/workbench/browser/composite';
import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
import {IMessageService} from 'vs/platform/message/common/message';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import { Registry } from 'vs/platform/platform';
import { Dimension, Builder, $ } from 'vs/base/browser/builder';
import { IAction, IActionRunner, Action } from 'vs/base/common/actions';
import { IActionItem, ActionsOrientation } from 'vs/base/browser/ui/actionbar/actionbar';
import { ITree, IFocusEvent, ISelectionEvent } from 'vs/base/parts/tree/browser/tree';
import { prepareActions } from 'vs/workbench/browser/actionBarRegistry';
import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar';
import { DelayedDragHandler } from 'vs/base/browser/dnd';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import { CollapsibleView, CollapsibleState, FixedCollapsibleView, IView } from 'vs/base/browser/ui/splitview/splitview';
import { IViewletService } from 'vs/workbench/services/viewlet/common/viewletService';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IViewlet } from 'vs/workbench/common/viewlet';
import { Composite, CompositeDescriptor, CompositeRegistry } from 'vs/workbench/browser/composite';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IMessageService } from 'vs/platform/message/common/message';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
export abstract class Viewlet extends Composite implements IViewlet {

View File

@@ -4,17 +4,17 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import { TPromise } from 'vs/base/common/winjs.base';
import collections = require('vs/base/common/collections');
import {Registry} from 'vs/platform/platform';
import {IAction} from 'vs/base/common/actions';
import {KeybindingsRegistry, ICommandAndKeybindingRule} from 'vs/platform/keybinding/common/keybindingsRegistry';
import {IPartService} from 'vs/workbench/services/part/common/partService';
import {ICommandHandler} from 'vs/platform/commands/common/commands';
import {SyncActionDescriptor} from 'vs/platform/actions/common/actions';
import {IMessageService} from 'vs/platform/message/common/message';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import { Registry } from 'vs/platform/platform';
import { IAction } from 'vs/base/common/actions';
import { KeybindingsRegistry, ICommandAndKeybindingRule } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { ICommandHandler } from 'vs/platform/commands/common/commands';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { IMessageService } from 'vs/platform/message/common/message';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import Severity from 'vs/base/common/severity';
export const Extensions = {

View File

@@ -4,9 +4,9 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import {Scope, Memento} from 'vs/workbench/common/memento';
import {IStorageService} from 'vs/platform/storage/common/storage';
import { IDisposable, dispose, Disposable } from 'vs/base/common/lifecycle';
import { Scope, Memento } from 'vs/workbench/common/memento';
import { IStorageService } from 'vs/platform/storage/common/storage';
/**
* Base class of any core/ui component in the workbench. Examples include services, extensions, parts, viewlets and quick open.
@@ -54,12 +54,13 @@ export interface IWorkbenchComponent extends IDisposable {
dispose(): void;
}
export class WorkbenchComponent implements IWorkbenchComponent {
export class WorkbenchComponent extends Disposable implements IWorkbenchComponent {
private _toUnbind: IDisposable[];
private id: string;
private componentMemento: Memento;
constructor(id: string) {
super();
this._toUnbind = [];
this.id = id;
this.componentMemento = new Memento(this.id);
@@ -89,5 +90,6 @@ export class WorkbenchComponent implements IWorkbenchComponent {
public dispose(): void {
this._toUnbind = dispose(this._toUnbind);
super.dispose();
}
}

View File

@@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import {IAction, IActionItem} from 'vs/base/common/actions';
import {IEditorControl} from 'vs/platform/editor/common/editor';
import { IAction, IActionItem } from 'vs/base/common/actions';
import { IEditorControl } from 'vs/platform/editor/common/editor';
export interface IComposite {

View File

@@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {Registry, BaseRegistry} from 'vs/platform/platform';
import {IConstructorSignature0} from 'vs/platform/instantiation/common/instantiation';
import { Registry, BaseRegistry } from 'vs/platform/platform';
import { IConstructorSignature0 } from 'vs/platform/instantiation/common/instantiation';
// --- Workbench Contribution Registry

View File

@@ -4,18 +4,18 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import Event, {Emitter} from 'vs/base/common/event';
import { TPromise } from 'vs/base/common/winjs.base';
import Event, { Emitter } from 'vs/base/common/event';
import types = require('vs/base/common/types');
import URI from 'vs/base/common/uri';
import {IEditor, ICommonCodeEditor, IEditorViewState, IEditorOptions as ICodeEditorOptions} from 'vs/editor/common/editorCommon';
import {IEditorInput, IEditorModel, IEditorOptions, ITextEditorOptions, IResourceInput, Position} from 'vs/platform/editor/common/editor';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {Event as BaseEvent} from 'vs/base/common/events';
import {IEditorGroupService} from 'vs/workbench/services/group/common/groupService';
import {SyncDescriptor, AsyncDescriptor} from 'vs/platform/instantiation/common/descriptors';
import {IInstantiationService, IConstructorSignature0} from 'vs/platform/instantiation/common/instantiation';
import {IModel} from 'vs/editor/common/editorCommon';
import { IEditor, ICommonCodeEditor, IEditorViewState, IEditorOptions as ICodeEditorOptions } from 'vs/editor/common/editorCommon';
import { IEditorInput, IEditorModel, IEditorOptions, ITextEditorOptions, IResourceInput, Position } from 'vs/platform/editor/common/editor';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { Event as BaseEvent } from 'vs/base/common/events';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { SyncDescriptor, AsyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { IInstantiationService, IConstructorSignature0 } from 'vs/platform/instantiation/common/instantiation';
import { IModel } from 'vs/editor/common/editorCommon';
export enum ConfirmResult {
SAVE,
@@ -36,6 +36,16 @@ export const Extensions = {
Editors: 'workbench.contributions.editors'
};
/**
* Text diff editor id.
*/
export const TEXT_DIFF_EDITOR_ID = 'workbench.editors.textDiffEditor';
/**
* Binary diff editor id.
*/
export const BINARY_DIFF_EDITOR_ID = 'workbench.editors.binaryResourceDiffEditor';
export interface IEditorRegistry {
/**
@@ -323,16 +333,6 @@ export interface IEncodingSupport {
*/
export interface IFileEditorInput extends IEditorInput, IEncodingSupport {
/**
* Gets the mime type of the file this input is about.
*/
getMime(): string;
/**
* Sets the mime type of the file this input is about.
*/
setMime(mime: string): void;
/**
* Gets the absolute file resource URI this input is about.
*/
@@ -360,8 +360,6 @@ export abstract class UntitledEditorInput extends EditorInput implements IEncodi
abstract suggestFileName(): string;
abstract getMime(): string;
abstract getEncoding(): string;
abstract setEncoding(encoding: string, mode: EncodingMode): void;
@@ -461,7 +459,7 @@ export class EditorOptions implements IEditorOptions {
* Helper to create EditorOptions inline.
*/
public static create(settings: IEditorOptions): EditorOptions {
let options = new EditorOptions();
const options = new EditorOptions();
options.preserveFocus = settings.preserveFocus;
options.forceOpen = settings.forceOpen;
options.revealIfVisible = settings.revealIfVisible;
@@ -539,7 +537,7 @@ export class TextEditorOptions extends EditorOptions {
}
if (input.options.selection) {
let selection = input.options.selection;
const selection = input.options.selection;
options.selection(selection.startLineNumber, selection.startColumn, selection.endLineNumber, selection.endColumn);
}
@@ -575,7 +573,7 @@ export class TextEditorOptions extends EditorOptions {
* Helper to create TextEditorOptions inline.
*/
public static create(settings: ITextEditorOptions): TextEditorOptions {
let options = new TextEditorOptions();
const options = new TextEditorOptions();
options.preserveFocus = settings.preserveFocus;
options.forceOpen = settings.forceOpen;
options.revealIfVisible = settings.revealIfVisible;
@@ -662,7 +660,7 @@ export class TextEditorOptions extends EditorOptions {
// Select
if (!types.isUndefinedOrNull(this.endLineNumber) && !types.isUndefinedOrNull(this.endColumn)) {
let range = {
const range = {
startLineNumber: this.startLineNumber,
startColumn: this.startColumn,
endLineNumber: this.endLineNumber,
@@ -674,7 +672,7 @@ export class TextEditorOptions extends EditorOptions {
// Reveal
else {
let pos = {
const pos = {
lineNumber: this.startLineNumber,
column: this.startColumn
};
@@ -707,7 +705,7 @@ export class TextDiffEditorOptions extends TextEditorOptions {
* Helper to create TextDiffEditorOptions inline.
*/
public static create(settings: ITextDiffEditorOptions): TextDiffEditorOptions {
let options = new TextDiffEditorOptions();
const options = new TextDiffEditorOptions();
options.autoRevealFirstChange = settings.autoRevealFirstChange;
@@ -748,7 +746,7 @@ export function getUntitledOrFileResource(input: IEditorInput, supportDiff?: boo
}
// File
let fileInput = asFileEditorInput(input, supportDiff);
const fileInput = asFileEditorInput(input, supportDiff);
return fileInput && fileInput.getResource();
}
@@ -756,7 +754,7 @@ export function getUntitledOrFileResource(input: IEditorInput, supportDiff?: boo
// TODO@Ben every editor should have an associated resource
export function getResource(input: IEditorInput): URI {
if (input instanceof EditorInput && typeof (<any>input).getResource === 'function') {
let candidate = (<any>input).getResource();
const candidate = (<any>input).getResource();
if (candidate instanceof URI) {
return candidate;
}
@@ -797,9 +795,9 @@ export function asFileEditorInput(obj: any, supportDiff?: boolean): IFileEditorI
obj = (<BaseDiffEditorInput>obj).modifiedInput;
}
let i = <IFileEditorInput>obj;
const i = <IFileEditorInput>obj;
return i instanceof EditorInput && types.areFunctions(i.setResource, i.setMime, i.setEncoding, i.getEncoding, i.getResource, i.getMime) ? i : null;
return i instanceof EditorInput && types.areFunctions(i.setResource, i.setEncoding, i.getEncoding, i.getResource, i.setPreferredEncoding) ? i : null;
}
export interface IStacksModelChangeEvent {
@@ -883,7 +881,7 @@ export interface IWorkbenchEditorConfiguration {
showIcons: boolean;
enablePreview: boolean;
enablePreviewFromQuickOpen: boolean;
openPositioning: string;
openPositioning: 'left' | 'right' | 'first' | 'last';
}
};
}

View File

@@ -4,13 +4,13 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import {EditorModel} from 'vs/workbench/common/editor';
import { TPromise } from 'vs/base/common/winjs.base';
import { EditorModel } from 'vs/workbench/common/editor';
import URI from 'vs/base/common/uri';
import {IFileService} from 'vs/platform/files/common/files';
import { IFileService } from 'vs/platform/files/common/files';
/**
* An editor model that just represents a resource and mime for a resource that can be loaded.
* An editor model that just represents a resource that can be loaded.
*/
export class BinaryEditorModel extends EditorModel {
private name: string;
@@ -58,7 +58,7 @@ export class BinaryEditorModel extends EditorModel {
}
public load(): TPromise<EditorModel> {
return this.fileService.resolveFile(this.resource).then(stat => {
return this.fileService.resolveFile(this.resource).then(stat => {
this.etag = stat.etag;
this.size = stat.size;

View File

@@ -5,17 +5,15 @@
'use strict';
import nls = require('vs/nls');
import {TPromise} from 'vs/base/common/winjs.base';
import types = require('vs/base/common/types');
import {once} from 'vs/base/common/event';
import { TPromise } from 'vs/base/common/winjs.base';
import { once } from 'vs/base/common/event';
import URI from 'vs/base/common/uri';
import {getPathLabel, IWorkspaceProvider} from 'vs/base/common/labels';
import {isBinaryMime} from 'vs/base/common/mime';
import {EditorModel, IFileEditorInput, EditorInput, BaseDiffEditorInput} from 'vs/workbench/common/editor';
import {BaseTextEditorModel} from 'vs/workbench/common/editor/textEditorModel';
import {DiffEditorModel} from 'vs/workbench/common/editor/diffEditorModel';
import {TextDiffEditorModel} from 'vs/workbench/common/editor/textDiffEditorModel';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import { getPathLabel, IWorkspaceProvider } from 'vs/base/common/labels';
import { EditorModel, EditorInput, BaseDiffEditorInput, TEXT_DIFF_EDITOR_ID, BINARY_DIFF_EDITOR_ID } from 'vs/workbench/common/editor';
import { BaseTextEditorModel } from 'vs/workbench/common/editor/textEditorModel';
import { DiffEditorModel } from 'vs/workbench/common/editor/diffEditorModel';
import { TextDiffEditorModel } from 'vs/workbench/common/editor/textDiffEditorModel';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
/**
* The base editor input for the diff editor. It is made up of two editor inputs, the original version
@@ -109,23 +107,7 @@ export class DiffEditorInput extends BaseDiffEditorInput {
}
public getPreferredEditorId(candidates: string[]): string {
// Find the right diff editor for the given isBinary/isText state
const useBinaryEditor = this.forceOpenAsBinary || this.isBinary(this.originalInput) || this.isBinary(this.modifiedInput);
return !useBinaryEditor ? 'workbench.editors.textDiffEditor' : 'workbench.editors.binaryResourceDiffEditor';
}
private isBinary(input: EditorInput): boolean {
let mime: string;
// Find mime by checking for IFileEditorInput implementors
const fileInput = <IFileEditorInput>(<any>input);
if (types.isFunction(fileInput.getMime)) {
mime = fileInput.getMime();
}
return mime && isBinaryMime(mime);
return this.forceOpenAsBinary ? BINARY_DIFF_EDITOR_ID : TEXT_DIFF_EDITOR_ID;
}
private createModel(refresh?: boolean): TPromise<DiffEditorModel> {

View File

@@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import {EditorModel} from 'vs/workbench/common/editor';
import { TPromise } from 'vs/base/common/winjs.base';
import { EditorModel } from 'vs/workbench/common/editor';
/**
* The base editor model for the diff editor. It is made up of two editor models, the original version

View File

@@ -5,17 +5,17 @@
'use strict';
import Event, {Emitter, once} from 'vs/base/common/event';
import {IEditorRegistry, Extensions, EditorInput, getResource, IEditorStacksModel, IEditorGroup, IEditorIdentifier, IGroupEvent, GroupIdentifier, IStacksModelChangeEvent, IWorkbenchEditorConfiguration, EditorOpenPositioning} from 'vs/workbench/common/editor';
import Event, { Emitter, once } from 'vs/base/common/event';
import { IEditorRegistry, Extensions, EditorInput, getResource, IEditorStacksModel, IEditorGroup, IEditorIdentifier, IGroupEvent, GroupIdentifier, IStacksModelChangeEvent, IWorkbenchEditorConfiguration, EditorOpenPositioning } from 'vs/workbench/common/editor';
import URI from 'vs/base/common/uri';
import {IStorageService, StorageScope} from 'vs/platform/storage/common/storage';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {ILifecycleService} from 'vs/platform/lifecycle/common/lifecycle';
import {dispose, IDisposable} from 'vs/base/common/lifecycle';
import {Registry} from 'vs/platform/platform';
import {Position, Direction} from 'vs/platform/editor/common/editor';
import {DiffEditorInput} from 'vs/workbench/common/editor/diffEditorInput';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import { Registry } from 'vs/platform/platform';
import { Position, Direction } from 'vs/platform/editor/common/editor';
import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
export interface GroupEvent extends IGroupEvent {
editor: EditorInput;
@@ -59,7 +59,7 @@ export class EditorGroup implements IEditorGroup {
private active: EditorInput; // editor in active state
private toDispose: IDisposable[];
private editorOpenPositioning: string;
private editorOpenPositioning: 'left' | 'right' | 'first' | 'last';
private _onEditorActivated: Emitter<EditorInput>;
private _onEditorOpened: Emitter<EditorInput>;
@@ -114,7 +114,9 @@ export class EditorGroup implements IEditorGroup {
}
private onConfigurationUpdated(config: IWorkbenchEditorConfiguration): void {
this.editorOpenPositioning = config && config.workbench && config.workbench.editor && config.workbench.editor.openPositioning;
if (config && config.workbench && config.workbench.editor) {
this.editorOpenPositioning = config.workbench.editor.openPositioning;
}
}
public get id(): GroupIdentifier {

View File

@@ -3,12 +3,12 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import {IDisposable} from 'vs/base/common/lifecycle';
import { IDisposable } from 'vs/base/common/lifecycle';
import URI from 'vs/base/common/uri';
import * as editorCommon from 'vs/editor/common/editorCommon';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {IEditor} from 'vs/platform/editor/common/editor';
import {asFileEditorInput} from 'vs/workbench/common/editor';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IEditor } from 'vs/platform/editor/common/editor';
import { asFileEditorInput } from 'vs/workbench/common/editor';
export interface IRangeHighlightDecoration {
resource: URI;
@@ -21,7 +21,7 @@ export class RangeHighlightDecorations implements IDisposable {
private editor: editorCommon.ICommonCodeEditor = null;
private editorDisposables: IDisposable[] = [];
constructor(@IWorkbenchEditorService private editorService: IWorkbenchEditorService) {
constructor( @IWorkbenchEditorService private editorService: IWorkbenchEditorService) {
}
public removeHighlightRange() {

View File

@@ -4,15 +4,15 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import {sequence} from 'vs/base/common/async';
import {EditorModel, EditorInput} from 'vs/workbench/common/editor';
import {ResourceEditorModel} from 'vs/workbench/common/editor/resourceEditorModel';
import {IModel} from 'vs/editor/common/editorCommon';
import { TPromise } from 'vs/base/common/winjs.base';
import { sequence } from 'vs/base/common/async';
import { EditorModel, EditorInput } from 'vs/workbench/common/editor';
import { ResourceEditorModel } from 'vs/workbench/common/editor/resourceEditorModel';
import { IModel } from 'vs/editor/common/editorCommon';
import URI from 'vs/base/common/uri';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IModelService} from 'vs/editor/common/services/modelService';
import {IDisposable} from 'vs/base/common/lifecycle';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IModelService } from 'vs/editor/common/services/modelService';
import { IDisposable } from 'vs/base/common/lifecycle';
/**
*

View File

@@ -4,10 +4,10 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {BaseTextEditorModel} from 'vs/workbench/common/editor/textEditorModel';
import { BaseTextEditorModel } from 'vs/workbench/common/editor/textEditorModel';
import URI from 'vs/base/common/uri';
import {IModeService} from 'vs/editor/common/services/modeService';
import {IModelService} from 'vs/editor/common/services/modelService';
import { IModeService } from 'vs/editor/common/services/modeService';
import { IModelService } from 'vs/editor/common/services/modelService';
/**
* An editor model whith an in-memory, readonly content that is backed by an existing editor model.

View File

@@ -4,15 +4,15 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import {MIME_TEXT} from 'vs/base/common/mime';
import {EditorModel, EditorInput} from 'vs/workbench/common/editor';
import {StringEditorModel} from 'vs/workbench/common/editor/stringEditorModel';
import { TPromise } from 'vs/base/common/winjs.base';
import { PLAINTEXT_MODE_ID } from 'vs/editor/common/modes/modesRegistry';
import { EditorModel, EditorInput } from 'vs/workbench/common/editor';
import { StringEditorModel } from 'vs/workbench/common/editor/stringEditorModel';
import URI from 'vs/base/common/uri';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
/**
* A read-only text editor input whos contents are made of the provided value and mime type.
* A read-only text editor input whos contents are made of the provided value and mode ID.
*/
export class StringEditorInput extends EditorInput {
@@ -20,17 +20,18 @@ export class StringEditorInput extends EditorInput {
protected cachedModel: StringEditorModel;
protected value: string;
private name: string;
private description: string;
protected value: string;
protected mime: string;
private modeId: string;
private singleton: boolean;
constructor(
name: string,
description: string,
value: string,
mime: string,
modeId: string,
singleton: boolean,
@IInstantiationService private instantiationService: IInstantiationService
) {
@@ -39,7 +40,7 @@ export class StringEditorInput extends EditorInput {
this.name = name;
this.description = description;
this.value = value;
this.mime = mime || MIME_TEXT;
this.modeId = modeId || PLAINTEXT_MODE_ID;
this.singleton = singleton;
}
@@ -63,10 +64,6 @@ export class StringEditorInput extends EditorInput {
return this.value;
}
public getMime(): string {
return this.mime;
}
/**
* Sets the textual value of this input and will also update the underlying model if this input is resolved.
*/
@@ -123,7 +120,7 @@ export class StringEditorInput extends EditorInput {
}
//Otherwise Create Model and Load
let model = this.instantiationService.createInstance(StringEditorModel, this.value, this.mime, this.getResource());
let model = this.instantiationService.createInstance(StringEditorModel, this.value, this.modeId, this.getResource());
return model.load().then((resolvedModel: StringEditorModel) => {
this.cachedModel = resolvedModel;
@@ -139,8 +136,8 @@ export class StringEditorInput extends EditorInput {
if (otherInput instanceof StringEditorInput) {
let otherStringEditorInput = <StringEditorInput>otherInput;
// If both inputs are singletons, check on the mime for equalness
if (otherStringEditorInput.singleton && this.singleton && otherStringEditorInput.mime === this.mime) {
// If both inputs are singletons, check on the modeId for equalness
if (otherStringEditorInput.singleton && this.singleton && otherStringEditorInput.modeId === this.modeId) {
return true;
}
@@ -153,7 +150,7 @@ export class StringEditorInput extends EditorInput {
// Otherwise compare by properties
return otherStringEditorInput.value === this.value &&
otherStringEditorInput.mime === this.mime &&
otherStringEditorInput.modeId === this.modeId &&
otherStringEditorInput.description === this.description &&
otherStringEditorInput.name === this.name;
}

View File

@@ -4,27 +4,27 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import {BaseTextEditorModel} from 'vs/workbench/common/editor/textEditorModel';
import {EditorModel} from 'vs/workbench/common/editor';
import { TPromise } from 'vs/base/common/winjs.base';
import { BaseTextEditorModel } from 'vs/workbench/common/editor/textEditorModel';
import { EditorModel } from 'vs/workbench/common/editor';
import URI from 'vs/base/common/uri';
import {Position} from 'vs/editor/common/core/position';
import {Range} from 'vs/editor/common/core/range';
import {IModeService} from 'vs/editor/common/services/modeService';
import {IModelService} from 'vs/editor/common/services/modelService';
import {EditOperation} from 'vs/editor/common/core/editOperation';
import { Position } from 'vs/editor/common/core/position';
import { Range } from 'vs/editor/common/core/range';
import { IModeService } from 'vs/editor/common/services/modeService';
import { IModelService } from 'vs/editor/common/services/modelService';
import { EditOperation } from 'vs/editor/common/core/editOperation';
/**
* An editor model whith an in-memory, readonly content that is not backed by any particular resource.
*/
export class StringEditorModel extends BaseTextEditorModel {
protected value: string;
protected mime: string;
protected modeId: string;
protected resource: URI;
constructor(
value: string,
mime: string,
modeId: string,
resource: URI,
@IModeService modeService: IModeService,
@IModelService modelService: IModelService
@@ -32,7 +32,7 @@ export class StringEditorModel extends BaseTextEditorModel {
super(modelService, modeService);
this.value = value;
this.mime = mime;
this.modeId = modeId;
this.resource = resource;
}
@@ -99,15 +99,11 @@ export class StringEditorModel extends BaseTextEditorModel {
return null;
}
public getMime(): string {
return this.mime;
}
public load(): TPromise<EditorModel> {
// Create text editor model if not yet done
if (!this.textEditorModel) {
return this.createTextEditorModel(this.value, this.resource, this.mime);
return this.createTextEditorModel(this.value, this.resource, this.modeId);
}
// Otherwise update

View File

@@ -4,11 +4,11 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import {IDiffEditorModel} from 'vs/editor/common/editorCommon';
import {EditorModel} from 'vs/workbench/common/editor';
import {BaseTextEditorModel} from 'vs/workbench/common/editor/textEditorModel';
import {DiffEditorModel} from 'vs/workbench/common/editor/diffEditorModel';
import { TPromise } from 'vs/base/common/winjs.base';
import { IDiffEditorModel } from 'vs/editor/common/editorCommon';
import { EditorModel } from 'vs/workbench/common/editor';
import { BaseTextEditorModel } from 'vs/workbench/common/editor/textEditorModel';
import { DiffEditorModel } from 'vs/workbench/common/editor/diffEditorModel';
/**
* The base text editor model for the diff editor. It is made up of two text editor models, the original version

View File

@@ -4,16 +4,16 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import {EndOfLinePreference, IModel, IRawText} from 'vs/editor/common/editorCommon';
import {IMode} from 'vs/editor/common/modes';
import {EditorModel} from 'vs/workbench/common/editor';
import { TPromise } from 'vs/base/common/winjs.base';
import { EndOfLinePreference, IModel, IRawText } from 'vs/editor/common/editorCommon';
import { IMode } from 'vs/editor/common/modes';
import { EditorModel } from 'vs/workbench/common/editor';
import URI from 'vs/base/common/uri';
import {ITextEditorModel} from 'vs/platform/editor/common/editor';
import {IModeService} from 'vs/editor/common/services/modeService';
import {IModelService} from 'vs/editor/common/services/modelService';
import {RawText} from 'vs/editor/common/model/textModel';
import {IDisposable} from 'vs/base/common/lifecycle';
import { ITextEditorModel } from 'vs/platform/editor/common/editor';
import { IModeService } from 'vs/editor/common/services/modeService';
import { IModelService } from 'vs/editor/common/services/modelService';
import { RawText } from 'vs/editor/common/model/textModel';
import { IDisposable } from 'vs/base/common/lifecycle';
/**
* The base text editor model leverages the code editor model. This class is only intended to be subclassed and not instantiated.
@@ -65,11 +65,11 @@ export abstract class BaseTextEditorModel extends EditorModel implements ITextEd
}
/**
* Creates the text editor model with the provided value, mime (can be comma separated for multiple values) and optional resource URL.
* Creates the text editor model with the provided value, modeId (can be comma separated for multiple values) and optional resource URL.
*/
protected createTextEditorModel(value: string | IRawText, resource?: URI, mime?: string): TPromise<EditorModel> {
protected createTextEditorModel(value: string | IRawText, resource?: URI, modeId?: string): TPromise<EditorModel> {
const firstLineText = this.getFirstLineText(value);
const mode = this.getOrCreateMode(this.modeService, mime, firstLineText);
const mode = this.getOrCreateMode(this.modeService, modeId, firstLineText);
// To avoid flickering, give the mode at most 50ms to load. If the mode doesn't load in 50ms, proceed creating the model with a mode promise
return TPromise.any<any>([TPromise.timeout(50), mode]).then(() => {
@@ -125,8 +125,8 @@ export abstract class BaseTextEditorModel extends EditorModel implements ITextEd
*
* @param firstLineText optional first line of the text buffer to set the mode on. This can be used to guess a mode from content.
*/
protected getOrCreateMode(modeService: IModeService, mime: string, firstLineText?: string): TPromise<IMode> {
return modeService.getOrCreateMode(mime);
protected getOrCreateMode(modeService: IModeService, modeId: string, firstLineText?: string): TPromise<IMode> {
return modeService.getOrCreateMode(modeId);
}
/**
@@ -156,13 +156,13 @@ export abstract class BaseTextEditorModel extends EditorModel implements ITextEd
/**
* Updates the text editor model mode based on the settings and configuration.
*/
protected updateTextEditorModelMode(mime?: string): void {
protected updateTextEditorModelMode(modeId?: string): void {
if (!this.textEditorModel) {
return;
}
const firstLineText = this.getFirstLineText(this.textEditorModel.getValue());
const mode = this.getOrCreateMode(this.modeService, mime, firstLineText);
const mode = this.getOrCreateMode(this.modeService, modeId, firstLineText);
this.modelService.setMode(this.textEditorModel, mode);
}

View File

@@ -4,20 +4,20 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import { TPromise } from 'vs/base/common/winjs.base';
import URI from 'vs/base/common/uri';
import {isUnspecific, guessMimeTypes, MIME_TEXT, suggestFilename} from 'vs/base/common/mime';
import { suggestFilename } from 'vs/base/common/mime';
import labels = require('vs/base/common/labels');
import { PLAINTEXT_MODE_ID } from 'vs/editor/common/modes/modesRegistry';
import paths = require('vs/base/common/paths');
import {UntitledEditorInput as AbstractUntitledEditorInput, EncodingMode, ConfirmResult} from 'vs/workbench/common/editor';
import {UntitledEditorModel} from 'vs/workbench/common/editor/untitledEditorModel';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {IModeService} from 'vs/editor/common/services/modeService';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import Event, {Emitter} from 'vs/base/common/event';
import {ITextFileService} from 'vs/workbench/parts/files/common/files'; // TODO@Ben layer breaker
import { UntitledEditorInput as AbstractUntitledEditorInput, EncodingMode, ConfirmResult } from 'vs/workbench/common/editor';
import { UntitledEditorModel } from 'vs/workbench/common/editor/untitledEditorModel';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IModeService } from 'vs/editor/common/services/modeService';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import Event, { Emitter } from 'vs/base/common/event';
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
/**
* An editor input to be used for untitled text buffers.
@@ -98,23 +98,17 @@ export class UntitledEditorInput extends AbstractUntitledEditorInput {
public suggestFileName(): string {
if (!this.hasAssociatedFilePath) {
const mime = this.getMime();
if (mime && mime !== MIME_TEXT /* do not suggest when the mime type is simple plain text */) {
return suggestFilename(mime, this.getName());
if (this.cachedModel) {
const modeId = this.cachedModel.getModeId();
if (modeId !== PLAINTEXT_MODE_ID) { // do not suggest when the mode ID is simple plain text
return suggestFilename(modeId, this.getName());
}
}
}
return this.getName();
}
public getMime(): string {
if (this.cachedModel) {
return this.modeService.getMimeForMode(this.cachedModel.getModeId());
}
return null;
}
public getEncoding(): string {
if (this.cachedModel) {
return this.cachedModel.getEncoding();
@@ -147,15 +141,7 @@ export class UntitledEditorInput extends AbstractUntitledEditorInput {
private createModel(): UntitledEditorModel {
const content = '';
let mime = this.modeId;
if (!mime && this.hasAssociatedFilePath) {
const mimeFromPath = guessMimeTypes(this.resource.fsPath)[0];
if (!isUnspecific(mimeFromPath)) {
mime = mimeFromPath; // take most specific mime type if file path is associated and mime is specific
}
}
const model = this.instantiationService.createInstance(UntitledEditorModel, content, mime || MIME_TEXT, this.resource, this.hasAssociatedFilePath);
const model = this.instantiationService.createInstance(UntitledEditorModel, content, this.modeId, this.resource, this.hasAssociatedFilePath);
// re-emit some events from the model
this.toUnbind.push(model.onDidChangeDirty(() => this._onDidChangeDirty.fire()));

View File

@@ -4,19 +4,19 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {IDisposable} from 'vs/base/common/lifecycle';
import {TPromise} from 'vs/base/common/winjs.base';
import {EditorModel, IEncodingSupport} from 'vs/workbench/common/editor';
import {StringEditorModel} from 'vs/workbench/common/editor/stringEditorModel';
import { IDisposable } from 'vs/base/common/lifecycle';
import { TPromise } from 'vs/base/common/winjs.base';
import { EditorModel, IEncodingSupport } from 'vs/workbench/common/editor';
import { StringEditorModel } from 'vs/workbench/common/editor/stringEditorModel';
import URI from 'vs/base/common/uri';
import {EndOfLinePreference} from 'vs/editor/common/editorCommon';
import {IFilesConfiguration} from 'vs/platform/files/common/files';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IModeService} from 'vs/editor/common/services/modeService';
import {IModelService} from 'vs/editor/common/services/modelService';
import {IMode} from 'vs/editor/common/modes';
import {isUnspecific} from 'vs/base/common/mime';
import Event, {Emitter} from 'vs/base/common/event';
import { PLAINTEXT_MODE_ID } from 'vs/editor/common/modes/modesRegistry';
import { EndOfLinePreference } from 'vs/editor/common/editorCommon';
import { IFilesConfiguration } from 'vs/platform/files/common/files';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IModeService } from 'vs/editor/common/services/modeService';
import { IModelService } from 'vs/editor/common/services/modelService';
import { IMode } from 'vs/editor/common/modes';
import Event, { Emitter } from 'vs/base/common/event';
export class UntitledEditorModel extends StringEditorModel implements IEncodingSupport {
private textModelChangeListener: IDisposable;
@@ -33,14 +33,14 @@ export class UntitledEditorModel extends StringEditorModel implements IEncodingS
constructor(
value: string,
mime: string,
modeId: string,
resource: URI,
hasAssociatedFilePath: boolean,
@IModeService modeService: IModeService,
@IModelService modelService: IModelService,
@IConfigurationService private configurationService: IConfigurationService
) {
super(value, mime, resource, modeService, modelService);
super(value, modeId, resource, modeService, modelService);
this.hasAssociatedFilePath = hasAssociatedFilePath;
this.dirty = hasAssociatedFilePath; // untitled associated to file path are dirty right away
@@ -59,12 +59,12 @@ export class UntitledEditorModel extends StringEditorModel implements IEncodingS
return this._onDidChangeEncoding.event;
}
protected getOrCreateMode(modeService: IModeService, mime: string, firstLineText?: string): TPromise<IMode> {
if (isUnspecific(mime)) {
return modeService.getOrCreateModeByFilenameOrFirstLine(this.resource.fsPath, firstLineText); // lookup mode via resource path if the provided mime is unspecific
protected getOrCreateMode(modeService: IModeService, modeId: string, firstLineText?: string): TPromise<IMode> {
if (!modeId || modeId === PLAINTEXT_MODE_ID) {
return modeService.getOrCreateModeByFilenameOrFirstLine(this.resource.fsPath, firstLineText); // lookup mode via resource path if the provided modeId is unspecific
}
return super.getOrCreateMode(modeService, mime, firstLineText);
return super.getOrCreateMode(modeService, modeId, firstLineText);
}
private registerListeners(): void {

View File

@@ -5,7 +5,7 @@
'use strict';
import types = require('vs/base/common/types');
import {IStorageService, StorageScope} from 'vs/platform/storage/common/storage';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
/**
* Supported memento scopes.

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {IResourceInput} from 'vs/platform/editor/common/editor';
import { IResourceInput } from 'vs/platform/editor/common/editor';
export interface IOptions {

Some files were not shown because too many files have changed in this diff Show More