mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 11:08:51 +01:00
auto-fixed prefer-const violation
This commit is contained in:
@@ -349,7 +349,7 @@ function setCaseInsensitive(env: { [key: string]: unknown }, key: string, value:
|
||||
|
||||
function removeNulls(env: { [key: string]: unknown | null }): void {
|
||||
// Don't delete while iterating the object itself
|
||||
for (let key of Object.keys(env)) {
|
||||
for (const key of Object.keys(env)) {
|
||||
if (env[key] === null) {
|
||||
delete env[key];
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ export class RemoteAgentEnvironmentChannel implements IServerChannel {
|
||||
|
||||
const _massageWhenUserArr = (elements: WhenUser[] | WhenUser) => {
|
||||
if (Array.isArray(elements)) {
|
||||
for (let element of elements) {
|
||||
for (const element of elements) {
|
||||
_massageWhenUser(element);
|
||||
}
|
||||
} else {
|
||||
@@ -261,7 +261,7 @@ export class RemoteAgentEnvironmentChannel implements IServerChannel {
|
||||
};
|
||||
|
||||
const _massageLocWhenUser = (target: LocWhenUser) => {
|
||||
for (let loc in target) {
|
||||
for (const loc in target) {
|
||||
_massageWhenUserArr(target[loc]);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -392,11 +392,11 @@ export class RemoteExtensionHostAgentServer extends Disposable implements IServe
|
||||
// We have received a new connection.
|
||||
// This indicates that the server owner has connectivity.
|
||||
// Therefore we will shorten the reconnection grace period for disconnected connections!
|
||||
for (let key in this._managementConnections) {
|
||||
for (const key in this._managementConnections) {
|
||||
const managementConnection = this._managementConnections[key];
|
||||
managementConnection.shortenReconnectionGraceTimeIfNecessary();
|
||||
}
|
||||
for (let key in this._extHostConnections) {
|
||||
for (const key in this._extHostConnections) {
|
||||
const extHostConnection = this._extHostConnections[key];
|
||||
extHostConnection.shortenReconnectionGraceTimeIfNecessary();
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ export function getNLSConfiguration(language: string, userDataPath: string): Pro
|
||||
// console.log(`==> MetaData or commit unknown. Using default language.`);
|
||||
return Promise.resolve({ locale: 'en', availableLanguages: {} });
|
||||
}
|
||||
let key = `${language}||${userDataPath}`;
|
||||
const key = `${language}||${userDataPath}`;
|
||||
let result = _cache.get(key);
|
||||
if (!result) {
|
||||
result = lp.getNLSConfiguration(product.commit, userDataPath, metaData, language).then(value => {
|
||||
@@ -40,7 +40,7 @@ export function getNLSConfiguration(language: string, userDataPath: string): Pro
|
||||
|
||||
export namespace InternalNLSConfiguration {
|
||||
export function is(value: lp.NLSConfiguration): value is lp.InternalNLSConfiguration {
|
||||
let candidate: lp.InternalNLSConfiguration = value as lp.InternalNLSConfiguration;
|
||||
const candidate: lp.InternalNLSConfiguration = value as lp.InternalNLSConfiguration;
|
||||
return candidate && typeof candidate._languagePackId === 'string';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ export function main(desc: ProductDescription, args: string[]): void {
|
||||
|
||||
const inputPaths = parsedArgs['_'];
|
||||
let hasReadStdinArg = false;
|
||||
for (let input of inputPaths) {
|
||||
for (const input of inputPaths) {
|
||||
if (input === '-') {
|
||||
hasReadStdinArg = true;
|
||||
} else {
|
||||
@@ -217,15 +217,15 @@ export function main(desc: ProductDescription, args: string[]): void {
|
||||
}
|
||||
|
||||
|
||||
let newCommandline: string[] = [];
|
||||
for (let key in parsedArgs) {
|
||||
let val = parsedArgs[key as keyof typeof parsedArgs];
|
||||
const newCommandline: string[] = [];
|
||||
for (const key in parsedArgs) {
|
||||
const val = parsedArgs[key as keyof typeof parsedArgs];
|
||||
if (typeof val === 'boolean') {
|
||||
if (val) {
|
||||
newCommandline.push('--' + key);
|
||||
}
|
||||
} else if (Array.isArray(val)) {
|
||||
for (let entry of val) {
|
||||
for (const entry of val) {
|
||||
newCommandline.push(`--${key}=${entry.toString()}`);
|
||||
}
|
||||
} else if (val) {
|
||||
@@ -320,8 +320,8 @@ async function waitForFileDeleted(path: string) {
|
||||
}
|
||||
|
||||
function openInBrowser(args: string[], verbose: boolean) {
|
||||
let uris: string[] = [];
|
||||
for (let location of args) {
|
||||
const uris: string[] = [];
|
||||
for (const location of args) {
|
||||
try {
|
||||
if (/^(http|https|file):\/\//.test(location)) {
|
||||
uris.push(_url.parse(location).href);
|
||||
@@ -417,10 +417,10 @@ function pathToURI(input: string): _url.URL {
|
||||
}
|
||||
|
||||
function translatePath(input: string, mapFileUri: (input: string) => string, folderURIS: string[], fileURIS: string[]) {
|
||||
let url = pathToURI(input);
|
||||
let mappedUri = mapFileUri(url.href);
|
||||
const url = pathToURI(input);
|
||||
const mappedUri = mapFileUri(url.href);
|
||||
try {
|
||||
let stat = _fs.lstatSync(_fs.realpathSync(input));
|
||||
const stat = _fs.lstatSync(_fs.realpathSync(input));
|
||||
|
||||
if (stat.isFile()) {
|
||||
fileURIS.push(mappedUri);
|
||||
@@ -443,6 +443,6 @@ function mapFileToRemoteUri(uri: string): string {
|
||||
return uri.replace(/^file:\/\//, 'vscode-remote://' + cliRemoteAuthority);
|
||||
}
|
||||
|
||||
let [, , productName, version, commit, executableName, ...remainingArgs] = process.argv;
|
||||
const [, , productName, version, commit, executableName, ...remainingArgs] = process.argv;
|
||||
main({ productName, version, commit, executableName }, remainingArgs);
|
||||
|
||||
|
||||
@@ -255,7 +255,7 @@ export class WebClientServer {
|
||||
);
|
||||
|
||||
const newQuery = Object.create(null);
|
||||
for (let key in parsedUrl.query) {
|
||||
for (const key in parsedUrl.query) {
|
||||
if (key !== connectionTokenQueryName) {
|
||||
newQuery[key] = parsedUrl.query[key];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user