Skip to content

Commit 54adadd

Browse files
committed
fix lgtm warnings
1 parent 1539caf commit 54adadd

6 files changed

Lines changed: 11 additions & 11 deletions

File tree

extensions/npm/src/features/bowerJSONContribution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export class BowerJSONContribution implements IJSONContribution {
167167
if (url.indexOf('git://') === 0) {
168168
url = url.substring(6);
169169
}
170-
if (url.lastIndexOf('.git') === url.length - 4) {
170+
if (url.length >= 4 && url.substr(url.length - 4) === '.git') {
171171
url = url.substring(0, url.length - 4);
172172
}
173173
return url;

extensions/npm/src/features/packageJSONContribution.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ export class PackageJSONContribution implements IJSONContribution {
229229
if ((location.matches(['dependencies', '*']) || location.matches(['devDependencies', '*']) || location.matches(['optionalDependencies', '*']) || location.matches(['peerDependencies', '*']))) {
230230
const currentKey = location.path[location.path.length - 1];
231231
if (typeof currentKey === 'string') {
232-
const queryUrl = 'https://registry.npmjs.org/' + encodeURIComponent(currentKey).replace('%40', '@');
232+
const queryUrl = 'https://registry.npmjs.org/' + encodeURIComponent(currentKey).replace(/%40/g, '@');
233233
return this.xhr({
234234
url: queryUrl,
235235
agent: USER_AGENT
@@ -289,7 +289,7 @@ export class PackageJSONContribution implements IJSONContribution {
289289

290290
private getInfo(pack: string): Thenable<string[]> {
291291

292-
const queryUrl = 'https://registry.npmjs.org/' + encodeURIComponent(pack).replace('%40', '@');
292+
const queryUrl = 'https://registry.npmjs.org/' + encodeURIComponent(pack).replace(/%40/g, '@');
293293
return this.xhr({
294294
url: queryUrl,
295295
agent: USER_AGENT

src/vs/base/common/json.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,10 @@ export function createScanner(text: string, ignoreTrivia: boolean = false): JSON
205205
token: SyntaxKind = SyntaxKind.Unknown,
206206
scanError: ScanError = ScanError.None;
207207

208-
function scanHexDigits(count: number, exact?: boolean): number {
208+
function scanHexDigits(count: number): number {
209209
let digits = 0;
210210
let value = 0;
211-
while (digits < count || !exact) {
211+
while (digits < count) {
212212
let ch = text.charCodeAt(pos);
213213
if (ch >= CharacterCodes._0 && ch <= CharacterCodes._9) {
214214
value = value * 16 + ch - CharacterCodes._0;
@@ -331,7 +331,7 @@ export function createScanner(text: string, ignoreTrivia: boolean = false): JSON
331331
result += '\t';
332332
break;
333333
case CharacterCodes.u:
334-
let ch = scanHexDigits(4, true);
334+
let ch = scanHexDigits(4);
335335
if (ch >= 0) {
336336
result += String.fromCharCode(ch);
337337
} else {

src/vs/code/electron-main/windows.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -551,9 +551,6 @@ export class WindowsManager implements IWindowsMainService {
551551
if (lastActiveWindow) {
552552
usedWindows.push(this.doAddFoldersToExistingWindow(lastActiveWindow, foldersToAdd));
553553
}
554-
555-
// Reset because we handled them
556-
foldersToAdd = [];
557554
}
558555

559556
// Handle files to open/diff or to create when we dont open a folder and we do not restore any folder/untitled from hot-exit

src/vs/workbench/services/themes/electron-browser/colorThemeData.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,10 @@ function _loadColorTheme(fileService: IFileService, themeLocation: URI, resultRu
322322

323323
let pListParser: Promise<{ parse(content: string) }>;
324324
function getPListParser() {
325-
return pListParser || import('fast-plist');
325+
if (!pListParser) {
326+
pListParser = import('fast-plist');
327+
}
328+
return pListParser;
326329
}
327330

328331
function _loadSyntaxTokens(fileService: IFileService, themeLocation: URI, resultRules: ITokenColorizationRule[], resultColors: IColorMap): Promise<any> {

src/vs/workbench/services/themes/electron-browser/workbenchThemeService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
125125
themeData = ColorThemeData.fromStorageData(persistedThemeData);
126126
}
127127
let containerBaseTheme = this.getBaseThemeFromContainer();
128-
if (!themeData || themeData && themeData.baseTheme !== containerBaseTheme) {
128+
if (!themeData || themeData.baseTheme !== containerBaseTheme) {
129129
themeData = ColorThemeData.createUnloadedTheme(containerBaseTheme);
130130
}
131131
themeData.setCustomColors(this.colorCustomizations);

0 commit comments

Comments
 (0)