mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
Update extensions for TS 2.7
Update src to build with TS 2.7 Explicitly assign this.message in the else body
This commit is contained in:
parent
d2d18a47fd
commit
308c1887df
|
@ -9,8 +9,8 @@ import { Selection } from 'vscode';
|
|||
import { withRandomFileEditor, closeAllEditors } from './testUtils';
|
||||
import { toggleComment as toggleCommentImpl } from '../toggleComment';
|
||||
|
||||
function toggleComment(...args): Thenable<boolean> {
|
||||
const result = toggleCommentImpl(...args);
|
||||
function toggleComment(): Thenable<boolean> {
|
||||
const result = toggleCommentImpl();
|
||||
assert.ok(result);
|
||||
return result!;
|
||||
}
|
||||
|
|
|
@ -267,6 +267,7 @@ export class GitError {
|
|||
this.message = data.error.message;
|
||||
} else {
|
||||
this.error = void 0;
|
||||
this.message = '';
|
||||
}
|
||||
|
||||
this.message = this.message || data.message || 'Git error';
|
||||
|
|
|
@ -9,8 +9,8 @@ import { loadMessageBundle } from 'vscode-nls';
|
|||
const localize = loadMessageBundle();
|
||||
|
||||
export default class MergeConflictCodeLensProvider implements vscode.CodeLensProvider, vscode.Disposable {
|
||||
private codeLensRegistrationHandle: vscode.Disposable | null;
|
||||
private config: interfaces.IExtensionConfiguration;
|
||||
private codeLensRegistrationHandle?: vscode.Disposable | null;
|
||||
private config?: interfaces.IExtensionConfiguration;
|
||||
private tracker: interfaces.IDocumentMergeConflictTracker;
|
||||
|
||||
constructor(trackerService: interfaces.IDocumentMergeConflictTrackerService) {
|
||||
|
|
|
@ -13,7 +13,7 @@ export default class MergeDecorator implements vscode.Disposable {
|
|||
|
||||
private decorationUsesWholeLine: boolean = true; // Useful for debugging, set to false to see exact match ranges
|
||||
|
||||
private config: interfaces.IExtensionConfiguration;
|
||||
private config?: interfaces.IExtensionConfiguration;
|
||||
private tracker: interfaces.IDocumentMergeConflictTracker;
|
||||
private updating = new Map<vscode.TextEditor, boolean>();
|
||||
|
||||
|
@ -210,7 +210,7 @@ export default class MergeDecorator implements vscode.Disposable {
|
|||
}
|
||||
});
|
||||
|
||||
if (this.config.enableDecorations) {
|
||||
if (this.config!.enableDecorations) {
|
||||
pushDecoration('current.header', { range: conflict.current.header });
|
||||
pushDecoration('splitter', { range: conflict.splitter });
|
||||
pushDecoration('incoming.header', { range: conflict.incoming.header });
|
||||
|
|
|
@ -93,9 +93,9 @@ export default class PHPValidationProvider {
|
|||
private trigger: RunTrigger;
|
||||
private pauseValidation: boolean;
|
||||
|
||||
private documentListener: vscode.Disposable | null;
|
||||
private diagnosticCollection: vscode.DiagnosticCollection;
|
||||
private delayers: { [key: string]: ThrottledDelayer<void> };
|
||||
private documentListener: vscode.Disposable | null = null;
|
||||
private diagnosticCollection?: vscode.DiagnosticCollection;
|
||||
private delayers?: { [key: string]: ThrottledDelayer<void> };
|
||||
|
||||
constructor(private workspaceStore: vscode.Memento) {
|
||||
this.executable = undefined;
|
||||
|
@ -112,15 +112,17 @@ export default class PHPValidationProvider {
|
|||
|
||||
vscode.workspace.onDidOpenTextDocument(this.triggerValidate, this, subscriptions);
|
||||
vscode.workspace.onDidCloseTextDocument((textDocument) => {
|
||||
this.diagnosticCollection.delete(textDocument.uri);
|
||||
delete this.delayers[textDocument.uri.toString()];
|
||||
this.diagnosticCollection!.delete(textDocument.uri);
|
||||
delete this.delayers![textDocument.uri.toString()];
|
||||
}, null, subscriptions);
|
||||
subscriptions.push(vscode.commands.registerCommand('php.untrustValidationExecutable', this.untrustValidationExecutable, this));
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this.diagnosticCollection.clear();
|
||||
this.diagnosticCollection.dispose();
|
||||
if (this.diagnosticCollection) {
|
||||
this.diagnosticCollection.clear();
|
||||
this.diagnosticCollection.dispose();
|
||||
}
|
||||
if (this.documentListener) {
|
||||
this.documentListener.dispose();
|
||||
this.documentListener = null;
|
||||
|
@ -156,7 +158,7 @@ export default class PHPValidationProvider {
|
|||
this.documentListener.dispose();
|
||||
this.documentListener = null;
|
||||
}
|
||||
this.diagnosticCollection.clear();
|
||||
this.diagnosticCollection!.clear();
|
||||
if (this.validationEnabled) {
|
||||
if (this.trigger === RunTrigger.onType) {
|
||||
this.documentListener = vscode.workspace.onDidChangeTextDocument((e) => {
|
||||
|
@ -186,10 +188,10 @@ export default class PHPValidationProvider {
|
|||
|
||||
let trigger = () => {
|
||||
let key = textDocument.uri.toString();
|
||||
let delayer = this.delayers[key];
|
||||
let delayer = this.delayers![key];
|
||||
if (!delayer) {
|
||||
delayer = new ThrottledDelayer<void>(this.trigger === RunTrigger.onType ? 250 : 0);
|
||||
this.delayers[key] = delayer;
|
||||
this.delayers![key] = delayer;
|
||||
}
|
||||
delayer.trigger(() => this.doValidate(textDocument));
|
||||
};
|
||||
|
@ -273,7 +275,7 @@ export default class PHPValidationProvider {
|
|||
if (line) {
|
||||
processLine(line);
|
||||
}
|
||||
this.diagnosticCollection.set(textDocument.uri, diagnostics);
|
||||
this.diagnosticCollection!.set(textDocument.uri, diagnostics);
|
||||
resolve();
|
||||
});
|
||||
} else {
|
||||
|
|
|
@ -30,7 +30,7 @@ export default class LanguageProvider {
|
|||
|
||||
private _validate: boolean = true;
|
||||
|
||||
private _documentSelector: DocumentFilter[];
|
||||
private _documentSelector?: DocumentFilter[];
|
||||
|
||||
private readonly disposables: Disposable[] = [];
|
||||
private readonly versionDependentDisposables: Disposable[] = [];
|
||||
|
|
|
@ -11,7 +11,7 @@ export interface Lazy<T> {
|
|||
|
||||
class LazyValue<T> implements Lazy<T> {
|
||||
private _hasValue: boolean = false;
|
||||
private _value: T;
|
||||
private _value?: T;
|
||||
|
||||
constructor(
|
||||
private readonly _getValue: () => T
|
||||
|
@ -22,7 +22,7 @@ class LazyValue<T> implements Lazy<T> {
|
|||
this._hasValue = true;
|
||||
this._value = this._getValue();
|
||||
}
|
||||
return this._value;
|
||||
return this._value!;
|
||||
}
|
||||
|
||||
get hasValue(): boolean {
|
||||
|
|
|
@ -10,7 +10,7 @@ import * as nls from 'vscode-nls';
|
|||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export default class Logger {
|
||||
private _output: OutputChannel;
|
||||
private _output?: OutputChannel;
|
||||
|
||||
private get output(): OutputChannel {
|
||||
if (!this._output) {
|
||||
|
|
|
@ -28,7 +28,7 @@ const fileLimit = 500;
|
|||
class ExcludeHintItem {
|
||||
public configFileName?: string;
|
||||
private _item: vscode.StatusBarItem;
|
||||
private _currentHint: Hint;
|
||||
private _currentHint?: Hint;
|
||||
|
||||
constructor(
|
||||
private readonly telemetryReporter: TelemetryReporter
|
||||
|
@ -38,7 +38,7 @@ class ExcludeHintItem {
|
|||
}
|
||||
|
||||
public getCurrentHint(): Hint {
|
||||
return this._currentHint;
|
||||
return this._currentHint!;
|
||||
}
|
||||
|
||||
public hide() {
|
||||
|
|
|
@ -13,8 +13,8 @@ interface IPackageInfo {
|
|||
}
|
||||
|
||||
export default class TelemetryReporter {
|
||||
private _packageInfo: IPackageInfo | null;
|
||||
private _reporter: VsCodeTelemetryReporter | null;
|
||||
private _packageInfo: IPackageInfo | null = null;
|
||||
private _reporter: VsCodeTelemetryReporter | null = null;
|
||||
|
||||
dispose() {
|
||||
if (this._reporter) {
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Trace {
|
|||
}
|
||||
|
||||
export default class Tracer {
|
||||
private trace: Trace;
|
||||
private trace?: Trace;
|
||||
|
||||
constructor(
|
||||
private readonly logger: Logger
|
||||
|
|
|
@ -100,7 +100,7 @@ export class Gesture implements IDisposable {
|
|||
|
||||
@memoize
|
||||
private static isTouchDevice(): boolean {
|
||||
return 'ontouchstart' in window || navigator.maxTouchPoints > 0 || window.navigator.msMaxTouchPoints > 0;
|
||||
return 'ontouchstart' in window as any || navigator.maxTouchPoints > 0 || window.navigator.msMaxTouchPoints > 0;
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
|
|
|
@ -397,14 +397,6 @@ export class Configuration {
|
|||
return this._folderConfigurations;
|
||||
}
|
||||
|
||||
private get memory(): ConfigurationModel {
|
||||
return this._memoryConfiguration;
|
||||
}
|
||||
|
||||
private get memoryByResource(): StrictResourceMap<ConfigurationModel> {
|
||||
return this._memoryConfigurationByResource;
|
||||
}
|
||||
|
||||
private getConsolidateConfigurationModel(overrides: IConfigurationOverrides, workspace: Workspace): ConfigurationModel {
|
||||
let configurationModel = this.getConsolidatedConfigurationModelForResource(overrides, workspace);
|
||||
return overrides.overrideIdentifier ? configurationModel.override(overrides.overrideIdentifier) : configurationModel;
|
||||
|
|
|
@ -581,7 +581,7 @@ class SuggestAdapter {
|
|||
}
|
||||
|
||||
// the default text edit range
|
||||
const wordRangeBeforePos = (doc.getWordRangeAtPosition(pos) || new Range(pos, pos))
|
||||
const wordRangeBeforePos = (doc.getWordRangeAtPosition(pos) as Range || new Range(pos, pos))
|
||||
.with({ end: pos });
|
||||
|
||||
for (let i = 0; i < list.items.length; i++) {
|
||||
|
@ -618,7 +618,7 @@ class SuggestAdapter {
|
|||
|
||||
const doc = this._documents.getDocumentData(resource).document;
|
||||
const pos = TypeConverters.toPosition(position);
|
||||
const wordRangeBeforePos = (doc.getWordRangeAtPosition(pos) || new Range(pos, pos)).with({ end: pos });
|
||||
const wordRangeBeforePos = (doc.getWordRangeAtPosition(pos) as Range || new Range(pos, pos) ).with({ end: pos });
|
||||
const newSuggestion = this._convertCompletionItem(resolvedItem, pos, wordRangeBeforePos, _id, _parentId);
|
||||
if (newSuggestion) {
|
||||
mixin(suggestion, newSuggestion, true);
|
||||
|
|
|
@ -192,7 +192,7 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape {
|
|||
|
||||
// Simulate the updateWorkspaceFolders method on our data to do more validation
|
||||
const newWorkspaceFolders = currentWorkspaceFolders.slice(0);
|
||||
newWorkspaceFolders.splice(index, deleteCount, ...validatedDistinctWorkspaceFoldersToAdd.map(f => ({ uri: f.uri, name: f.name || basenameOrAuthority(f.uri) })));
|
||||
newWorkspaceFolders.splice(index, deleteCount, ...validatedDistinctWorkspaceFoldersToAdd.map(f => ({ uri: f.uri, name: f.name || basenameOrAuthority(f.uri), index: undefined })));
|
||||
|
||||
for (let i = 0; i < newWorkspaceFolders.length; i++) {
|
||||
const folder = newWorkspaceFolders[i];
|
||||
|
|
|
@ -61,7 +61,7 @@ function doLegacySearchTest(config: IRawSearch, expectedResultCount: number | Fu
|
|||
});
|
||||
}
|
||||
|
||||
function doRipgrepSearchTest(config: IRawSearch, expectedResultCount: number): TPromise<void> {
|
||||
function doRipgrepSearchTest(config: IRawSearch, expectedResultCount: number | Function): TPromise<void> {
|
||||
return new TPromise<void>((resolve, reject) => {
|
||||
let engine = new RipgrepEngine(config);
|
||||
|
||||
|
|
|
@ -11,6 +11,30 @@ import { MainThreadMessageService } from 'vs/workbench/api/electron-browser/main
|
|||
import { TPromise as Promise } from 'vs/base/common/winjs.base';
|
||||
import { IMessageService, IChoiceService } from 'vs/platform/message/common/message';
|
||||
|
||||
const emptyChoiceService = new class implements IChoiceService {
|
||||
_serviceBrand: 'choiceService';
|
||||
choose(severity, message, options, modal): never {
|
||||
throw new Error('not implemented');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const emptyMesssageService = new class implements IMessageService {
|
||||
_serviceBrand: 'messageService';
|
||||
show(...args: any[]): never {
|
||||
throw new Error('not implemented');
|
||||
}
|
||||
hideAll(): void {
|
||||
throw new Error('not implemented.');
|
||||
}
|
||||
confirm(confirmation): never {
|
||||
throw new Error('not implemented.');
|
||||
}
|
||||
confirmWithCheckbox(confirmation): never {
|
||||
throw new Error('not implemented.');
|
||||
}
|
||||
};
|
||||
|
||||
suite('ExtHostMessageService', function () {
|
||||
|
||||
test('propagte handle on select', function () {
|
||||
|
@ -21,11 +45,7 @@ suite('ExtHostMessageService', function () {
|
|||
setImmediate(() => m.actions[0].run());
|
||||
return () => { };
|
||||
}
|
||||
} as IMessageService, {
|
||||
choose(severity, message, options, modal) {
|
||||
throw new Error('not implemented');
|
||||
}
|
||||
} as IChoiceService);
|
||||
} as IMessageService, emptyChoiceService);
|
||||
|
||||
return service.$showMessage(1, 'h', {}, [{ handle: 42, title: 'a thing', isCloseAffordance: true }]).then(handle => {
|
||||
assert.equal(handle, 42);
|
||||
|
@ -39,11 +59,7 @@ suite('ExtHostMessageService', function () {
|
|||
show(sev: number, m: { actions: Action[] }) {
|
||||
actions = m.actions;
|
||||
}
|
||||
} as IMessageService, {
|
||||
choose(severity, message, options, modal) {
|
||||
throw new Error('not implemented');
|
||||
}
|
||||
} as IChoiceService);
|
||||
} as IMessageService, emptyChoiceService);
|
||||
|
||||
// default close action
|
||||
service.$showMessage(1, '', {}, [{ title: 'a thing', isCloseAffordance: false, handle: 0 }]);
|
||||
|
@ -71,11 +87,7 @@ suite('ExtHostMessageService', function () {
|
|||
c += 1;
|
||||
};
|
||||
}
|
||||
} as IMessageService, {
|
||||
choose(severity, message, options, modal) {
|
||||
throw new Error('not implemented');
|
||||
}
|
||||
} as IChoiceService);
|
||||
} as IMessageService, emptyChoiceService);
|
||||
|
||||
service.$showMessage(1, '', {}, [{ title: 'a thing', isCloseAffordance: true, handle: 0 }]);
|
||||
assert.equal(actions.length, 1);
|
||||
|
@ -86,11 +98,7 @@ suite('ExtHostMessageService', function () {
|
|||
|
||||
suite('modal', () => {
|
||||
test('calls choice service', () => {
|
||||
const service = new MainThreadMessageService(null, {
|
||||
show(sev: number, m: { actions: Action[] }) {
|
||||
throw new Error('not implemented');
|
||||
}
|
||||
} as IMessageService, {
|
||||
const service = new MainThreadMessageService(null, emptyMesssageService, {
|
||||
choose(severity, message, options, modal) {
|
||||
assert.equal(severity, 1);
|
||||
assert.equal(message, 'h');
|
||||
|
@ -106,11 +114,7 @@ suite('ExtHostMessageService', function () {
|
|||
});
|
||||
|
||||
test('returns undefined when cancelled', () => {
|
||||
const service = new MainThreadMessageService(null, {
|
||||
show(sev: number, m: { actions: Action[] }) {
|
||||
throw new Error('not implemented');
|
||||
}
|
||||
} as IMessageService, {
|
||||
const service = new MainThreadMessageService(null, emptyMesssageService, {
|
||||
choose(severity, message, options, modal) {
|
||||
return Promise.as(1);
|
||||
}
|
||||
|
@ -122,11 +126,7 @@ suite('ExtHostMessageService', function () {
|
|||
});
|
||||
|
||||
test('hides Cancel button when not needed', () => {
|
||||
const service = new MainThreadMessageService(null, {
|
||||
show(sev: number, m: { actions: Action[] }) {
|
||||
throw new Error('not implemented');
|
||||
}
|
||||
} as IMessageService, {
|
||||
const service = new MainThreadMessageService(null, emptyMesssageService, {
|
||||
choose(severity, message, options, modal) {
|
||||
assert.equal(options.length, 1);
|
||||
return Promise.as(0);
|
||||
|
|
Loading…
Reference in a new issue