Merge remote-tracking branch 'upstream/master'
@@ -50,7 +50,7 @@ This project incorporates components from the projects listed below. The origina
|
||||
42. textmate/xml.tmbundle (https://github.com/textmate/xml.tmbundle)
|
||||
43. textmate/yaml.tmbundle (https://github.com/textmate/yaml.tmbundle)
|
||||
44. typescript version 1.5 (https://github.com/Microsoft/TypeScript)
|
||||
45. typescript version 1.7.5 (https://github.com/Microsoft/TypeScript)
|
||||
45. typescript version 1.8.2 (https://github.com/Microsoft/TypeScript)
|
||||
46. typescript-sublime-plugin version 0.1.8 (https://github.com/Microsoft/TypeScript-TmLanguage)
|
||||
47. unity-shader-files version 0.1.0 (https://github.com/nashella/unity-shader-files)
|
||||
48. vscode-swift version 0.0.1 (https://github.com/owensd/vscode-swift)
|
||||
|
||||
@@ -114,7 +114,7 @@ var tasks = readAllPlugins()
|
||||
.pipe(tsFilter)
|
||||
.pipe(compilation())
|
||||
.pipe(tsFilter.restore)
|
||||
.pipe(quiet ? es.through() : reporter());
|
||||
.pipe(quiet ? es.through() : reporter.end());
|
||||
|
||||
return es.duplex(input, output);
|
||||
};
|
||||
|
||||
@@ -18,7 +18,7 @@ function onEnd() {
|
||||
}
|
||||
|
||||
var errors = _.flatten(allErrors);
|
||||
errors.map(function (err) { console.log('*** Error:', err); });
|
||||
errors.map(function (err) { console.error('*** Error:', err); });
|
||||
console.log('*** Finished with', errors.length, 'errors.');
|
||||
}
|
||||
|
||||
@@ -26,17 +26,23 @@ module.exports = function () {
|
||||
var errors = [];
|
||||
allErrors.push(errors);
|
||||
|
||||
return function (err) {
|
||||
if (err) {
|
||||
errors.push(err);
|
||||
return;
|
||||
}
|
||||
var result = function (err) {
|
||||
errors.push(err);
|
||||
};
|
||||
|
||||
result.end = function (emitError) {
|
||||
errors.length = 0;
|
||||
onStart();
|
||||
return es.through(null, function () {
|
||||
onEnd();
|
||||
this.emit('end');
|
||||
|
||||
if (emitError && errors.length > 0) {
|
||||
this.emit('error', 'Errors occurred.');
|
||||
} else {
|
||||
this.emit('end');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return result;
|
||||
};
|
||||
@@ -29,27 +29,31 @@
|
||||
"format": "uri"
|
||||
},
|
||||
"module": {
|
||||
"description": "Module code generation to resolve against: 'commonjs', 'amd', 'system', or 'umd'.",
|
||||
"description": "Specify module code generation: 'CommonJS', 'Amd', 'System', 'UMD', 'es6', or 'es2015'.",
|
||||
"enum": [
|
||||
"commonjs",
|
||||
"amd",
|
||||
"umd",
|
||||
"system",
|
||||
"umd"
|
||||
"es6",
|
||||
"es2015"
|
||||
]
|
||||
},
|
||||
|
||||
"noLib": {
|
||||
"description": "Do not include the default library file (lib.d.ts).",
|
||||
"type": "boolean"
|
||||
},
|
||||
"target": {
|
||||
"description": "Specify ECMAScript target version: 'ES3', 'ES5', or 'ES6' (default).",
|
||||
"description": "Specify ECMAScript target version.",
|
||||
"enum": [
|
||||
"ES3",
|
||||
"ES5",
|
||||
"ES6",
|
||||
"es3",
|
||||
"es5",
|
||||
"es6"
|
||||
"es6",
|
||||
"es2015"
|
||||
],
|
||||
"default": "ES6"
|
||||
},
|
||||
|
||||
@@ -417,9 +417,9 @@ export class StringASTNode extends ASTNode {
|
||||
public value: string;
|
||||
|
||||
constructor(parent: ASTNode, name: string, isKey: boolean, start: number, end?: number) {
|
||||
super(parent, 'string', name, start, end);
|
||||
this.isKey = isKey;
|
||||
this.value = '';
|
||||
super(parent, 'string', name, start, end);
|
||||
}
|
||||
|
||||
public getValue(): any {
|
||||
|
||||
@@ -192,7 +192,7 @@
|
||||
},
|
||||
{
|
||||
"name": "typescript",
|
||||
"version": "1.8.0",
|
||||
"version": "1.8.2",
|
||||
"license": "Apache2",
|
||||
"repositoryURL": "https://github.com/Microsoft/TypeScript",
|
||||
"description": "The contents of the folder lib is from the TypeScript project https://github.com/Microsoft/TypeScript.",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"name": "Microsoft Corp."
|
||||
},
|
||||
"homepage": "http://typescriptlang.org/",
|
||||
"version": "1.8.0",
|
||||
"version": "1.8.2",
|
||||
"license": "Apache-2.0",
|
||||
"description": "TypeScript is a language for application scale JavaScript development",
|
||||
"keywords": [
|
||||
@@ -19,7 +19,7 @@
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Microsoft/TypeScript.git"
|
||||
"url": "https://github.com/Microsoft/TypeScript.git"
|
||||
},
|
||||
"main": "./lib/typescript.js",
|
||||
"typings": "./lib/typescript.d.ts",
|
||||
@@ -58,10 +58,10 @@
|
||||
"os": false,
|
||||
"path": false
|
||||
},
|
||||
"gitHead": "a288b84632c1400806df55025ca6b568cfa4d00e",
|
||||
"_id": "typescript@1.8.0",
|
||||
"_shasum": "cc5bc63d7f7d84ea26debd7adb774c0362b0ec11",
|
||||
"_from": "typescript@1.8.0",
|
||||
"gitHead": "e5dd34f9e69f517182abfc996a10b8312b14e015",
|
||||
"_id": "typescript@1.8.2",
|
||||
"_shasum": "4d2ad7db172be67a913d09862b510133bad61b33",
|
||||
"_from": "typescript@latest",
|
||||
"_npmVersion": "2.0.0",
|
||||
"_npmUser": {
|
||||
"name": "typescript",
|
||||
@@ -74,10 +74,9 @@
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "cc5bc63d7f7d84ea26debd7adb774c0362b0ec11",
|
||||
"tarball": "http://registry.npmjs.org/typescript/-/typescript-1.8.0.tgz"
|
||||
"shasum": "4d2ad7db172be67a913d09862b510133bad61b33",
|
||||
"tarball": "http://registry.npmjs.org/typescript/-/typescript-1.8.2.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/typescript/-/typescript-1.8.0.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
"_resolved": "https://registry.npmjs.org/typescript/-/typescript-1.8.2.tgz"
|
||||
}
|
||||
|
||||
@@ -39,11 +39,13 @@ var tsOptions = {
|
||||
sourceRoot: util.toFileUri(rootDir)
|
||||
};
|
||||
|
||||
function createCompile(build) {
|
||||
function createCompile(build, emitError) {
|
||||
var opts = _.clone(tsOptions);
|
||||
opts.inlineSources = !!build;
|
||||
|
||||
var ts = tsb.create(opts, null, null, quiet ? null : function (err) { reporter(err.toString()); });
|
||||
var ts = tsb.create(opts, null, null, quiet ? null : function (err) {
|
||||
reporter(err.toString());
|
||||
});
|
||||
|
||||
return function (token) {
|
||||
var utf8Filter = filter('**/test/**/*utf8*', { restore: true });
|
||||
@@ -67,14 +69,14 @@ function createCompile(build) {
|
||||
sourceRoot: tsOptions.sourceRoot
|
||||
}))
|
||||
.pipe(tsFilter.restore)
|
||||
.pipe(quiet ? es.through() : reporter());
|
||||
.pipe(quiet ? es.through() : reporter.end(emitError));
|
||||
|
||||
return es.duplex(input, output);
|
||||
};
|
||||
}
|
||||
|
||||
function compileTask(out, build) {
|
||||
var compile = createCompile(build);
|
||||
var compile = createCompile(build, true);
|
||||
|
||||
return function () {
|
||||
var src = gulp.src('src/**', { base: 'src' });
|
||||
|
||||
@@ -269,12 +269,8 @@ export class Configuration extends CommonEditorConfiguration {
|
||||
}
|
||||
}
|
||||
|
||||
private _elementSizeObserver: ElementSizeObserver;
|
||||
|
||||
constructor(options:any, referenceDomElement:HTMLElement = null, indentationGuesser:(tabSize:number)=>IGuessedIndentation = null) {
|
||||
this._elementSizeObserver = new ElementSizeObserver(referenceDomElement, () => this._onReferenceDomElementSizeChanged());
|
||||
|
||||
super(options, indentationGuesser);
|
||||
super(options, new ElementSizeObserver(referenceDomElement, () => this._onReferenceDomElementSizeChanged()), indentationGuesser);
|
||||
|
||||
this._register(CSSBasedConfiguration.INSTANCE.onDidChange(() => () => this._onCSSBasedConfigurationChanged()));
|
||||
|
||||
|
||||
@@ -6,8 +6,9 @@
|
||||
|
||||
import {Disposable} from 'vs/base/common/lifecycle';
|
||||
import {IDimension} from 'vs/editor/common/editorCommon';
|
||||
import {IElementSizeObserver} from 'vs/editor/common/config/commonEditorConfig';
|
||||
|
||||
export class ElementSizeObserver extends Disposable {
|
||||
export class ElementSizeObserver extends Disposable implements IElementSizeObserver {
|
||||
|
||||
private referenceDomElement:HTMLElement;
|
||||
private measureReferenceDomElementToken:number;
|
||||
|
||||
@@ -216,9 +216,12 @@ export class StandaloneKeybindingService extends KeybindingService {
|
||||
private _dynamicCommands: ICommandsMap;
|
||||
|
||||
constructor(domNode: HTMLElement) {
|
||||
super();
|
||||
|
||||
this._dynamicKeybindings = [];
|
||||
this._dynamicCommands = Object.create(null);
|
||||
super(domNode);
|
||||
|
||||
this._beginListening(domNode);
|
||||
}
|
||||
|
||||
public addDynamicKeybinding(keybinding: number, handler:ICommandHandler, context:string, commandId:string = null): string {
|
||||
|
||||
@@ -40,6 +40,7 @@ import {DiffEditorWidget} from 'vs/editor/browser/widget/diffEditorWidget';
|
||||
|
||||
// Set defaults for standalone editor
|
||||
DefaultConfig.editor.wrappingIndent = 'none';
|
||||
DefaultConfig.editor.folding = false;
|
||||
|
||||
export interface IEditorConstructionOptions extends ICodeEditorWidgetCreationOptions {
|
||||
value?: string;
|
||||
@@ -73,6 +74,9 @@ class StandaloneEditor extends CodeEditorWidget {
|
||||
(<AbstractKeybindingService><any>keybindingService).setInstantiationService(instantiationService);
|
||||
}
|
||||
|
||||
options = options || {};
|
||||
super(domElement, options, instantiationService, codeEditorService, keybindingService, telemetryService);
|
||||
|
||||
if (keybindingService instanceof StandaloneKeybindingService) {
|
||||
this._standaloneKeybindingService = <StandaloneKeybindingService>keybindingService;
|
||||
}
|
||||
@@ -82,15 +86,17 @@ class StandaloneEditor extends CodeEditorWidget {
|
||||
this._markerService = markerService;
|
||||
this._toDispose2 = toDispose;
|
||||
|
||||
options = options || {};
|
||||
let model: IModel = null;
|
||||
if (typeof options.model === 'undefined') {
|
||||
options.model = (<any>self).Monaco.Editor.createModel(options.value || '', options.mode || 'text/plain');
|
||||
model = (<any>self).Monaco.Editor.createModel(options.value || '', options.mode || 'text/plain');
|
||||
this._ownsModel = true;
|
||||
} else {
|
||||
model = options.model;
|
||||
delete options.model;
|
||||
this._ownsModel = false;
|
||||
}
|
||||
|
||||
super(domElement, options, instantiationService, codeEditorService, keybindingService, telemetryService);
|
||||
this._attachModel(model);
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
@@ -164,7 +170,6 @@ class StandaloneEditor extends CodeEditorWidget {
|
||||
|
||||
class StandaloneDiffEditor extends DiffEditorWidget {
|
||||
|
||||
private _editorService:IEditorService;
|
||||
private _contextViewService:IEditorContextViewService;
|
||||
private _standaloneKeybindingService: StandaloneKeybindingService;
|
||||
private _toDispose2: IDisposable[];
|
||||
@@ -187,21 +192,19 @@ class StandaloneDiffEditor extends DiffEditorWidget {
|
||||
(<AbstractKeybindingService><any>keybindingService).setInstantiationService(instantiationService);
|
||||
}
|
||||
|
||||
super(domElement, options, editorWorkerService, instantiationService);
|
||||
|
||||
if (keybindingService instanceof StandaloneKeybindingService) {
|
||||
this._standaloneKeybindingService = <StandaloneKeybindingService>keybindingService;
|
||||
}
|
||||
|
||||
this._contextViewService = <IEditorContextViewService>contextViewService;
|
||||
this._editorService = editorService;
|
||||
|
||||
this._markerService = markerService;
|
||||
this._telemetryService = telemetryService;
|
||||
|
||||
this._toDispose2 = toDispose;
|
||||
|
||||
options = options || {};
|
||||
|
||||
super(domElement, options, editorWorkerService, instantiationService);
|
||||
|
||||
this._contextViewService.setContainer(this._containerDomElement);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,14 +41,12 @@ export class CodeEditorWidget extends CommonCodeEditor implements editorBrowser.
|
||||
|
||||
constructor(
|
||||
domElement:HTMLElement,
|
||||
options:editorCommon.ICodeEditorWidgetCreationOptions,
|
||||
options:editorCommon.IEditorOptions,
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@ICodeEditorService codeEditorService: ICodeEditorService,
|
||||
@IKeybindingService keybindingService: IKeybindingService,
|
||||
@ITelemetryService telemetryService: ITelemetryService
|
||||
) {
|
||||
this.domElement = domElement;
|
||||
|
||||
super(domElement, options, instantiationService, codeEditorService, keybindingService, telemetryService);
|
||||
|
||||
// track focus of the domElement and all its anchestors
|
||||
|
||||
@@ -71,7 +71,7 @@ export abstract class CommonCodeEditor extends EventEmitter implements IActionPr
|
||||
|
||||
constructor(
|
||||
domElement: IKeybindingScopeLocation,
|
||||
options:editorCommon.ICodeEditorWidgetCreationOptions,
|
||||
options:editorCommon.IEditorOptions,
|
||||
instantiationService: IInstantiationService,
|
||||
codeEditorService: ICodeEditorService,
|
||||
keybindingService: IKeybindingService,
|
||||
@@ -100,12 +100,6 @@ export abstract class CommonCodeEditor extends EventEmitter implements IActionPr
|
||||
this._decorationTypeKeysToIds = {};
|
||||
|
||||
options = options || {};
|
||||
var model: editorCommon.IModel = null;
|
||||
if (options.model) {
|
||||
model = options.model;
|
||||
delete options.model;
|
||||
}
|
||||
|
||||
if (typeof options.ariaLabel === 'undefined') {
|
||||
options.ariaLabel = DefaultConfig.editor.ariaLabel;
|
||||
}
|
||||
@@ -129,7 +123,7 @@ export abstract class CommonCodeEditor extends EventEmitter implements IActionPr
|
||||
keybindingService: this._keybindingService
|
||||
});
|
||||
|
||||
this._attachModel(model);
|
||||
this._attachModel(null);
|
||||
|
||||
// Create editor contributions
|
||||
this.contributions = {};
|
||||
|
||||
@@ -550,6 +550,14 @@ export interface IIndentationGuesser {
|
||||
(tabSize:number): editorCommon.IGuessedIndentation;
|
||||
}
|
||||
|
||||
export interface IElementSizeObserver {
|
||||
startObserving(): void;
|
||||
observe(dimension?:editorCommon.IDimension): void;
|
||||
dispose(): void;
|
||||
getWidth(): number;
|
||||
getHeight(): number;
|
||||
}
|
||||
|
||||
export abstract class CommonEditorConfiguration extends Disposable implements editorCommon.IConfiguration {
|
||||
|
||||
public handlerDispatcher:editorCommon.IHandlerDispatcher;
|
||||
@@ -557,6 +565,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
|
||||
public editorClone:editorCommon.IInternalEditorOptions;
|
||||
|
||||
protected _configWithDefaults:ConfigurationWithDefaults;
|
||||
protected _elementSizeObserver: IElementSizeObserver;
|
||||
private _indentationGuesser:IIndentationGuesser;
|
||||
private _cachedGuessedIndentationTabSize: number;
|
||||
private _cachedGuessedIndentation:editorCommon.IGuessedIndentation;
|
||||
@@ -566,9 +575,10 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
|
||||
private _onDidChange = this._register(new Emitter<editorCommon.IConfigurationChangedEvent>());
|
||||
public onDidChange: Event<editorCommon.IConfigurationChangedEvent> = this._onDidChange.event;
|
||||
|
||||
constructor(options:any, indentationGuesser:IIndentationGuesser = null) {
|
||||
constructor(options:any, elementSizeObserver: IElementSizeObserver = null, indentationGuesser:IIndentationGuesser = null) {
|
||||
super();
|
||||
this._configWithDefaults = new ConfigurationWithDefaults(options);
|
||||
this._elementSizeObserver = elementSizeObserver;
|
||||
this._indentationGuesser = indentationGuesser;
|
||||
this._cachedGuessedIndentationTabSize = -1;
|
||||
this._cachedGuessedIndentation = null;
|
||||
|
||||
@@ -14,11 +14,11 @@ export class Selection extends Range implements IEditorSelection {
|
||||
public positionColumn: number;
|
||||
|
||||
constructor(selectionStartLineNumber: number, selectionStartColumn: number, positionLineNumber: number, positionColumn: number) {
|
||||
super(selectionStartLineNumber, selectionStartColumn, positionLineNumber, positionColumn);
|
||||
this.selectionStartLineNumber = selectionStartLineNumber;
|
||||
this.selectionStartColumn = selectionStartColumn;
|
||||
this.positionLineNumber = positionLineNumber;
|
||||
this.positionColumn = positionColumn;
|
||||
super(selectionStartLineNumber, selectionStartColumn, positionLineNumber, positionColumn);
|
||||
}
|
||||
|
||||
public clone(): IEditorSelection {
|
||||
|
||||
@@ -95,8 +95,8 @@ class LineMarkerSequence extends MarkerSequence {
|
||||
endColumn = lines[i].length + 1;
|
||||
|
||||
if (shouldIgnoreTrimWhitespace) {
|
||||
startColumn = this._getFirstNonBlankColumn(lines[i], 1);
|
||||
endColumn = this._getLastNonBlankColumn(lines[i], 1);
|
||||
startColumn = LineMarkerSequence._getFirstNonBlankColumn(lines[i], 1);
|
||||
endColumn = LineMarkerSequence._getLastNonBlankColumn(lines[i], 1);
|
||||
}
|
||||
|
||||
startMarkers.push({
|
||||
@@ -117,7 +117,7 @@ class LineMarkerSequence extends MarkerSequence {
|
||||
super(buffer, startMarkers, endMarkers);
|
||||
}
|
||||
|
||||
private _getFirstNonBlankColumn(txt:string, defaultValue:number): number {
|
||||
private static _getFirstNonBlankColumn(txt:string, defaultValue:number): number {
|
||||
var r = strings.firstNonWhitespaceIndex(txt);
|
||||
if (r === -1) {
|
||||
return defaultValue;
|
||||
@@ -125,7 +125,7 @@ class LineMarkerSequence extends MarkerSequence {
|
||||
return r + 1;
|
||||
}
|
||||
|
||||
private _getLastNonBlankColumn(txt:string, defaultValue:number): number {
|
||||
private static _getLastNonBlankColumn(txt:string, defaultValue:number): number {
|
||||
var r = strings.lastNonWhitespaceIndex(txt);
|
||||
if (r === -1) {
|
||||
return defaultValue;
|
||||
|
||||
@@ -49,6 +49,12 @@ export class EditorModesRegistry {
|
||||
this._workerParticipants = participants;
|
||||
}
|
||||
public registerWorkerParticipant(modeId:string, moduleId:string, ctorName?:string):void {
|
||||
if (typeof modeId !== 'string') {
|
||||
throw new Error('InvalidArgument: expected `modeId` to be a string');
|
||||
}
|
||||
if (typeof moduleId !== 'string') {
|
||||
throw new Error('InvalidArgument: expected `moduleId` to be a string');
|
||||
}
|
||||
this._workerParticipants.push({
|
||||
modeId: modeId,
|
||||
moduleId: moduleId,
|
||||
|
||||
@@ -10,7 +10,7 @@ import {ServiceIdentifier, createDecorator} from 'vs/platform/instantiation/comm
|
||||
import {IChange, ILineChange, IPosition, IRange} from 'vs/editor/common/editorCommon';
|
||||
import {IInplaceReplaceSupportResult, ILink, ISuggestResult} from 'vs/editor/common/modes';
|
||||
|
||||
export var ID_EDITOR_WORKER_SERVICE = 'workerService';
|
||||
export var ID_EDITOR_WORKER_SERVICE = 'editorWorkerService';
|
||||
export var IEditorWorkerService = createDecorator<IEditorWorkerService>(ID_EDITOR_WORKER_SERVICE);
|
||||
|
||||
export interface IEditorWorkerService {
|
||||
|
||||
@@ -39,6 +39,10 @@ export class FindDecorations implements IDisposable {
|
||||
this._highlightedDecorationId = null;
|
||||
}
|
||||
|
||||
public getCount(): number {
|
||||
return this._decorations.length;
|
||||
}
|
||||
|
||||
public getFindScope(): editorCommon.IEditorRange {
|
||||
if (this._findScopeDecorationId) {
|
||||
return this._editor.getModel().getDecorationRange(this._findScopeDecorationId);
|
||||
@@ -55,6 +59,16 @@ export class FindDecorations implements IDisposable {
|
||||
this.setCurrentFindMatch(null);
|
||||
}
|
||||
|
||||
public getCurrentMatchesPosition(desiredRange:editorCommon.IEditorRange): number {
|
||||
for (let i = 0, len = this._decorations.length; i < len; i++) {
|
||||
let range = this._editor.getModel().getDecorationRange(this._decorations[i]);
|
||||
if (desiredRange.equalsRange(range)) {
|
||||
return (i + 1);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public setCurrentFindMatch(nextMatch:editorCommon.IEditorRange): number {
|
||||
let newCurrentDecorationId: string = null;
|
||||
let matchPosition = 0;
|
||||
|
||||
@@ -124,7 +124,7 @@ export class FindModelBoundToEditorModel {
|
||||
let findMatches = this._findMatches(findScope, MATCHES_LIMIT);
|
||||
this._decorations.set(findMatches, findScope);
|
||||
|
||||
this._state.change({ matchesCount: findMatches.length }, false);
|
||||
this._state.changeMatchInfo(this._decorations.getCurrentMatchesPosition(this._editor.getSelection()), this._decorations.getCount());
|
||||
|
||||
if (moveCursor) {
|
||||
this._moveToNextMatch(this._decorations.getStartPosition());
|
||||
@@ -205,7 +205,7 @@ export class FindModelBoundToEditorModel {
|
||||
}
|
||||
|
||||
let matchesPosition = this._decorations.setCurrentFindMatch(prevMatch);
|
||||
this._state.change({ matchesPosition: matchesPosition }, false);
|
||||
this._state.changeMatchInfo(matchesPosition, this._decorations.getCount());
|
||||
this._editor.setSelection(prevMatch);
|
||||
this._editor.revealRangeInCenterIfOutsideViewport(prevMatch);
|
||||
}
|
||||
@@ -273,7 +273,7 @@ export class FindModelBoundToEditorModel {
|
||||
}
|
||||
|
||||
let matchesPosition = this._decorations.setCurrentFindMatch(nextMatch);
|
||||
this._state.change({ matchesPosition: matchesPosition }, false);
|
||||
this._state.changeMatchInfo(matchesPosition, this._decorations.getCount());
|
||||
this._editor.setSelection(nextMatch);
|
||||
this._editor.revealRangeInCenterIfOutsideViewport(nextMatch);
|
||||
}
|
||||
@@ -340,6 +340,7 @@ export class FindModelBoundToEditorModel {
|
||||
let ranges = this._findMatches(findScope, Number.MAX_VALUE);
|
||||
|
||||
this._decorations.set([], findScope);
|
||||
this._state.changeMatchInfo(0, 0);
|
||||
|
||||
let replaceStrings:string[] = [];
|
||||
for (let i = 0, len = ranges.length; i < len; i++) {
|
||||
|
||||
@@ -33,8 +33,8 @@ export interface INewFindReplaceState {
|
||||
wholeWord?: boolean;
|
||||
matchCase?: boolean;
|
||||
searchScope?: IEditorRange;
|
||||
matchesPosition?: number;
|
||||
matchesCount?: number;
|
||||
// matchesPosition?: number;
|
||||
// matchesCount?: number;
|
||||
}
|
||||
|
||||
export class FindReplaceState implements IDisposable {
|
||||
@@ -86,6 +86,45 @@ export class FindReplaceState implements IDisposable {
|
||||
return this._eventEmitter.addListener2(FindReplaceState._CHANGED_EVENT, listener);
|
||||
}
|
||||
|
||||
public changeMatchInfo(matchesPosition:number, matchesCount:number): void {
|
||||
let changeEvent:FindReplaceStateChangedEvent = {
|
||||
moveCursor: false,
|
||||
searchString: false,
|
||||
replaceString: false,
|
||||
isRevealed: false,
|
||||
isReplaceRevealed: false,
|
||||
isRegex: false,
|
||||
wholeWord: false,
|
||||
matchCase: false,
|
||||
searchScope: false,
|
||||
matchesPosition: false,
|
||||
matchesCount: false
|
||||
};
|
||||
let somethingChanged = false;
|
||||
|
||||
if (matchesCount === 0) {
|
||||
matchesPosition = 0;
|
||||
}
|
||||
if (matchesPosition > matchesCount) {
|
||||
matchesPosition = matchesCount;
|
||||
}
|
||||
|
||||
if (this._matchesPosition !== matchesPosition) {
|
||||
this._matchesPosition = matchesPosition;
|
||||
changeEvent.matchesPosition = true;
|
||||
somethingChanged = true;
|
||||
}
|
||||
if (this._matchesCount !== matchesCount) {
|
||||
this._matchesCount = matchesCount;
|
||||
changeEvent.matchesCount = true;
|
||||
somethingChanged = true;
|
||||
}
|
||||
|
||||
if (somethingChanged) {
|
||||
this._eventEmitter.emit(FindReplaceState._CHANGED_EVENT, changeEvent);
|
||||
}
|
||||
}
|
||||
|
||||
public change(newState:INewFindReplaceState, moveCursor:boolean): void {
|
||||
let changeEvent:FindReplaceStateChangedEvent = {
|
||||
moveCursor: moveCursor,
|
||||
@@ -158,29 +197,6 @@ export class FindReplaceState implements IDisposable {
|
||||
somethingChanged = true;
|
||||
}
|
||||
}
|
||||
if (typeof newState.matchesPosition !== 'undefined') {
|
||||
if (this._matchesPosition !== newState.matchesPosition) {
|
||||
this._matchesPosition = newState.matchesPosition;
|
||||
changeEvent.matchesPosition = true;
|
||||
somethingChanged = true;
|
||||
}
|
||||
}
|
||||
if (typeof newState.matchesCount !== 'undefined') {
|
||||
if (this._matchesCount !== newState.matchesCount) {
|
||||
this._matchesCount = newState.matchesCount;
|
||||
changeEvent.matchesCount = true;
|
||||
somethingChanged = true;
|
||||
|
||||
if (this._matchesCount === 0) {
|
||||
this._matchesPosition = 0;
|
||||
changeEvent.matchesPosition = true;
|
||||
} else if (this._matchesPosition > this._matchesCount) {
|
||||
this._matchesPosition = this._matchesCount;
|
||||
changeEvent.matchesPosition = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (somethingChanged) {
|
||||
this._eventEmitter.emit(FindReplaceState._CHANGED_EVENT, changeEvent);
|
||||
|
||||
@@ -1 +1,10 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#7A7A7A" d="M6 4v8l4-4-4-4zm1 2.414l1.586 1.586-1.586 1.586v-3.172z"/></svg>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#FFFFFF;}
|
||||
</style>
|
||||
<path class="st0" d="M2,2v12h12V2H2z M13,13H3V3h10V13z"/>
|
||||
<path id="XMLID_5_" class="st0" d="M12,9H9v3H7V9H4V7h3V4h2v3h3V9z"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 151 B After Width: | Height: | Size: 533 B |
@@ -1 +1,10 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#646465" d="M6 4v8l4-4-4-4zm1 2.414l1.586 1.586-1.586 1.586v-3.172z"/></svg>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.icon_x002D_vso_x002D_bg{fill:#656565;}
|
||||
</style>
|
||||
<path class="icon_x002D_vso_x002D_bg" d="M2,2v12h12V2H2z M13,13H3V3h10V13z"/>
|
||||
<path id="XMLID_5_" d="M12,9H9v3H7V9H4V7h3V4h2v3h3V9z"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 151 B After Width: | Height: | Size: 561 B |
@@ -1 +1,10 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#7A7A7A" d="M11 10.07h-5.656l5.656-5.656v5.656z"/></svg>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#FFFFFF;}
|
||||
</style>
|
||||
<path class="st0" d="M2,2v12h12V2H2z M13,13H3V3h10V13z"/>
|
||||
<path id="XMLID_5_" class="st0" d="M12,9H4V7h8V9z"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 517 B |
@@ -1 +1,10 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#646465" d="M11 10.07h-5.656l5.656-5.656v5.656z"/></svg>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.icon_x002D_vso_x002D_bg{fill:#656565;}
|
||||
</style>
|
||||
<path class="icon_x002D_vso_x002D_bg" d="M2,2v12h12V2H2z M13,13H3V3h10V13z"/>
|
||||
<path id="XMLID_5_" d="M12,9H4V7h8V9z"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 545 B |
@@ -28,6 +28,15 @@
|
||||
background-image: url('arrow-collapse-dark.svg');
|
||||
}
|
||||
|
||||
/* High-contrast theme */
|
||||
.monaco-editor.hc-black .margin-view-overlays:hover .folding {
|
||||
background-image: url('arrow-expand-dark.svg');
|
||||
}
|
||||
|
||||
.monaco-editor.hc-black .margin-view-overlays .folding.collapsed {
|
||||
background-image: url('arrow-collapse-dark.svg');
|
||||
}
|
||||
|
||||
.monaco-editor .inline-folded:after {
|
||||
color: grey;
|
||||
margin: 0.1em 0.2em 0 0.2em;
|
||||
|
||||
@@ -145,7 +145,6 @@ export class FoldingController implements editorCommon.IEditorContribution {
|
||||
this.computeToken = 0;
|
||||
|
||||
this.globalToDispose.push(this.editor.addListener2(editorCommon.EventType.ModelChanged, () => this.onModelChanged()));
|
||||
this.globalToDispose.push(this.editor.addListener2(editorCommon.EventType.ModelModeChanged, () => this.onModelChanged()));
|
||||
this.globalToDispose.push(this.editor.addListener2(editorCommon.EventType.ConfigurationChanged, (e: editorCommon.IConfigurationChangedEvent) => {
|
||||
if (e.folding) {
|
||||
this.onModelChanged();
|
||||
@@ -478,11 +477,11 @@ CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(FoldAction,
|
||||
context: ContextKey.EditorFocus,
|
||||
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_OPEN_SQUARE_BRACKET
|
||||
}));
|
||||
CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(FoldAllAction, UnfoldAllAction.ID, nls.localize('foldAllAction.label', "Fold All"), {
|
||||
CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(FoldAllAction, FoldAllAction.ID, nls.localize('foldAllAction.label', "Fold All"), {
|
||||
context: ContextKey.EditorFocus,
|
||||
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.US_OPEN_SQUARE_BRACKET
|
||||
}));
|
||||
CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(UnfoldAllAction, FoldAllAction.ID, nls.localize('unfoldAllAction.label', "Unfold All"), {
|
||||
CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(UnfoldAllAction, UnfoldAllAction.ID, nls.localize('unfoldAllAction.label', "Unfold All"), {
|
||||
context: ContextKey.EditorFocus,
|
||||
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.US_CLOSE_SQUARE_BRACKET
|
||||
}));
|
||||
@@ -143,17 +143,16 @@ export class GoToTypeDeclarationActions extends GoToTypeAction {
|
||||
}
|
||||
}
|
||||
|
||||
export class GoToDeclarationAction extends GoToTypeAction {
|
||||
|
||||
public static ID = 'editor.action.goToDeclaration';
|
||||
export abstract class BaseGoToDeclarationAction extends GoToTypeAction {
|
||||
|
||||
constructor(
|
||||
descriptor: editorCommon.IEditorActionDescriptorData,
|
||||
editor: editorCommon.ICommonCodeEditor,
|
||||
@IMessageService messageService: IMessageService,
|
||||
@IEditorService editorService: IEditorService
|
||||
messageService: IMessageService,
|
||||
editorService: IEditorService,
|
||||
condition: Behaviour
|
||||
) {
|
||||
super(descriptor, editor, messageService, editorService, this.behaviour);
|
||||
super(descriptor, editor, messageService, editorService, condition);
|
||||
}
|
||||
|
||||
public getGroupId(): string {
|
||||
@@ -179,16 +178,27 @@ export class GoToDeclarationAction extends GoToTypeAction {
|
||||
});
|
||||
}
|
||||
|
||||
protected get behaviour(): Behaviour {
|
||||
return DEFAULT_BEHAVIOR;
|
||||
}
|
||||
|
||||
protected _resolve(resource: URI, position: editorCommon.IPosition): TPromise<IReference[]> {
|
||||
return getDeclarationsAtPosition(this.editor.getModel(), this.editor.getPosition());
|
||||
}
|
||||
}
|
||||
|
||||
export class OpenDeclarationToTheSideAction extends GoToDeclarationAction {
|
||||
export class GoToDeclarationAction extends BaseGoToDeclarationAction {
|
||||
|
||||
public static ID = 'editor.action.goToDeclaration';
|
||||
|
||||
constructor(
|
||||
descriptor: editorCommon.IEditorActionDescriptorData,
|
||||
editor: editorCommon.ICommonCodeEditor,
|
||||
@IMessageService messageService: IMessageService,
|
||||
@IEditorService editorService: IEditorService
|
||||
) {
|
||||
super(descriptor, editor, messageService, editorService, DEFAULT_BEHAVIOR);
|
||||
}
|
||||
}
|
||||
|
||||
export class OpenDeclarationToTheSideAction extends BaseGoToDeclarationAction {
|
||||
|
||||
public static ID = 'editor.action.openDeclarationToTheSide';
|
||||
|
||||
@@ -198,11 +208,7 @@ export class OpenDeclarationToTheSideAction extends GoToDeclarationAction {
|
||||
@IMessageService messageService: IMessageService,
|
||||
@IEditorService editorService: IEditorService
|
||||
) {
|
||||
super(descriptor, editor, messageService, editorService);
|
||||
}
|
||||
|
||||
protected get behaviour(): Behaviour {
|
||||
return Behaviour.WidgetFocus | Behaviour.UpdateOnCursorPositionChange;
|
||||
super(descriptor, editor, messageService, editorService, Behaviour.WidgetFocus | Behaviour.UpdateOnCursorPositionChange);
|
||||
}
|
||||
|
||||
protected get openToTheSide(): boolean {
|
||||
@@ -210,7 +216,7 @@ export class OpenDeclarationToTheSideAction extends GoToDeclarationAction {
|
||||
}
|
||||
}
|
||||
|
||||
export class PreviewDeclarationAction extends GoToDeclarationAction {
|
||||
export class PreviewDeclarationAction extends BaseGoToDeclarationAction {
|
||||
|
||||
public static ID = 'editor.action.previewDeclaration';
|
||||
|
||||
@@ -220,7 +226,7 @@ export class PreviewDeclarationAction extends GoToDeclarationAction {
|
||||
@IMessageService messageService: IMessageService,
|
||||
@IEditorService editorService: IEditorService
|
||||
) {
|
||||
super(descriptor, editor, messageService, editorService);
|
||||
super(descriptor, editor, messageService, editorService, DEFAULT_BEHAVIOR);
|
||||
}
|
||||
|
||||
protected _showSingleReferenceInPeek() {
|
||||
|
||||
@@ -10,6 +10,7 @@ import {EditorAction} from 'vs/editor/common/editorAction';
|
||||
import {ICommonCodeEditor, IEditorActionDescriptorData} from 'vs/editor/common/editorCommon';
|
||||
import {CommonEditorRegistry, EditorActionDescriptor} from 'vs/editor/common/editorCommonExtensions';
|
||||
import {IndentationToSpacesCommand, IndentationToTabsCommand} from 'vs/editor/contrib/indentation/common/indentationCommands';
|
||||
import {IQuickOpenService} from 'vs/workbench/services/quickopen/common/quickOpenService';
|
||||
|
||||
export class IndentationToSpacesAction extends EditorAction {
|
||||
static ID = 'editor.action.indentationToSpaces';
|
||||
@@ -22,7 +23,7 @@ export class IndentationToSpacesAction extends EditorAction {
|
||||
|
||||
const command = new IndentationToSpacesCommand(this.editor.getSelection(), this.editor.getIndentationOptions().tabSize);
|
||||
this.editor.executeCommands(this.id, [command]);
|
||||
|
||||
|
||||
return TPromise.as(true);
|
||||
}
|
||||
}
|
||||
@@ -43,6 +44,43 @@ export class IndentationToTabsAction extends EditorAction {
|
||||
}
|
||||
}
|
||||
|
||||
export abstract class Indent extends EditorAction {
|
||||
|
||||
constructor(descriptor: IEditorActionDescriptorData, editor: ICommonCodeEditor, private insertSpaces: boolean, private quickOpenService: IQuickOpenService) {
|
||||
super(descriptor, editor);
|
||||
}
|
||||
|
||||
public run(): TPromise<boolean> {
|
||||
return TPromise.timeout(50 /* quick open is sensitive to being opened so soon after another */).then(() =>
|
||||
this.quickOpenService.pick(['1', '2', '3', '4', '5', '6', '7', '8'], { placeHolder: nls.localize('selectTabWidth', "Select Tab Width")}).then(pick => {
|
||||
this.editor.updateOptions({
|
||||
insertSpaces: this.insertSpaces,
|
||||
tabSize: parseInt(pick)
|
||||
});
|
||||
return true;
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class IndentUsingSpaces extends Indent {
|
||||
static ID = 'editor.action.indentUsingSpaces';
|
||||
|
||||
constructor(descriptor: IEditorActionDescriptorData, editor: ICommonCodeEditor, @IQuickOpenService quickOpenService: IQuickOpenService) {
|
||||
super(descriptor, editor, true, quickOpenService);
|
||||
}
|
||||
}
|
||||
|
||||
export class IndentUsingTabs extends Indent {
|
||||
static ID = 'editor.action.indentUsingTabs';
|
||||
|
||||
constructor(descriptor: IEditorActionDescriptorData, editor: ICommonCodeEditor, @IQuickOpenService quickOpenService: IQuickOpenService) {
|
||||
super(descriptor, editor, false, quickOpenService);
|
||||
}
|
||||
}
|
||||
|
||||
// register actions
|
||||
CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(IndentationToSpacesAction, IndentationToSpacesAction.ID, nls.localize('indentationToSpaces', "Convert Indentation to Spaces")));
|
||||
CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(IndentationToTabsAction, IndentationToTabsAction.ID, nls.localize('indentationToTabs', "Convert Indentation to Tabs")));
|
||||
CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(IndentUsingSpaces, IndentUsingSpaces.ID, nls.localize('indentUsingSpaces', "Indent Using Spaces")));
|
||||
CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(IndentUsingTabs, IndentUsingTabs.ID, nls.localize('indentUsingTabs', "Indent Using Tabs")));
|
||||
|
||||
@@ -277,8 +277,8 @@ export class NMode extends TestingMode {
|
||||
public tokenizationSupport: modes.ITokenizationSupport;
|
||||
|
||||
constructor(n:number) {
|
||||
this.n = n;
|
||||
super();
|
||||
this.n = n;
|
||||
this.tokenizationSupport = new TokenizationSupport(this, {
|
||||
getInitialState: () => new NState(this, this.n)
|
||||
}, false, false);
|
||||
|
||||
@@ -419,9 +419,9 @@ export class StringASTNode extends ASTNode {
|
||||
public value:string;
|
||||
|
||||
constructor(parent:ASTNode, name:string, isKey:boolean, start:number, end?:number) {
|
||||
super(parent, 'string', name, start, end);
|
||||
this.isKey = isKey;
|
||||
this.value = '';
|
||||
super(parent, 'string', name, start, end);
|
||||
}
|
||||
|
||||
public getValue():any {
|
||||
|
||||
@@ -68,6 +68,8 @@ export class TypeScriptWorker2 {
|
||||
this._disposables.push(this.resourceService.addListener2_(ResourceEvents.REMOVED, this._onResourceRemoved.bind(this)));
|
||||
this.resourceService.all()
|
||||
.forEach(element => this._onResourceAdded({ url: element.getAssociatedResource(), addedElement: element }));
|
||||
|
||||
this._doConfigure(null);
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
|
||||
@@ -201,6 +201,9 @@ export class AsyncDescriptor<T> extends AbstractDescriptor<T> implements objects
|
||||
|
||||
constructor(private _moduleName: string, private _ctorName?: string, ...staticArguments: any[]) {
|
||||
super(staticArguments);
|
||||
if (typeof _moduleName !== 'string') {
|
||||
throw new Error('Invalid AsyncDescriptor arguments, expected `moduleName` to be a string!');
|
||||
}
|
||||
}
|
||||
|
||||
public get moduleName(): string {
|
||||
|
||||
@@ -208,7 +208,7 @@ class ServicesMap {
|
||||
allArguments.push.apply(allArguments, descriptor.staticArguments());
|
||||
allArguments.push.apply(allArguments, args);
|
||||
|
||||
if (allArguments.length > 1) {
|
||||
if (allArguments.length > 2) {
|
||||
console.warn('using OLD INJECTION STYLE for ' + descriptor.ctor.name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,38 +129,50 @@ export abstract class AbstractKeybindingService {
|
||||
public abstract executeCommand(commandId: string, args: any): TPromise<any>;
|
||||
}
|
||||
|
||||
export class KeybindingService extends AbstractKeybindingService implements IKeybindingService {
|
||||
export abstract class KeybindingService extends AbstractKeybindingService implements IKeybindingService {
|
||||
|
||||
private _lastContextId: number;
|
||||
private _contexts: {
|
||||
[contextId: string]: KeybindingContext;
|
||||
};
|
||||
|
||||
protected _domNode: HTMLElement;
|
||||
private _toDispose: IDisposable;
|
||||
private _resolver: KeybindingResolver;
|
||||
private _cachedResolver: KeybindingResolver;
|
||||
private _firstTimeComputingResolver: boolean;
|
||||
private _currentChord: number;
|
||||
private _currentChordStatusMessage: IDisposable;
|
||||
|
||||
constructor(domNode: HTMLElement) {
|
||||
this._lastContextId = -1;
|
||||
super((++this._lastContextId));
|
||||
this._domNode = domNode;
|
||||
constructor() {
|
||||
super(0);
|
||||
this._lastContextId = 0;
|
||||
this._contexts = Object.create(null);
|
||||
this._contexts[String(this._myContextId)] = new KeybindingContext(this._myContextId, null);
|
||||
this._toDispose = dom.addDisposableListener(this._domNode, dom.EventType.KEY_DOWN, (e: KeyboardEvent) => {
|
||||
let keyEvent = new StandardKeyboardEvent(e);
|
||||
this._dispatch(keyEvent);
|
||||
});
|
||||
|
||||
this._createOrUpdateResolver(true);
|
||||
this._cachedResolver = null;
|
||||
this._firstTimeComputingResolver = true;
|
||||
this._currentChord = 0;
|
||||
this._currentChordStatusMessage = null;
|
||||
}
|
||||
|
||||
protected _beginListening(domNode: HTMLElement): void {
|
||||
this._toDispose = dom.addDisposableListener(domNode, dom.EventType.KEY_DOWN, (e: KeyboardEvent) => {
|
||||
let keyEvent = new StandardKeyboardEvent(e);
|
||||
this._dispatch(keyEvent);
|
||||
});
|
||||
}
|
||||
|
||||
private _getResolver(): KeybindingResolver {
|
||||
if (!this._cachedResolver) {
|
||||
this._cachedResolver = new KeybindingResolver(KeybindingsRegistry.getDefaultKeybindings(), this._getExtraKeybindings(this._firstTimeComputingResolver));
|
||||
this._firstTimeComputingResolver = false;
|
||||
}
|
||||
return this._cachedResolver;
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this._toDispose.dispose();
|
||||
this._toDispose = null;
|
||||
if (this._toDispose) {
|
||||
this._toDispose.dispose();
|
||||
this._toDispose = null;
|
||||
}
|
||||
}
|
||||
|
||||
public getLabelFor(keybinding: Keybinding): string {
|
||||
@@ -176,11 +188,7 @@ export class KeybindingService extends AbstractKeybindingService implements IKey
|
||||
}
|
||||
|
||||
protected updateResolver(): void {
|
||||
this._createOrUpdateResolver(false);
|
||||
}
|
||||
|
||||
private _createOrUpdateResolver(isFirstTime: boolean): void {
|
||||
this._resolver = new KeybindingResolver(KeybindingsRegistry.getDefaultKeybindings(), this._getExtraKeybindings(isFirstTime));
|
||||
this._cachedResolver = null;
|
||||
}
|
||||
|
||||
protected _getExtraKeybindings(isFirstTime: boolean): IKeybindingItem[] {
|
||||
@@ -188,7 +196,7 @@ export class KeybindingService extends AbstractKeybindingService implements IKey
|
||||
}
|
||||
|
||||
public getDefaultKeybindings(): string {
|
||||
return this._resolver.getDefaultKeybindings() + '\n\n' + this._getAllCommandsAsComment();
|
||||
return this._getResolver().getDefaultKeybindings() + '\n\n' + this._getAllCommandsAsComment();
|
||||
}
|
||||
|
||||
public customKeybindingsCount(): number {
|
||||
@@ -196,11 +204,11 @@ export class KeybindingService extends AbstractKeybindingService implements IKey
|
||||
}
|
||||
|
||||
public lookupKeybindings(commandId: string): Keybinding[] {
|
||||
return this._resolver.lookupKeybinding(commandId);
|
||||
return this._getResolver().lookupKeybinding(commandId);
|
||||
}
|
||||
|
||||
private _getAllCommandsAsComment(): string {
|
||||
let boundCommands = this._resolver.getDefaultBoundCommands();
|
||||
let boundCommands = this._getResolver().getDefaultBoundCommands();
|
||||
let unboundCommands = Object.keys(KeybindingsRegistry.getCommands()).filter(commandId => commandId[0] !== '_' && !boundCommands[commandId]);
|
||||
unboundCommands.sort();
|
||||
let pretty = unboundCommands.join('\n// - ');
|
||||
@@ -223,7 +231,7 @@ export class KeybindingService extends AbstractKeybindingService implements IKey
|
||||
let contextValue = context.getValue();
|
||||
// console.log(JSON.stringify(contextValue, null, '\t'));
|
||||
|
||||
let resolveResult = this._resolver.resolve(contextValue, this._currentChord, e.asKeybinding());
|
||||
let resolveResult = this._getResolver().resolve(contextValue, this._currentChord, e.asKeybinding());
|
||||
|
||||
if (resolveResult && resolveResult.enterChord) {
|
||||
e.preventDefault();
|
||||
@@ -317,9 +325,9 @@ class ScopedKeybindingService extends AbstractKeybindingService {
|
||||
private _domNode: IKeybindingScopeLocation;
|
||||
|
||||
constructor(parent: AbstractKeybindingService, domNode: IKeybindingScopeLocation) {
|
||||
super(parent.createChildContext());
|
||||
this._parent = parent;
|
||||
this._domNode = domNode;
|
||||
super(this._parent.createChildContext());
|
||||
this._domNode.setAttribute(KEYBINDING_CONTEXT_ATTR, String(this._myContextId));
|
||||
}
|
||||
|
||||
|
||||
@@ -99,12 +99,12 @@ export class MainProcessPluginService extends AbstractPluginService<ActivatedPlu
|
||||
messageService: IMessageService,
|
||||
telemetryService: ITelemetryService
|
||||
) {
|
||||
super(false);
|
||||
let config = contextService.getConfiguration();
|
||||
this._isDev = !config.env.isBuilt || !!config.env.pluginDevelopmentPath;
|
||||
|
||||
this._messageService = messageService;
|
||||
threadService.registerRemotableInstance(MainProcessPluginService, this);
|
||||
super(false);
|
||||
this._threadService = threadService;
|
||||
this._telemetryService = telemetryService;
|
||||
this._proxy = this._threadService.getRemotable(PluginHostPluginService);
|
||||
@@ -272,8 +272,8 @@ export class PluginHostPluginService extends AbstractPluginService<ExtHostPlugin
|
||||
* This class is constructed manually because it is a service, so it doesn't use any ctor injection
|
||||
*/
|
||||
constructor(threadService: IThreadService) {
|
||||
threadService.registerRemotableInstance(PluginHostPluginService, this);
|
||||
super(true);
|
||||
threadService.registerRemotableInstance(PluginHostPluginService, this);
|
||||
this._threadService = threadService;
|
||||
this._storage = new PluginHostStorage(threadService);
|
||||
this._proxy = this._threadService.getRemotable(MainProcessPluginService);
|
||||
|
||||
@@ -290,10 +290,10 @@ export class Selection extends Range {
|
||||
throw new Error('Invalid arguments');
|
||||
}
|
||||
|
||||
super(anchor, active);
|
||||
|
||||
this._anchor = anchor;
|
||||
this._active = active;
|
||||
|
||||
super(anchor, active);
|
||||
}
|
||||
|
||||
get isReversed(): boolean {
|
||||
|
||||
@@ -22,7 +22,7 @@ import {IDisposable, combinedDispose} from 'vs/base/common/lifecycle';
|
||||
import {ICommonCodeEditor} from 'vs/editor/common/editorCommon';
|
||||
import {ICodeEditor, IDiffEditor} from 'vs/editor/browser/editorBrowser';
|
||||
import {EndOfLineSequence, ITokenizedModel, EditorType, IEditorSelection, ITextModel, IDiffEditorModel, IEditor} from 'vs/editor/common/editorCommon';
|
||||
import {IndentationToSpacesAction, IndentationToTabsAction} from 'vs/editor/contrib/indentation/common/indentation';
|
||||
import {IndentUsingSpaces, IndentUsingTabs, IndentationToSpacesAction, IndentationToTabsAction} from 'vs/editor/contrib/indentation/common/indentation';
|
||||
import {EventType, ResourceEvent, EditorEvent, TextEditorSelectionEvent} from 'vs/workbench/common/events';
|
||||
import {BaseTextEditor} from 'vs/workbench/browser/parts/editor/textEditor';
|
||||
import {IEditor as IBaseEditor} from 'vs/platform/editor/common/editor';
|
||||
@@ -685,9 +685,9 @@ export class ChangeIndentationAction extends Action {
|
||||
}
|
||||
const control = <ICommonCodeEditor>activeEditor.getControl();
|
||||
|
||||
return this.quickOpenService.pick([control.getAction(IndentationToSpacesAction.ID), control.getAction(IndentationToTabsAction.ID)], {
|
||||
return this.quickOpenService.pick([control.getAction(IndentUsingSpaces.ID), control.getAction(IndentUsingTabs.ID), control.getAction(IndentationToSpacesAction.ID), control.getAction(IndentationToTabsAction.ID)], {
|
||||
placeHolder: nls.localize('pickAction', "Select Action")
|
||||
}).then(action => action.run());
|
||||
}).then(action => action && action.run());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,8 +43,8 @@
|
||||
background: url('configure-inverse.svg') center center no-repeat;
|
||||
}
|
||||
|
||||
.monaco-workbench.hc-black .debug-action.toggle-repl:before {
|
||||
content: url('repl-inverse.svg');
|
||||
.monaco-workbench.hc-black .debug-action.toggle-repl {
|
||||
content: url('repl-inverse.svg') center center no-repeat;;
|
||||
}
|
||||
|
||||
/* Debug viewlet trees */
|
||||
|
||||
@@ -66,9 +66,9 @@ export abstract class GitAction extends Action {
|
||||
protected toDispose: IDisposable[];
|
||||
|
||||
constructor(id: string, label: string, cssClass: string, gitService: IGitService) {
|
||||
this.gitService = gitService;
|
||||
super(id, label, cssClass, false);
|
||||
|
||||
this.gitService = gitService;
|
||||
this.toDispose = [this.gitService.addBulkListener2(() => this.onGitServiceChange())];
|
||||
this.onGitServiceChange();
|
||||
}
|
||||
@@ -101,8 +101,8 @@ export class OpenChangeAction extends GitAction {
|
||||
protected editorService: IWorkbenchEditorService;
|
||||
|
||||
constructor(@IWorkbenchEditorService editorService: IWorkbenchEditorService, @IGitService gitService: IGitService) {
|
||||
this.editorService = editorService;
|
||||
super(OpenChangeAction.ID, nls.localize('openChange', "Open Change"), 'git-action open-change', gitService);
|
||||
this.editorService = editorService;
|
||||
}
|
||||
|
||||
protected isEnabled():boolean {
|
||||
@@ -132,10 +132,10 @@ export class OpenFileAction extends GitAction {
|
||||
private contextService: IWorkspaceContextService;
|
||||
|
||||
constructor(@IWorkbenchEditorService editorService: IWorkbenchEditorService, @IFileService fileService: IFileService, @IGitService gitService: IGitService, @IWorkspaceContextService contextService: IWorkspaceContextService) {
|
||||
super(OpenFileAction.ID, nls.localize('openFile', "Open File"), 'git-action open-file', gitService);
|
||||
this.fileService = fileService;
|
||||
this.editorService = editorService;
|
||||
this.contextService = contextService;
|
||||
super(OpenFileAction.ID, nls.localize('openFile', "Open File"), 'git-action open-file', gitService);
|
||||
}
|
||||
|
||||
protected isEnabled():boolean {
|
||||
@@ -312,12 +312,12 @@ export abstract class BaseUndoAction extends GitAction {
|
||||
private contextService: IWorkspaceContextService;
|
||||
|
||||
constructor(id: string, label: string, className: string, gitService: IGitService, eventService: IEventService, messageService: IMessageService, fileService:IFileService, editorService: IWorkbenchEditorService, contextService: IWorkspaceContextService) {
|
||||
super(id, label, className, gitService);
|
||||
this.eventService = eventService;
|
||||
this.editorService = editorService;
|
||||
this.messageService = messageService;
|
||||
this.fileService = fileService;
|
||||
this.contextService = contextService;
|
||||
super(id, label, className, gitService);
|
||||
}
|
||||
|
||||
protected isEnabled():boolean {
|
||||
@@ -595,13 +595,13 @@ export class CheckoutAction extends GitAction {
|
||||
private runPromises: Promise[];
|
||||
|
||||
constructor(branch: IBranch, @IGitService gitService: IGitService, @IWorkbenchEditorService editorService: IWorkbenchEditorService) {
|
||||
super(CheckoutAction.ID, branch.name, 'git-action checkout', gitService);
|
||||
|
||||
this.editorService = editorService;
|
||||
this.branch = branch;
|
||||
this.HEAD = null;
|
||||
this.state = LifecycleState.Alive;
|
||||
this.runPromises = [];
|
||||
|
||||
super(CheckoutAction.ID, branch.name, 'git-action checkout', gitService);
|
||||
}
|
||||
|
||||
protected onGitServiceChange(): void {
|
||||
@@ -766,8 +766,8 @@ export class SmartCommitAction extends BaseCommitAction {
|
||||
private messageService: IMessageService;
|
||||
|
||||
constructor(commitState: ICommitState, @IGitService gitService: IGitService, @IMessageService messageService: IMessageService) {
|
||||
this.messageService = messageService;
|
||||
super(commitState, SmartCommitAction.ID, SmartCommitAction.ALL, 'git-action smart-commit', gitService);
|
||||
this.messageService = messageService;
|
||||
}
|
||||
|
||||
protected onGitServiceChange(): void {
|
||||
|
||||
@@ -121,8 +121,8 @@ export class WorkbenchKeybindingService extends KeybindingService {
|
||||
private _eventService: IEventService;
|
||||
|
||||
constructor(contextService: IWorkspaceContextService, eventService: IEventService, telemetryService: ITelemetryService, domNode: HTMLElement) {
|
||||
super();
|
||||
this.contextService = contextService;
|
||||
super(domNode);
|
||||
this.eventService = eventService;
|
||||
this.telemetryService = telemetryService;
|
||||
this.toDispose = this.eventService.addListener(EventType.WORKBENCH_OPTIONS_CHANGED, (e) => this.onOptionsChanged(e));
|
||||
@@ -138,6 +138,8 @@ export class WorkbenchKeybindingService extends KeybindingService {
|
||||
this.updateResolver();
|
||||
}
|
||||
});
|
||||
|
||||
this._beginListening(domNode);
|
||||
}
|
||||
|
||||
setPluginService(pluginService: IPluginService): void {
|
||||
|
||||