Skip to content

Commit

Permalink
replace void 0 with undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
roblourens committed Jan 3, 2019
1 parent 0d11396 commit ef2547d
Show file tree
Hide file tree
Showing 413 changed files with 1,515 additions and 1,515 deletions.
6 changes: 3 additions & 3 deletions build/gulpfile.vscode.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,13 @@ const config = {
urlSchemes: [product.urlProtocol]
}],
darwinForceDarkModeSupport: true,
darwinCredits: darwinCreditsTemplate ? Buffer.from(darwinCreditsTemplate({ commit: commit, date: new Date().toISOString() })) : void 0,
darwinCredits: darwinCreditsTemplate ? Buffer.from(darwinCreditsTemplate({ commit: commit, date: new Date().toISOString() })) : undefined,
linuxExecutableName: product.applicationName,
winIcon: 'resources/win32/code.ico',
token: process.env['VSCODE_MIXIN_PASSWORD'] || process.env['GITHUB_TOKEN'] || void 0,
token: process.env['VSCODE_MIXIN_PASSWORD'] || process.env['GITHUB_TOKEN'] || undefined,

// @ts-ignore JSON checking: electronRepository is optional
repo: product.electronRepository || void 0
repo: product.electronRepository || undefined
};

function getElectron(arch) {
Expand Down
6 changes: 3 additions & 3 deletions build/lib/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function getVersion(repo: string): string | undefined {
try {
head = fs.readFileSync(headPath, 'utf8').trim();
} catch (e) {
return void 0;
return undefined;
}

if (/^[0-9a-f]{40}$/i.test(head)) {
Expand All @@ -28,7 +28,7 @@ export function getVersion(repo: string): string | undefined {
const refMatch = /^ref: (.*)$/.exec(head);

if (!refMatch) {
return void 0;
return undefined;
}

const ref = refMatch[1];
Expand All @@ -46,7 +46,7 @@ export function getVersion(repo: string): string | undefined {
try {
refsRaw = fs.readFileSync(packedRefsPath, 'utf8').trim();
} catch (e) {
return void 0;
return undefined;
}

const refsRegex = /^([0-9a-f]{40})\s+(.+)$/gm;
Expand Down
2 changes: 1 addition & 1 deletion build/lib/watch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function handleDeletions() {
});
}

let watch = void 0;
let watch = undefined;

if (!watch) {
watch = process.platform === 'win32' ? require('./watch-win32') : require('gulp-watch');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function getDocumentSettings(textDocument: TextDocument): Thenable<LanguageSetti
}
return promise;
}
return Promise.resolve(void 0);
return Promise.resolve(undefined);
}

// The settings have changed. Is send on server activation as well.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function getLanguageModelCache<T>(maxEntries: number, cleanupIntervalTime
let languageModels: { [uri: string]: { version: number, languageId: string, cTime: number, languageModel: T } } = {};
let nModels = 0;

let cleanupInterval: NodeJS.Timer | undefined = void 0;
let cleanupInterval: NodeJS.Timer | undefined = undefined;
if (cleanupIntervalTimeInSec > 0) {
cleanupInterval = setInterval(() => {
let cutoffTime = Date.now() - cleanupIntervalTimeInSec * 1000;
Expand Down Expand Up @@ -73,7 +73,7 @@ export function getLanguageModelCache<T>(maxEntries: number, cleanupIntervalTime
dispose() {
if (typeof cleanupInterval !== 'undefined') {
clearInterval(cleanupInterval);
cleanupInterval = void 0;
cleanupInterval = undefined;
languageModels = {};
nModels = 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function getDocumentContext(documentUri: string, workspaceFolders: Worksp
return folderURI;
}
}
return void 0;
return undefined;
}

return {
Expand Down
18 changes: 9 additions & 9 deletions extensions/git/src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,17 @@ function findGitWin32InPath(onLookup: (path: string) => void): Promise<IGit> {

function findGitWin32(onLookup: (path: string) => void): Promise<IGit> {
return findSystemGitWin32(process.env['ProgramW6432'] as string, onLookup)
.then(void 0, () => findSystemGitWin32(process.env['ProgramFiles(x86)'] as string, onLookup))
.then(void 0, () => findSystemGitWin32(process.env['ProgramFiles'] as string, onLookup))
.then(void 0, () => findSystemGitWin32(path.join(process.env['LocalAppData'] as string, 'Programs'), onLookup))
.then(void 0, () => findGitWin32InPath(onLookup));
.then(undefined, () => findSystemGitWin32(process.env['ProgramFiles(x86)'] as string, onLookup))
.then(undefined, () => findSystemGitWin32(process.env['ProgramFiles'] as string, onLookup))
.then(undefined, () => findSystemGitWin32(path.join(process.env['LocalAppData'] as string, 'Programs'), onLookup))
.then(undefined, () => findGitWin32InPath(onLookup));
}

export function findGit(hint: string | undefined, onLookup: (path: string) => void): Promise<IGit> {
const first = hint ? findSpecificGit(hint, onLookup) : Promise.reject<IGit>(null);

return first
.then(void 0, () => {
.then(undefined, () => {
switch (process.platform) {
case 'darwin': return findGitDarwin(onLookup);
case 'win32': return findGitWin32(onLookup);
Expand Down Expand Up @@ -248,7 +248,7 @@ export class GitError {
this.error = data.error;
this.message = data.error.message;
} else {
this.error = void 0;
this.error = undefined;
this.message = '';
}

Expand Down Expand Up @@ -308,7 +308,7 @@ function getGitErrorCode(stderr: string): string | undefined {
return GitErrorCodes.InvalidBranchName;
}

return void 0;
return undefined;
}

export class Git {
Expand Down Expand Up @@ -1376,15 +1376,15 @@ export class Repository {
throw new Error('Not in a branch');
}

return { name: result.stdout.trim(), commit: void 0, type: RefType.Head };
return { name: result.stdout.trim(), commit: undefined, type: RefType.Head };
} catch (err) {
const result = await this.run(['rev-parse', 'HEAD']);

if (!result.stdout) {
throw new Error('Error parsing HEAD');
}

return { name: void 0, commit: result.stdout.trim(), type: RefType.Head };
return { name: undefined, commit: result.stdout.trim(), type: RefType.Head };
}
}

Expand Down
2 changes: 1 addition & 1 deletion extensions/git/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function anyEvent<T>(...events: Event<T>[]): Event<T> {
}

export function done<T>(promise: Promise<T>): Promise<void> {
return promise.then<void>(() => void 0);
return promise.then<void>(() => undefined);
}

export function onceEvent<T>(event: Event<T>): Event<T> {
Expand Down
6 changes: 3 additions & 3 deletions extensions/html-language-features/client/src/tagClosing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function activateTagClosing(tagProvider: (document: TextDocument, positio
updateEnabledState();
window.onDidChangeActiveTextEditor(updateEnabledState, null, disposables);

let timeout: NodeJS.Timer | undefined = void 0;
let timeout: NodeJS.Timer | undefined = undefined;

function updateEnabledState() {
isEnabled = false;
Expand All @@ -26,7 +26,7 @@ export function activateTagClosing(tagProvider: (document: TextDocument, positio
if (!supportedLanguages[document.languageId]) {
return;
}
if (!workspace.getConfiguration(void 0, document.uri).get<boolean>(configName)) {
if (!workspace.getConfiguration(undefined, document.uri).get<boolean>(configName)) {
return;
}
isEnabled = true;
Expand Down Expand Up @@ -68,7 +68,7 @@ export function activateTagClosing(tagProvider: (document: TextDocument, positio
}
}
});
timeout = void 0;
timeout = undefined;
}, 100);
}
return Disposable.from(...disposables);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function getDocumentSettings(textDocument: TextDocument, needsDocumentSettings:
}
return promise;
}
return Promise.resolve(void 0);
return Promise.resolve(undefined);
}

// After the server has started the client sends an initialize request. The server receives
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function getLanguageModelCache<T>(maxEntries: number, cleanupIntervalTime
let languageModels: { [uri: string]: { version: number, languageId: string, cTime: number, languageModel: T } } = {};
let nModels = 0;

let cleanupInterval: NodeJS.Timer | undefined = void 0;
let cleanupInterval: NodeJS.Timer | undefined = undefined;
if (cleanupIntervalTimeInSec > 0) {
cleanupInterval = setInterval(() => {
let cutoffTime = Date.now() - cleanupIntervalTimeInSec * 1000;
Expand Down Expand Up @@ -73,7 +73,7 @@ export function getLanguageModelCache<T>(maxEntries: number, cleanupIntervalTime
dispose() {
if (typeof cleanupInterval !== 'undefined') {
clearInterval(cleanupInterval);
cleanupInterval = void 0;
cleanupInterval = undefined;
languageModels = {};
nModels = 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function getDocumentRegions(languageService: LanguageService, document: T
if (/["'](module|(text|application)\/(java|ecma)script)["']/.test(scanner.getTokenText())) {
languageIdFromType = 'javascript';
} else {
languageIdFromType = void 0;
languageIdFromType = undefined;
}
} else {
let attributeLanguageId = getAttributeLanguage(lastAttributeName!);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function limitRanges(ranges: FoldingRange[], maxRanges: number) {

// compute each range's nesting level in 'nestingLevels'.
// count the number of ranges for each level in 'nestingLevelCounts'
let top: FoldingRange | undefined = void 0;
let top: FoldingRange | undefined = undefined;
let previous: FoldingRange[] = [];
let nestingLevels: number[] = [];
let nestingLevelCounts: number[] = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function getJavaScriptMode(documentRegions: LanguageModelCache<HTMLDocume
return {
getText: (start, end) => text.substring(start, end),
getLength: () => text.length,
getChangeRange: () => void 0
getChangeRange: () => undefined
};
},
getCurrentDirectory: () => '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export function getLanguageModes(supportedLanguages: { [languageId: string]: boo
if (languageId) {
return modes[languageId];
}
return void 0;
return undefined;
},
getModesInRange(document: TextDocument, range: Range): LanguageModeRange[] {
return documentRegions.get(document).getLanguageRanges(range).map(r => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ suite('HTML Embedded Support', () => {
assertLanguageId('<script type="text/ecmascript">var| i = 0;</script>', 'javascript');
assertLanguageId('<script type="application/javascript">var| i = 0;</script>', 'javascript');
assertLanguageId('<script type="application/ecmascript">var| i = 0;</script>', 'javascript');
assertLanguageId('<script type="application/typescript">var| i = 0;</script>', void 0);
assertLanguageId('<script type="application/typescript">var| i = 0;</script>', undefined);
assertLanguageId('<script type=\'text/javascript\'>var| i = 0;</script>', 'javascript');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ suite('HTML Folding', () => {
/*19*/' </span>',
/*20*/'</div>',
];
assertRanges(input, [r(0, 19), r(1, 18), r(2, 3), r(5, 11), r(6, 7), r(9, 10), r(13, 14), r(16, 17)], 'no limit', void 0);
assertRanges(input, [r(0, 19), r(1, 18), r(2, 3), r(5, 11), r(6, 7), r(9, 10), r(13, 14), r(16, 17)], 'no limit', undefined);
assertRanges(input, [r(0, 19), r(1, 18), r(2, 3), r(5, 11), r(6, 7), r(9, 10), r(13, 14), r(16, 17)], 'limit 8', 8);
assertRanges(input, [r(0, 19), r(1, 18), r(2, 3), r(5, 11), r(6, 7), r(13, 14), r(16, 17)], 'limit 7', 7);
assertRanges(input, [r(0, 19), r(1, 18), r(2, 3), r(5, 11), r(13, 14), r(16, 17)], 'limit 6', 6);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ suite('HTML Embedded Formatting', () => {
formatOptions = FormattingOptions.create(2, true);
}

let result = format(languageModes, document, range, formatOptions, void 0, { css: true, javascript: true });
let result = format(languageModes, document, range, formatOptions, undefined, { css: true, javascript: true });

let actual = TextDocument.applyEdits(document, result);
assert.equal(actual, expected, message);
Expand Down Expand Up @@ -67,8 +67,8 @@ suite('HTML Embedded Formatting', () => {

test('HTLM & Scripts - Fixtures', function () {
assertFormatWithFixture('19813.html', '19813.html');
assertFormatWithFixture('19813.html', '19813-4spaces.html', void 0, FormattingOptions.create(4, true));
assertFormatWithFixture('19813.html', '19813-tab.html', void 0, FormattingOptions.create(1, false));
assertFormatWithFixture('19813.html', '19813-4spaces.html', undefined, FormattingOptions.create(4, true));
assertFormatWithFixture('19813.html', '19813-tab.html', undefined, FormattingOptions.create(1, false));
assertFormatWithFixture('21634.html', '21634.html');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function getDocumentContext(documentUri: string, workspaceFolders: Worksp
return folderURI;
}
}
return void 0;
return undefined;
}

return {
Expand Down
2 changes: 1 addition & 1 deletion extensions/json-language-features/client/src/jsonMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ function getPackageInfo(context: ExtensionContext): IPackageInfo | undefined {
aiKey: extensionPackage.aiKey
};
}
return void 0;
return undefined;
}

function readJSONFile(location: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
const capabilities: ServerCapabilities = {
// Tell the client that the server works in FULL text document sync mode
textDocumentSync: documents.syncKind,
completionProvider: clientSnippetSupport ? { resolveProvider: true, triggerCharacters: ['"', ':'] } : void 0,
completionProvider: clientSnippetSupport ? { resolveProvider: true, triggerCharacters: ['"', ':'] } : undefined,
hoverProvider: true,
documentSymbolProvider: true,
documentRangeFormattingProvider: false,
Expand Down Expand Up @@ -174,8 +174,8 @@ interface JSONSchemaSettings {
schema?: JSONSchema;
}

let jsonConfigurationSettings: JSONSchemaSettings[] | undefined = void 0;
let schemaAssociations: ISchemaAssociations | undefined = void 0;
let jsonConfigurationSettings: JSONSchemaSettings[] | undefined = undefined;
let schemaAssociations: ISchemaAssociations | undefined = undefined;
let formatterRegistration: Thenable<Disposable> | null = null;

// The settings have changed. Is send on server activation as well.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function getLanguageModelCache<T>(maxEntries: number, cleanupIntervalTime
let languageModels: { [uri: string]: { version: number, languageId: string, cTime: number, languageModel: T } } = {};
let nModels = 0;

let cleanupInterval: NodeJS.Timer | undefined = void 0;
let cleanupInterval: NodeJS.Timer | undefined = undefined;
if (cleanupIntervalTimeInSec > 0) {
cleanupInterval = setInterval(() => {
let cutoffTime = Date.now() - cleanupIntervalTimeInSec * 1000;
Expand Down Expand Up @@ -73,7 +73,7 @@ export function getLanguageModelCache<T>(maxEntries: number, cleanupIntervalTime
dispose() {
if (typeof cleanupInterval !== 'undefined') {
clearInterval(cleanupInterval);
cleanupInterval = void 0;
cleanupInterval = undefined;
languageModels = {};
nModels = 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ export class OpenDocumentLinkCommand implements Command {
return this.tryOpen(p + '.md', args);
}
const resource = vscode.Uri.file(p);
return Promise.resolve(void 0)
return Promise.resolve(undefined)
.then(() => vscode.commands.executeCommand('vscode.open', resource))
.then(() => void 0);
.then(() => undefined);
});
}

Expand Down
4 changes: 2 additions & 2 deletions extensions/npm/src/features/bowerJSONContribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ export class BowerJSONContribution implements IJSONContribution {
} catch (e) {
// ignore
}
return void 0;
return undefined;
}, () => {
return void 0;
return undefined;
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default class PHPValidationProvider {
}
this.trigger = RunTrigger.from(section.get<string>('validate.run', RunTrigger.strings.onSave));
}
if (this.executableIsUserDefined !== true && this.workspaceStore.get<string | undefined>(CheckedExecutablePath, undefined) !== void 0) {
if (this.executableIsUserDefined !== true && this.workspaceStore.get<string | undefined>(CheckedExecutablePath, undefined) !== undefined) {
vscode.commands.executeCommand('setContext', 'php.untrustValidationExecutableContext', true);
}
this.delayers = Object.create(null);
Expand Down Expand Up @@ -195,7 +195,7 @@ export default class PHPValidationProvider {
delayer.trigger(() => this.doValidate(textDocument));
};

if (this.executableIsUserDefined !== void 0 && !this.executableIsUserDefined) {
if (this.executableIsUserDefined !== undefined && !this.executableIsUserDefined) {
let checkedExecutablePath = this.workspaceStore.get<string | undefined>(CheckedExecutablePath, undefined);
if (!checkedExecutablePath || checkedExecutablePath !== this.executable) {
vscode.window.showInformationMessage<MessageItem>(
Expand Down
Loading

0 comments on commit ef2547d

Please sign in to comment.