Merge branch 'Microsoft/master' into main-element

This commit is contained in:
David Storey 2015-11-22 13:09:34 -08:00
Родитель 1a98e23a63 c7451c15d2
Коммит e00710dcb3
12 изменённых файлов: 125 добавлений и 62 удалений

Просмотреть файл

@ -20,4 +20,9 @@ export function activate(context: ExtensionContext): any {
let validator = new PHPValidationProvider();
validator.activate(context.subscriptions);
// need to set in the plugin host as well as the completion provider uses it.
languages.setLanguageConfiguration('php', {
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g
});
}

Просмотреть файл

@ -130,8 +130,8 @@ export class MessageList {
// Trigger Auto-Purge of messages to keep list small
this.purgeMessages();
// Store in Memory
this.messages.push({
// Store in Memory (new messages come first so that they show up on top)
this.messages.unshift({
id: id,
text: message,
severity: severity,

Просмотреть файл

@ -201,6 +201,10 @@ export class QuickOpenWidget implements IModelProvider {
let quickNavKeys = this.quickNavigateConfiguration.keybindings;
let wasTriggerKeyPressed = keyCode === KeyCode.Enter || quickNavKeys.some((k) => {
if (k.hasShift() && keyCode === KeyCode.Shift) {
if (keyboardEvent.ctrlKey || keyboardEvent.altKey || keyboardEvent.metaKey) {
return false; // this is an optimistic check for the shift key being used to navigate back in quick open
}
return true;
}

Просмотреть файл

@ -139,12 +139,12 @@ export function getHTML5TagProvider(): IHTMLTagProvider {
};
var globalAttributes = [
'aria-activedescendant', 'aria-atomic:b', 'aria-autocomplete:autocomplete', 'aria-busy:b', 'aria-checked:tristate', 'aria-controls', 'aria-describedby', 'aria-disabled:b',
'aria-dropeffect:dropeffect', 'aria-expanded:u', 'aria-flowto', 'aria-grabbed:u', 'aria-haspopup:b', 'aria-hidden:b', 'aria-invalid:invalid', 'aria-label', 'aria-labelledby',
'aria-level', 'aria-live:live', 'aria-multiline:b', 'aria-multiselectable:b', 'aria-orientation:orientation', 'aria-owns', 'aria-posinset', 'aria-pressed:tristate', 'aria-readonly:b',
'aria-relevant:relevant', 'aria-required:b', 'aria-selected:u', 'aria-setsize', 'aria-sort:sort', 'aria-valuemax', 'aria-valuemin', 'aria-valuenow', 'aria-valuetext', 'accesskey',
'class', 'contenteditable:b', 'contextmenu', 'dir:d', 'draggable:a', 'dropzone', 'hidden:v', 'id', 'inert:v', 'itemid', 'itemprop', 'itemref', 'itemscope:v', 'itemtype', 'lang', 'role',
'spellcheck:b', 'style', 'tabindex', 'title', 'translate'];
'aria-activedescendant', 'aria-atomic:b', 'aria-autocomplete:autocomplete', 'aria-busy:b', 'aria-checked:tristate', 'aria-colcount', 'aria-colindex', 'aria-colspan', 'aria-controls', 'aria-current:current', 'aria-describedat',
'aria-describedby', 'aria-disabled:b', 'aria-dropeffect:dropeffect', 'aria-errormessage', 'aria-expanded:u', 'aria-flowto', 'aria-grabbed:u', 'aria-haspopup:b', 'aria-hidden:b', 'aria-invalid:invalid', 'aria-kbdshortcuts',
'aria-label', 'aria-labelledby', 'aria-level', 'aria-live:live', 'aria-modal:b', 'aria-multiline:b', 'aria-multiselectable:b', 'aria-orientation:orientation', 'aria-owns', 'aria-placeholder', 'aria-posinset', 'aria-pressed:tristate',
'aria-readonly:b','aria-relevant:relevant', 'aria-required:b', 'aria-roledescription', 'aria-rowcount', 'aria-rowindex', 'aria-rowspan', 'aria-selected:u', 'aria-setsize', 'aria-sort:sort', 'aria-valuemax', 'aria-valuemin', 'aria-valuenow', 'aria-valuetext',
'accesskey', 'class', 'contenteditable:b', 'contextmenu', 'dir:d', 'draggable:a', 'dropzone', 'hidden:v', 'id', 'inert:v', 'itemid', 'itemprop', 'itemref', 'itemscope:v', 'itemtype', 'lang', 'role:roles', 'spellcheck:b', 'style', 'tabindex',
'title', 'translate'];
var eventHandlers = ['onabort', 'onblur', 'oncanplay', 'oncanplaythrough', 'onchange', 'onclick', 'oncontextmenu', 'ondblclick', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart',
'ondrop', 'ondurationchange', 'onemptied', 'onended', 'onerror', 'onfocus', 'onformchange', 'onforminput', 'oninput', 'oninvalid', 'onkeydown', 'onkeypress', 'onkeyup', 'onload', 'onloadeddata', 'onloadedmetadata',
@ -163,12 +163,18 @@ export function getHTML5TagProvider(): IHTMLTagProvider {
xo: ['anonymous', 'use-credentials'],
tristate: ['true', 'false', 'mixed', 'undefined'],
autocomplete: ['inline', 'list', 'both', 'none'],
current: ['page', 'step', 'location', 'date', 'time', 'true', 'false'],
dropeffect: ['copy', 'move', 'link', 'execute', 'popup', 'none'],
invalid: ['grammar', 'false', 'spelling', 'true'],
live: ['off', 'polite', 'assertive'],
orientation: ['vertical', 'horizontal'],
orientation: ['vertical', 'horizontal', 'undefined'],
relevant: ['additions', 'removals', 'text', 'all', 'additions text'],
sort: ['ascending', 'descending', 'none', 'other']
sort: ['ascending', 'descending', 'none', 'other'],
roles: ['alert', 'alertdialog', 'button', 'checkbox', 'dialog', 'gridcell', 'link', 'log', 'marquee', 'menuitem', 'menuitemcheckbox', 'menuitemradio', 'option', 'progressbar', 'radio', 'scrollbar', 'searchbox', 'slider',
'spinbutton', 'status', 'switch', 'tab', 'tabpanel', 'textbox', 'timer', 'tooltip', 'treeitem', 'combobox', 'grid', 'listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid',
'application', 'article', 'cell', 'columnheader', 'definition', 'directory', 'document', 'feed', 'figure', 'group', 'heading', 'img', 'list', 'listitem', 'math', 'none', 'note', 'presentation', 'region', 'row', 'rowgroup',
'rowheader', 'separator', 'table', 'term', 'text', 'toolbar',
'banner', 'complementary', 'contentinfo', 'form', 'main', 'navigation', 'region', 'search']
};
return {

Просмотреть файл

@ -237,29 +237,42 @@ suite('HTML - worker', () => {
assertSuggestion(completion, 'aria-autocomplete');
assertSuggestion(completion, 'aria-busy');
assertSuggestion(completion, 'aria-checked');
assertSuggestion(completion, 'aria-colcount');
assertSuggestion(completion, 'aria-colindex');
assertSuggestion(completion, 'aria-colspan');
assertSuggestion(completion, 'aria-controls');
assertSuggestion(completion, 'aria-current');
assertSuggestion(completion, 'aria-describedat');
assertSuggestion(completion, 'aria-describedby');
assertSuggestion(completion, 'aria-disabled');
assertSuggestion(completion, 'aria-dropeffect');
assertSuggestion(completion, 'aria-errormessage');
assertSuggestion(completion, 'aria-expanded');
assertSuggestion(completion, 'aria-flowto');
assertSuggestion(completion, 'aria-grabbed');
assertSuggestion(completion, 'aria-haspopup');
assertSuggestion(completion, 'aria-hidden');
assertSuggestion(completion, 'aria-invalid');
assertSuggestion(completion, 'aria-kbdshortcuts');
assertSuggestion(completion, 'aria-label');
assertSuggestion(completion, 'aria-labelledby');
assertSuggestion(completion, 'aria-level');
assertSuggestion(completion, 'aria-live');
assertSuggestion(completion, 'aria-modal');
assertSuggestion(completion, 'aria-multiline');
assertSuggestion(completion, 'aria-multiselectable');
assertSuggestion(completion, 'aria-orientation');
assertSuggestion(completion, 'aria-owns');
assertSuggestion(completion, 'aria-placeholder');
assertSuggestion(completion, 'aria-posinset');
assertSuggestion(completion, 'aria-pressed');
assertSuggestion(completion, 'aria-readonly');
assertSuggestion(completion, 'aria-relevant');
assertSuggestion(completion, 'aria-required');
assertSuggestion(completion, 'aria-roledescription');
assertSuggestion(completion, 'aria-rowcount');
assertSuggestion(completion, 'aria-rowindex');
assertSuggestion(completion, 'aria-rowspan');
assertSuggestion(completion, 'aria-selected');
assertSuggestion(completion, 'aria-setsize');
assertSuggestion(completion, 'aria-sort');

Просмотреть файл

@ -5,8 +5,9 @@
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import {onUnexpectedError} from 'vs/base/common/errors';
import {Remotable, IThreadService} from 'vs/platform/thread/common/thread';
import {IOutputService, OUTPUT_MODE_ID} from 'vs/workbench/parts/output/common/output';
import {IOutputService, OUTPUT_EDITOR_INPUT_ID} from 'vs/workbench/parts/output/common/output';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {Position} from 'vs/platform/editor/common/editor';
import * as TypeConverters from 'vs/workbench/api/common/pluginHostTypeConverters';
@ -76,35 +77,33 @@ export class ExtHostOutputService {
@Remotable.MainContext('MainThreadOutputService')
export class MainThreadOutputService {
private _outputService: IOutputService;
private _editorService: IWorkbenchEditorService;
constructor(@IOutputService outputService: IOutputService, editorService: IWorkbenchEditorService) {
this._outputService = outputService;
this._editorService = editorService;
constructor(
@IOutputService private outputService: IOutputService,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService
) {
}
public append(channel: string, value: string): TPromise<void> {
this._outputService.append(channel, value);
this.outputService.append(channel, value);
return undefined;
}
public clear(channel: string): TPromise<void> {
this._outputService.clearOutput(channel);
this.outputService.clearOutput(channel);
return undefined;
}
public reveal(channel: string, position: Position): TPromise<void> {
this._outputService.showOutput(channel, position);
this.outputService.showOutput(channel, position);
return undefined;
}
public close(channel: string): TPromise<void> {
let editors = this._editorService.getVisibleEditors();
let editors = this.editorService.getVisibleEditors();
for (let editor of editors) {
if (editor.input.getId() === OUTPUT_MODE_ID) {
this._editorService.closeEditor(editor);
return;
if (editor.input.getId() === OUTPUT_EDITOR_INPUT_ID) {
this.editorService.closeEditor(editor).done(null, onUnexpectedError);
return undefined;
}
}
}

Просмотреть файл

@ -76,6 +76,7 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe
private previousActiveHandlerDescriptor: QuickOpenHandlerDescriptor;
private actionProvider = new ContributableActionProvider();
private previousValue = '';
private visibilityChangeTimeoutHandle: number;
constructor(
private eventService: IEventService,
@ -208,7 +209,7 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe
onOk: () => { /* ignore, handle later */ },
onCancel: () => { /* ignore, handle later */ },
onType: (value: string) => { /* ignore, handle later */ },
onShow: () => this._onShow.fire()
onShow: () => this.emitQuickOpenVisibilityChange(true)
}, {
inputPlaceHolder: options.placeHolder || ''
},
@ -348,11 +349,11 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe
this.pickOpenWidget.refresh(model, value ? { autoFocusFirstEntry: true } : autoFocus);
},
onShow: () => {
this._onShow.fire(); // event
this.emitQuickOpenVisibilityChange(true); // event
},
onHide: () => {
this.restoreFocus(); // focus back to editor or viewlet
this._onHide.fire(); // event
this.emitQuickOpenVisibilityChange(false); // event
}
});
@ -378,6 +379,22 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe
});
}
private emitQuickOpenVisibilityChange(isVisible: boolean): void {
if (this.visibilityChangeTimeoutHandle) {
window.clearTimeout(this.visibilityChangeTimeoutHandle);
}
this.visibilityChangeTimeoutHandle = setTimeout(() => {
if (isVisible) {
this._onShow.fire();
} else {
this._onHide.fire();
}
this.visibilityChangeTimeoutHandle = void 0;
}, 100 /* to prevent flashing, we accumulate visibility changes over a timeout of 100ms */);
}
public refresh(input?: string): TPromise<void> {
if (!this.quickOpenWidget.isVisible()) {
return TPromise.as(null);
@ -421,7 +438,7 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe
onType: (value: string) => this.onType(value || ''),
onShow: () => {
this.inQuickOpenMode.set(true);
this._onShow.fire();
this.emitQuickOpenVisibilityChange(true);
},
onHide: () => {
this.inQuickOpenMode.reset();
@ -432,7 +449,7 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe
}
this.restoreFocus(); // focus back to editor or viewlet
this._onHide.fire();
this.emitQuickOpenVisibilityChange(false);
}
}, {
inputPlaceHolder: this.hasHandler(HELP_PREFIX) ? nls.localize('quickOpenInput', "Type '?' to get help on the actions you can take from here") : ''

Просмотреть файл

@ -174,7 +174,11 @@ export class ElectronWindow {
public focus(): void {
if (!this.win.isFocused()) {
this.win.focus();
if (platform.isWindows || platform.isLinux) {
this.win.show(); // Windows & Linux sometimes cannot bring the window to the front when it is in the background
} else {
this.win.focus();
}
}
}

Просмотреть файл

@ -215,7 +215,11 @@ export class VSCodeWindow {
this._win.restore();
}
this._win.focus();
if (platform.isWindows || platform.isLinux) {
this._win.show(); // Windows & Linux sometimes cannot bring the window to the front when it is in the background
} else {
this._win.focus();
}
}
public get lastFocusTime(): number {

Просмотреть файл

@ -55,6 +55,15 @@ export interface IInitData {
};
}
const nativeExit = process.exit;
process.exit = function() {
const err = new Error('An extension called process.exit() and this was prevented.');
console.warn((<any>err).stack);
};
export function exit(code?: number) {
nativeExit(code);
}
export function createServices(remoteCom: IPluginsIPC, initData: IInitData, sharedProcessClient: Client): IInstantiationService {
// the init data is not demarshalled
initData = marshalling.deserialize(initData);
@ -249,7 +258,7 @@ export class PluginHostMain {
private gracefulExit(): void {
// to give the PH process a chance to flush any outstanding console
// messages to the main process, we delay the process.exit() by some time
setTimeout(() => process.exit(), 500);
// messages to the main process, we delay the exit() by some time
setTimeout(() => exit(), 500);
}
}

Просмотреть файл

@ -7,7 +7,7 @@
import {onUnexpectedError} from 'vs/base/common/errors';
import { TPromise } from 'vs/base/common/winjs.base';
import { PluginHostMain, createServices, IInitData } from 'vs/workbench/node/pluginHostMain';
import { PluginHostMain, createServices, IInitData, exit } from 'vs/workbench/node/pluginHostMain';
import { Client, connect } from 'vs/base/node/service.net';
import { create as createIPC, IPluginsIPC } from 'vs/platform/plugins/common/ipcRemoteCom';
@ -50,7 +50,7 @@ function connectToRenderer(): TPromise<IRendererConnection> {
try {
process.kill(msg.parentPid, 0); // throws an exception if the main process doesn't exist anymore.
} catch (e) {
process.exit();
exit();
}
}, 5000);

Просмотреть файл

@ -48,22 +48,21 @@ export class UserSettings {
const appSettingsPath = contextService.getConfiguration().env.appSettingsPath;
fs.readFile(appSettingsPath, (error /* ignore */, fileContents) => {
let root = {};
let content = fileContents && fileContents.toString();
if (!content) {
content = '{}';
}
let root = Object.create(null);
let content = fileContents ? fileContents.toString() : '{}';
let contents = Object.create(null);
try {
let contents = json.parse(content) || {};
for (let key in contents) {
UserSettings.setNode(root, key, contents[key]);
}
return c(UserSettings.doGetValue(root, key, fallback));
contents = json.parse(content);
} catch (error) {
return c(UserSettings.doGetValue(root, key, fallback)); // parse error
// ignore parse problem
}
for (let key in contents) {
UserSettings.setNode(root, key, contents[key]);
}
return c(UserSettings.doGetValue(root, key, fallback));
});
});
}
@ -142,29 +141,32 @@ export class UserSettings {
}
private doLoadSettingsSync(): { contents: any; parseErrors?: string[]; } {
let root = Object.create(null);
let content = '{}';
try {
let root = {};
let content = '{}';
try {
content = fs.readFileSync(this.appSettingsPath).toString();
} catch (error) {
// ignore
}
content = fs.readFileSync(this.appSettingsPath).toString();
} catch (error) {
// ignore
}
let contents = json.parse(content) || {};
for (let key in contents) {
UserSettings.setNode(root, key, contents[key]);
}
return {
contents: root
};
let contents = Object.create(null);
try {
contents = json.parse(content);
} catch (error) {
// parse problem
return {
contents: {},
contents: Object.create(null),
parseErrors: [this.appSettingsPath]
};
}
for (let key in contents) {
UserSettings.setNode(root, key, contents[key]);
}
return {
contents: root
};
}
private static setNode(root: any, key: string, value: any): any {