Merge branch 'master' into dbaeumer/27078

This commit is contained in:
Dirk Baeumer
2017-05-26 15:24:56 +02:00
11 changed files with 278 additions and 269 deletions

View File

@@ -536,8 +536,6 @@ export function createApiFactory(
TreeItemCollapsibleState: extHostTypes.TreeItemCollapsibleState,
ThemeColor: extHostTypes.ThemeColor,
// functions
FileLocationKind: extHostTypes.FileLocationKind,
ApplyToKind: extHostTypes.ApplyToKind,
RevealKind: extHostTypes.RevealKind,
TaskGroup: extHostTypes.TaskGroup,
ShellTask: extHostTypes.ShellTask,

View File

@@ -371,8 +371,7 @@ export abstract class ExtHostDocumentsShape {
$provideTextDocumentContent(handle: number, uri: URI): TPromise<string> { throw ni(); }
$acceptModelModeChanged(strURL: string, oldModeId: string, newModeId: string): void { throw ni(); }
$acceptModelSaved(strURL: string): void { throw ni(); }
$acceptModelDirty(strURL: string): void { throw ni(); }
$acceptModelReverted(strURL: string): void { throw ni(); }
$acceptDirtyStateChanged(strURL: string, isDirty: boolean): void { throw ni(); }
$acceptModelChanged(strURL: string, e: IModelChangedEvent, isDirty: boolean): void { throw ni(); }
}

View File

@@ -242,9 +242,17 @@ export class ExtHostDocumentData extends MirrorModel {
private _getWordRangeAtPosition(_position: vscode.Position, regexp?: RegExp): vscode.Range {
let position = this._validatePosition(_position);
if (!regexp || regExpLeadsToEndlessLoop(regexp)) {
if (!regexp) {
// use default when custom-regexp isn't provided
regexp = getWordDefinitionFor(this._languageId);
} else if (regExpLeadsToEndlessLoop(regexp)) {
// use default when custom-regexp is bad
console.warn(`[getWordRangeAtPosition]: ignoring custom regexp '${regexp.source}' because it matches the empty string.`);
regexp = getWordDefinitionFor(this._languageId);
}
let wordAtText = getWordAtText(
position.character + 1,
ensureValidWordDefinition(regexp),

View File

@@ -171,18 +171,17 @@ export class ExtHostDocuments extends ExtHostDocumentsShape {
public $acceptModelSaved(strURL: string): void {
let data = this._documentsAndEditors.getDocument(strURL);
data._acceptIsDirty(false);
this.$acceptDirtyStateChanged(strURL, false);
this._onDidSaveDocument.fire(data.document);
}
public $acceptModelDirty(strURL: string): void {
let document = this._documentsAndEditors.getDocument(strURL);
document._acceptIsDirty(true);
}
public $acceptModelReverted(strURL: string): void {
let document = this._documentsAndEditors.getDocument(strURL);
document._acceptIsDirty(false);
public $acceptDirtyStateChanged(strURL: string, isDirty: boolean): void {
let data = this._documentsAndEditors.getDocument(strURL);
data._acceptIsDirty(isDirty);
this._onDidChangeDocument.fire({
document: data.document,
contentChanges: []
});
}
public $acceptModelChanged(strURL: string, events: IModelChangedEvent, isDirty: boolean): void {

View File

@@ -8,13 +8,11 @@ import { TPromise } from 'vs/base/common/winjs.base';
import * as UUID from 'vs/base/common/uuid';
import { asWinJsPromise } from 'vs/base/common/async';
import * as Problems from 'vs/platform/markers/common/problemMatcher';
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import * as TaskSystem from 'vs/workbench/parts/tasks/common/tasks';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { MainContext, MainThreadTaskShape, ExtHostTaskShape } from 'vs/workbench/api/node/extHost.protocol';
import { fromDiagnosticSeverity } from 'vs/workbench/api/node/extHostTypeConverters';
import * as types from 'vs/workbench/api/node/extHostTypes';
import * as vscode from 'vscode';
@@ -23,6 +21,7 @@ interface StringMap<V> {
[key: string]: V;
}
/*
namespace ProblemPattern {
export function from(value: vscode.ProblemPattern | vscode.MultiLineProblemPattern): Problems.ProblemPattern | Problems.MultiLineProblemPattern {
if (value === void 0 || value === null) {
@@ -144,7 +143,7 @@ namespace WatchingPattern {
}
}
namespace WathingMatcher {
namespace BackgroundMonitor {
export function from(value: vscode.BackgroundMonitor): Problems.WatchingMatcher {
if (value === void 0 || value === null) {
return undefined;
@@ -190,6 +189,7 @@ namespace ProblemMatcher {
return result;
}
}
*/
namespace RevealKind {
export function from(value: vscode.RevealKind): TaskSystem.RevealKind {
@@ -317,7 +317,7 @@ namespace Tasks {
command: command,
isBackground: !!task.isBackground,
suppressTaskName: true,
problemMatchers: ProblemMatcher.from(task.problemMatchers)
problemMatchers: task.problemMatchers.slice()
};
return result;
}

View File

@@ -1018,12 +1018,12 @@ export enum RevealKind {
export class BaseTask {
private _name: string;
private _problemMatchers: (string | vscode.ProblemMatcher)[];
private _problemMatchers: string[];
private _identifier: string;
private _isBackground: boolean;
private _terminal: vscode.TerminalBehaviour;
constructor(name: string, problemMatchers: (string | vscode.ProblemMatcher)[]) {
constructor(name: string, problemMatchers: string[]) {
if (typeof name !== 'string') {
throw illegalArgument('name');
}
@@ -1074,11 +1074,11 @@ export class BaseTask {
this._terminal = value;
}
get problemMatchers(): (string | vscode.ProblemMatcher)[] {
get problemMatchers(): string[] {
return this._problemMatchers;
}
set problemMatchers(value: (string | vscode.ProblemMatcher)[]) {
set problemMatchers(value: string[]) {
if (!Array.isArray(value)) {
value = [];
}
@@ -1086,12 +1086,14 @@ export class BaseTask {
}
}
/*
namespace ProblemMatcher {
export function is(value: any): value is vscode.ProblemMatcher {
let candidate: vscode.ProblemMatcher = value;
return candidate && !!candidate.pattern;
}
}
*/
namespace ShellOptions {
export function is(value: any): value is vscode.ShellOptions {
@@ -1144,7 +1146,7 @@ export class ProcessTask extends BaseTask {
args = arg3 || [];
if (arg4) {
if (Array.isArray(arg4) || typeof arg4 === 'string' || ProblemMatcher.is(arg4)) {
if (Array.isArray(arg4) || typeof arg4 === 'string') {
problemMatchers = arg4;
} else {
options = arg4;
@@ -1153,8 +1155,8 @@ export class ProcessTask extends BaseTask {
if (arg5 && !problemMatchers) {
problemMatchers = arg5;
}
let pm: (string | vscode.ProblemMatcher)[];
if (problemMatchers && (typeof problemMatchers === 'string' || ProblemMatcher.is(problemMatchers))) {
let pm: string[];
if (problemMatchers && (typeof problemMatchers === 'string')) {
pm = [problemMatchers];
} else if (Array.isArray(problemMatchers)) {
pm = problemMatchers;
@@ -1217,13 +1219,13 @@ export class ShellTask extends BaseTask implements vscode.ShellTask {
throw illegalArgument('commandLine');
}
let options: vscode.ShellOptions = undefined;
let pm: (string | vscode.ProblemMatcher)[];
let pm: string[];
if (ShellOptions.is(optionsOrProblemMatchers)) {
options = optionsOrProblemMatchers;
} else {
problemMatchers = optionsOrProblemMatchers;
}
if (problemMatchers && (typeof problemMatchers === 'string' || ProblemMatcher.is(problemMatchers))) {
if (problemMatchers && (typeof problemMatchers === 'string')) {
pm = [problemMatchers];
} else if (Array.isArray(problemMatchers)) {
pm = problemMatchers;