From b06584bff2951b9460dbd30cc2434daf3215b9c2 Mon Sep 17 00:00:00 2001 From: x13machine Date: Fri, 12 Apr 2019 15:08:26 -0500 Subject: [PATCH] solve the issue #670 Configure similarity index for diffs --- README.md | 1 + package-lock.json | 4 ++- package.json | 6 ++++ src/config.ts | 1 + src/container.ts | 15 +++----- src/extension.ts | 12 +++---- src/git/formatters/commitFormatter.ts | 9 ++--- src/git/formatters/formatter.ts | 15 +++----- src/git/formatters/statusFormatter.ts | 9 ++--- src/git/git.ts | 10 ++++-- src/git/gitService.ts | 2 +- src/git/models/branch.ts | 9 ++--- src/git/models/logCommit.ts | 3 +- src/git/models/repository.ts | 9 ++--- src/git/models/status.ts | 3 +- src/git/parsers/blameParser.ts | 9 ++--- src/git/parsers/diffParser.ts | 3 +- src/git/parsers/logParser.ts | 24 +++++-------- src/git/parsers/remoteParser.ts | 3 +- src/git/parsers/stashParser.ts | 3 +- src/git/parsers/statusParser.ts | 9 ++--- src/git/remotes/azure-devops.ts | 9 ++--- src/git/remotes/bitbucket-server.ts | 6 ++-- src/git/remotes/bitbucket.ts | 6 ++-- src/git/remotes/custom.ts | 6 ++-- src/git/remotes/factory.ts | 3 +- src/git/remotes/github.ts | 6 ++-- src/git/remotes/gitlab.ts | 6 ++-- src/git/remotes/provider.ts | 3 +- src/keyboard.ts | 9 ++--- src/logger.ts | 24 +++++-------- src/messages.ts | 12 +++---- src/system/decorators/gate.ts | 3 +- src/system/decorators/log.ts | 36 +++++++------------ src/system/decorators/memoize.ts | 6 ++-- src/views/nodes/branchTrackingStatusNode.ts | 6 ++-- src/views/nodes/commitFileNode.ts | 12 +++---- src/views/nodes/commitNode.ts | 6 ++-- src/views/nodes/compareNode.ts | 9 ++--- src/views/nodes/comparePickerNode.ts | 3 +- src/views/nodes/fileHistoryNode.ts | 6 ++-- src/views/nodes/folderNode.ts | 3 +- src/views/nodes/remoteNode.ts | 12 +++---- src/views/nodes/repositoriesNode.ts | 6 ++-- src/views/nodes/resultsFilesNode.ts | 8 +++-- src/views/nodes/searchNode.ts | 3 +- src/views/nodes/statusFileNode.ts | 18 ++++------ src/views/nodes/statusFilesNode.ts | 9 ++--- src/views/nodes/viewNode.ts | 3 +- src/webviews/apps/shared/appBase.ts | 3 +- src/webviews/apps/shared/appWithConfigBase.ts | 21 ++++------- src/webviews/apps/shared/theme.ts | 3 +- 52 files changed, 156 insertions(+), 269 deletions(-) diff --git a/README.md b/README.md index be88105bbb487..192dc7040a0f3 100644 --- a/README.md +++ b/README.md @@ -804,6 +804,7 @@ See also [View Settings](#view-settings- 'Jump to the View settings') | `gitlens.views.compare.avatars` | Specifies whether to show avatar images instead of commit (or status) icons in the _Compare_ view | | `gitlens.views.compare.files.compact` | Specifies whether to compact (flatten) unnecessary file nesting in the _Compare_ view. Only applies when `gitlens.views.compare.files.layout` is set to `tree` or `auto` | | `gitlens.views.compare.enabled` | Specifies whether to show the _Compare_ view | +| `gitlens.views.compare.findRenames` | Specifies the threshold for the rename similarity index. | | `gitlens.views.compare.files.layout` | Specifies how the _Compare_ view will display files

`auto` - automatically switches between displaying files as a `tree` or `list` based on the `gitlens.views.compare.files.threshold` value and the number of files at each nesting level
`list` - displays files as a list
`tree` - displays files as a tree | | `gitlens.views.compare.files.threshold` | Specifies when to switch between displaying files as a `tree` or `list` based on the number of files in a nesting level in the _Compare_ view. Only applies when `gitlens.views.compare.files.layout` is set to `auto` | | `gitlens.views.compare.location` | Specifies where to show the _Compare_ view

`gitlens` - adds to the GitLens side bar
`explorer` - adds to the Explorer side bar
`scm` - adds to the Source Control side bar | diff --git a/package-lock.json b/package-lock.json index 3cbe83631d6ed..68914e04c27d0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "gitlens", - "version": "9.5.1", + "version": "9.6.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -3182,6 +3182,8 @@ }, "eslint-plugin-prettiest": { "version": "0.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettiest/-/eslint-plugin-prettiest-0.0.1.tgz", + "integrity": "sha512-h1IbSAXPYh0dYlJYK4J7+a2yaHqHaGcFK1nUVAAPx8JZXSSzdai9uB7PMeS2Z8PQ4b6xpAA44Ky9uPujXCwp5g==", "dev": true, "requires": { "requireindex": "1.2.0" diff --git a/package.json b/package.json index d417e33b7ac24..215fa05ab3286 100644 --- a/package.json +++ b/package.json @@ -1279,6 +1279,12 @@ "markdownDescription": "Specifies whether to show avatar images instead of commit (or status) icons in the _Compare_ view", "scope": "window" }, + "gitlens.views.compare.findRenames": { + "type": "number", + "default": 50, + "markdownDescription": "Specifies the threshold for the rename similarity index.", + "scope": "window" + }, "gitlens.views.compare.enabled": { "type": "boolean", "default": true, diff --git a/src/config.ts b/src/config.ts index 366c7c464bdb8..eb1175608558b 100644 --- a/src/config.ts +++ b/src/config.ts @@ -237,6 +237,7 @@ export interface CompareViewConfig { avatars: boolean; enabled: boolean; files: ViewsFilesConfig; + findRenames: number; location: 'explorer' | 'gitlens' | 'scm'; } diff --git a/src/container.ts b/src/container.ts index 9c32608d80c44..295d185232a55 100644 --- a/src/container.ts +++ b/src/container.ts @@ -54,8 +54,7 @@ export class Container { if (config.views.compare.enabled) { context.subscriptions.push((this._compareView = new CompareView())); - } - else { + } else { let disposable: Disposable; // eslint-disable-next-line prefer-const disposable = configuration.onDidChange(e => { @@ -68,8 +67,7 @@ export class Container { if (config.views.fileHistory.enabled) { context.subscriptions.push((this._fileHistoryView = new FileHistoryView())); - } - else { + } else { let disposable: Disposable; // eslint-disable-next-line prefer-const disposable = configuration.onDidChange(e => { @@ -82,8 +80,7 @@ export class Container { if (config.views.lineHistory.enabled) { context.subscriptions.push((this._lineHistoryView = new LineHistoryView())); - } - else { + } else { let disposable: Disposable; // eslint-disable-next-line prefer-const disposable = configuration.onDidChange(e => { @@ -96,8 +93,7 @@ export class Container { if (config.views.repositories.enabled) { context.subscriptions.push((this._repositoriesView = new RepositoriesView())); - } - else { + } else { let disposable: Disposable; // eslint-disable-next-line prefer-const disposable = configuration.onDidChange(e => { @@ -110,8 +106,7 @@ export class Container { if (config.views.search.enabled) { context.subscriptions.push((this._searchView = new SearchView())); - } - else { + } else { let disposable: Disposable; // eslint-disable-next-line prefer-const disposable = configuration.onDidChange(e => { diff --git a/src/extension.ts b/src/extension.ts index e8fb0860a01e4..72a0bb453ea62 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -53,8 +53,7 @@ export async function activate(context: ExtensionContext) { try { await GitService.initialize(); - } - catch (ex) { + } catch (ex) { Logger.error(ex, `GitLens(v${gitlensVersion}).activate`); setCommandContext(CommandContext.Enabled, false); @@ -105,8 +104,7 @@ async function migrateSettings(context: ExtensionContext, previousVersion: strin await configuration.migrate('views.avatars', configuration.name('views')('compare')('avatars').value); await configuration.migrate('views.avatars', configuration.name('views')('repositories')('avatars').value); await configuration.migrate('views.avatars', configuration.name('views')('search')('avatars').value); - } - else if (Versions.compare(previous, Versions.from(9, 0, 0)) !== 1) { + } else if (Versions.compare(previous, Versions.from(9, 0, 0)) !== 1) { await configuration.migrate( 'gitExplorer.autoRefresh', configuration.name('views')('repositories')('autoRefresh').value @@ -258,8 +256,7 @@ async function migrateSettings(context: ExtensionContext, previousVersion: strin } }); } - } - catch (ex) { + } catch (ex) { Logger.error(ex, 'migrateSettings'); } } @@ -298,8 +295,7 @@ async function showWelcomePage(version: string, previousVersion: string | undefi if (Container.config.showWhatsNewAfterUpgrades && major !== prevMajor) { await commands.executeCommand(Commands.ShowWelcomePage); - } - else { + } else { await Messages.showWhatsNewMessage(version); } } diff --git a/src/git/formatters/commitFormatter.ts b/src/git/formatters/commitFormatter.ts index f270582f485d1..76529bffc3873 100644 --- a/src/git/formatters/commitFormatter.ts +++ b/src/git/formatters/commitFormatter.ts @@ -173,19 +173,16 @@ export class CommitFormatter extends Formatter { let message: string; if (this._item.isStagedUncommitted) { message = 'Staged changes'; - } - else if (this._item.isUncommitted) { + } else if (this._item.isUncommitted) { message = 'Uncommitted changes'; - } - else { + } else { if (this._options.truncateMessageAtNewLine) { const index = this._item.message.indexOf('\n'); message = index === -1 ? this._item.message : `${this._item.message.substring(0, index)}${GlyphChars.Space}${GlyphChars.Ellipsis}`; - } - else { + } else { message = this._item.message; } diff --git a/src/git/formatters/formatter.ts b/src/git/formatters/formatter.ts index 1372fafb4b3f7..4fd2a28e768ad 100644 --- a/src/git/formatters/formatter.ts +++ b/src/git/formatters/formatter.ts @@ -62,8 +62,7 @@ export abstract class Formatter let icon; if (statusFile.workingTreeStatus !== undefined && statusFile.indexStatus !== undefined) { icon = `${GlyphChars.Pencil}${GlyphChars.Space}${GlyphChars.SpaceThinnest}${GlyphChars.Check}`; - } - else if (statusFile.workingTreeStatus !== undefined) { + } else if (statusFile.workingTreeStatus !== undefined) { icon = `${GlyphChars.Pencil}${GlyphChars.SpaceThin}${GlyphChars.SpaceThinnest}${GlyphChars.EnDash}${ GlyphChars.Space }`; - } - else if (statusFile.indexStatus !== undefined) { + } else if (statusFile.indexStatus !== undefined) { icon = `${GlyphChars.Space}${GlyphChars.EnDash}${GlyphChars.Space.repeat(2)}${GlyphChars.Check}`; - } - else { + } else { icon = ''; } return this._padOrTruncate(icon, this._options.tokenOptions.working); diff --git a/src/git/git.ts b/src/git/git.ts index 00c86ebfbb961..31afe1d758e98 100644 --- a/src/git/git.ts +++ b/src/git/git.ts @@ -550,8 +550,14 @@ export class Git { } } - static diff_nameStatus(repoPath: string, ref1?: string, ref2?: string, options: { filter?: string } = {}) { - const params = ['diff', '--name-status', '-M', '--no-ext-diff']; + static diff_nameStatus( + repoPath: string, + ref1?: string, + ref2?: string, + options: { filter?: string; findRenames?: number } = {} + ) { + const renameParameter = options.findRenames == null ? '-M' : `-M${options.findRenames}%`; + const params = ['diff', '--name-status', renameParameter, '--no-ext-diff']; if (options && options.filter) { params.push(`--diff-filter=${options.filter}`); } diff --git a/src/git/gitService.ts b/src/git/gitService.ts index c3d339fd80fde..8e6318fe26eb1 100644 --- a/src/git/gitService.ts +++ b/src/git/gitService.ts @@ -1282,7 +1282,7 @@ export class GitService implements Disposable { repoPath: string, ref1?: string, ref2?: string, - options: { filter?: string } = {} + options: { filter?: string; findRenames?: number } = {} ): Promise { try { const data = await Git.diff_nameStatus(repoPath, ref1, ref2, options); diff --git a/src/git/models/branch.ts b/src/git/models/branch.ts index 90a06c60bc637..ac1b3fff54721 100644 --- a/src/git/models/branch.ts +++ b/src/git/models/branch.ts @@ -32,16 +32,14 @@ export class GitBranch { if (name.startsWith('remotes/')) { name = name.substring(8); this.remote = true; - } - else { + } else { this.remote = false; } this.detached = detached || (this.current ? GitBranch.isDetached(name) : false); if (this.detached) { this.name = GitBranch.formatDetached(this.sha!); - } - else { + } else { this.name = name; } @@ -114,8 +112,7 @@ export class GitBranch { if (star) { starred![this.id] = true; - } - else { + } else { // eslint-disable-next-line @typescript-eslint/no-unused-vars const { [this.id]: _, ...rest } = starred!; starred = rest; diff --git a/src/git/models/logCommit.ts b/src/git/models/logCommit.ts index d6384e03f156b..8578b30b59dec 100644 --- a/src/git/models/logCommit.ts +++ b/src/git/models/logCommit.ts @@ -137,8 +137,7 @@ export class GitLogCommit extends GitCommit { const fileName = Strings.normalizePath(paths.relative(this.repoPath, fileNameOrFile)); file = this.files.find(f => f.fileName === fileName); if (file === undefined) return undefined; - } - else { + } else { file = fileNameOrFile; } diff --git a/src/git/models/repository.ts b/src/git/models/repository.ts index 3c97e309a125e..28563c54ecddb 100644 --- a/src/git/models/repository.ts +++ b/src/git/models/repository.ts @@ -103,12 +103,10 @@ export class Repository implements Disposable { // If it isn't within a workspace folder we can't get change events, see: https://github.com/Microsoft/vscode/issues/3025 this.supportsChangeEvents = false; this.formattedName = this.name = paths.basename(path); - } - else { + } else { this.formattedName = this.name = folder.name; } - } - else { + } else { this.formattedName = relativePath ? `${folder.name} (${relativePath})` : folder.name; this.name = folder.name; } @@ -404,8 +402,7 @@ export class Repository implements Disposable { if (star) { starred![this.id] = true; - } - else { + } else { // eslint-disable-next-line @typescript-eslint/no-unused-vars const { [this.id]: _, ...rest } = starred!; starred = rest; diff --git a/src/git/models/status.ts b/src/git/models/status.ts index b2d88802d60d5..49132c35c6471 100644 --- a/src/git/models/status.ts +++ b/src/git/models/status.ts @@ -101,8 +101,7 @@ export class GitStatus { if (deleted !== 0) { status += `${status.length === 0 ? '' : separator}-${deleted}`; } - } - else { + } else { status += `+${added}${separator}~${changed}${separator}-${deleted}`; } diff --git a/src/git/parsers/blameParser.ts b/src/git/parsers/blameParser.ts index 617f31544b4b1..c02599fa29a72 100644 --- a/src/git/parsers/blameParser.ts +++ b/src/git/parsers/blameParser.ts @@ -67,8 +67,7 @@ export class GitBlameParser { case 'author': if (Git.isUncommitted(entry.sha)) { entry.author = 'You'; - } - else { + } else { entry.author = lineParts .slice(1) .join(' ') @@ -91,8 +90,7 @@ export class GitBlameParser { const end = entry.authorEmail.indexOf('>', start); if (end > start) { entry.authorEmail = entry.authorEmail.substring(start + 1, end); - } - else { + } else { entry.authorEmail = entry.authorEmail.substring(start + 1); } } @@ -131,8 +129,7 @@ export class GitBlameParser { ) ); relativeFileName = Strings.normalizePath(paths.relative(repoPath, fileName)); - } - else { + } else { relativeFileName = entry.fileName!; } first = false; diff --git a/src/git/parsers/diffParser.ts b/src/git/parsers/diffParser.ts index da6d83055aa64..339fec27fe826 100644 --- a/src/git/parsers/diffParser.ts +++ b/src/git/parsers/diffParser.ts @@ -67,8 +67,7 @@ export class GitDiffParser { if (removed > 0) { removed--; - } - else { + } else { previousLines.push(undefined); } diff --git a/src/git/parsers/logParser.ts b/src/git/parsers/logParser.ts index 7bce9d4ac8b88..ac1b0afc79fe0 100644 --- a/src/git/parsers/logParser.ts +++ b/src/git/parsers/logParser.ts @@ -89,8 +89,7 @@ export class GitLogParser { case 97: // 'a': // author if (Git.isUncommitted(entry.ref)) { entry.author = 'You'; - } - else { + } else { entry.author = line.substring(4); } break; @@ -121,8 +120,7 @@ export class GitLogParser { if (entry.summary === undefined) { entry.summary = line; - } - else { + } else { entry.summary += `\n${line}`; } } @@ -162,8 +160,7 @@ export class GitLogParser { } entry.files.push(status); } - } - else if (line.startsWith('diff')) { + } else if (line.startsWith('diff')) { const matches = diffRegex.exec(line); if (matches != null) { let originalFileName; @@ -171,8 +168,7 @@ export class GitLogParser { if (entry.fileName !== originalFileName) { entry.originalFileName = originalFileName; entry.status = 'R'; - } - else { + } else { entry.status = 'M'; } } @@ -182,8 +178,7 @@ export class GitLogParser { if (next.done || next.value === '') break; } break; - } - else { + } else { entry.status = line[0] as GitFileStatus; entry.fileName = line.substring(1); this.parseFileName(entry); @@ -205,8 +200,7 @@ export class GitLogParser { ) ); relativeFileName = Strings.normalizePath(paths.relative(repoPath, fileName)); - } - else { + } else { relativeFileName = entry.fileName!; } first = false; @@ -214,8 +208,7 @@ export class GitLogParser { const commit = commits.get(entry.ref!); if (commit === undefined) { i++; - } - else if (truncationCount) { + } else if (truncationCount) { // Since this matches an existing commit it will be skipped, so reduce our truncationCount to ensure accurate truncation detection truncationCount--; } @@ -342,8 +335,7 @@ export class GitLogParser { if (next > 0) { entry.originalFileName = entry.fileName.substring(index, next - 1); entry.fileName = entry.fileName.substring(next); - } - else { + } else { entry.fileName = entry.fileName.substring(index); } } diff --git a/src/git/parsers/remoteParser.ts b/src/git/parsers/remoteParser.ts index fb3fddd37d95f..355a9eb188623 100644 --- a/src/git/parsers/remoteParser.ts +++ b/src/git/parsers/remoteParser.ts @@ -92,8 +92,7 @@ export class GitRemoteParser { ); remotes.push(remote); groups[uniqueness] = remote; - } - else { + } else { // Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869 remote.types.push({ url: url, type: ` ${match[3]}`.substr(1) as GitRemoteType }); } diff --git a/src/git/parsers/stashParser.ts b/src/git/parsers/stashParser.ts index 3f5d8ffa5d7f8..6e818f9514842 100644 --- a/src/git/parsers/stashParser.ts +++ b/src/git/parsers/stashParser.ts @@ -75,8 +75,7 @@ export class GitStashParser { if (entry.summary === undefined) { entry.summary = line; - } - else { + } else { entry.summary += `\n${line}`; } } diff --git a/src/git/parsers/statusParser.ts b/src/git/parsers/statusParser.ts index 07bff5fb57695..aecea47b90b3c 100644 --- a/src/git/parsers/statusParser.ts +++ b/src/git/parsers/statusParser.ts @@ -44,15 +44,13 @@ export class GitStatusParser { const behindStatus = behindStatusV1Regex.exec(upstreamStatus); state.behind = behindStatus == null ? 0 : Number(behindStatus[1]) || 0; } - } - else { + } else { const rawStatus = line.substring(0, 2); const fileName = line.substring(3); if (rawStatus[0] === 'R') { const [file1, file2] = fileName.replace(/"/g, emptyStr).split('->'); files.push(this.parseStatusFile(repoPath, rawStatus, file2.trim(), file1.trim())); - } - else { + } else { files.push(this.parseStatusFile(repoPath, rawStatus, fileName)); } } @@ -92,8 +90,7 @@ export class GitStatusParser { state.behind = Number(lineParts[3].substring(1)); break; } - } - else { + } else { const lineParts = line.split(' '); switch (lineParts[0][0]) { case '1': // normal diff --git a/src/git/remotes/azure-devops.ts b/src/git/remotes/azure-devops.ts index 9dfca914c8844..701ea23d4e020 100644 --- a/src/git/remotes/azure-devops.ts +++ b/src/git/remotes/azure-devops.ts @@ -25,8 +25,7 @@ export class AzureDevOpsRemote extends RemoteProvider { if (legacy) { domain = `${org}.${domain}`; path = `${project}/_git/${rest}`; - } - else { + } else { path = `${org}/${project}/_git/${rest}`; } } @@ -75,12 +74,10 @@ export class AzureDevOpsRemote extends RemoteProvider { if (range) { if (range.start.line === range.end.line) { line = `&line=${range.start.line}`; - } - else { + } else { line = `&line=${range.start.line}&lineEnd=${range.end.line}`; } - } - else { + } else { line = ''; } diff --git a/src/git/remotes/bitbucket-server.ts b/src/git/remotes/bitbucket-server.ts index b8ef33061987e..16b8950aef97e 100644 --- a/src/git/remotes/bitbucket-server.ts +++ b/src/git/remotes/bitbucket-server.ts @@ -50,12 +50,10 @@ export class BitbucketServerRemote extends RemoteProvider { if (range) { if (range.start.line === range.end.line) { line = `#${range.start.line}`; - } - else { + } else { line = `#${range.start.line}-${range.end.line}`; } - } - else { + } else { line = ''; } if (sha) return `${this.baseUrl}/browse/${fileName}?at=${sha}${line}`; diff --git a/src/git/remotes/bitbucket.ts b/src/git/remotes/bitbucket.ts index e38bc75f9bb6b..bcbebb0853a1d 100644 --- a/src/git/remotes/bitbucket.ts +++ b/src/git/remotes/bitbucket.ts @@ -45,12 +45,10 @@ export class BitbucketRemote extends RemoteProvider { if (range) { if (range.start.line === range.end.line) { line = `#${fileName}-${range.start.line}`; - } - else { + } else { line = `#${fileName}-${range.start.line}:${range.end.line}`; } - } - else { + } else { line = ''; } diff --git a/src/git/remotes/custom.ts b/src/git/remotes/custom.ts index 801a1f2800f20..8a3b6cb067b9d 100644 --- a/src/git/remotes/custom.ts +++ b/src/git/remotes/custom.ts @@ -37,12 +37,10 @@ export class CustomRemote extends RemoteProvider { if (range) { if (range.start.line === range.end.line) { line = Strings.interpolate(this.urls.fileLine, { line: range.start.line }); - } - else { + } else { line = Strings.interpolate(this.urls.fileRange, { start: range.start.line, end: range.end.line }); } - } - else { + } else { line = ''; } diff --git a/src/git/remotes/factory.ts b/src/git/remotes/factory.ts index 0cdde226b2628..c184d27d67131 100644 --- a/src/git/remotes/factory.ts +++ b/src/git/remotes/factory.ts @@ -43,8 +43,7 @@ export class RemoteProviderFactory { } return undefined; - } - catch (ex) { + } catch (ex) { Logger.error(ex, 'RemoteProviderFactory'); return undefined; } diff --git a/src/git/remotes/github.ts b/src/git/remotes/github.ts index b5ced8898b7ed..4e657425bc523 100644 --- a/src/git/remotes/github.ts +++ b/src/git/remotes/github.ts @@ -48,12 +48,10 @@ export class GitHubRemote extends RemoteProvider { if (range) { if (range.start.line === range.end.line) { line = `#L${range.start.line}`; - } - else { + } else { line = `#L${range.start.line}-L${range.end.line}`; } - } - else { + } else { line = ''; } diff --git a/src/git/remotes/gitlab.ts b/src/git/remotes/gitlab.ts index ad8ab7d9b7889..cd85dca1c8490 100644 --- a/src/git/remotes/gitlab.ts +++ b/src/git/remotes/gitlab.ts @@ -39,12 +39,10 @@ export class GitLabRemote extends RemoteProvider { if (range) { if (range.start.line === range.end.line) { line = `#L${range.start.line}`; - } - else { + } else { line = `#L${range.start.line}-${range.end.line}`; } - } - else { + } else { line = ''; } diff --git a/src/git/remotes/provider.ts b/src/git/remotes/provider.ts index 8442a33f9d8fd..45fedb49bbb85 100644 --- a/src/git/remotes/provider.ts +++ b/src/git/remotes/provider.ts @@ -126,8 +126,7 @@ export abstract class RemoteProvider { void (await env.clipboard.writeText(url)); return undefined; - } - catch (ex) { + } catch (ex) { if (ex.message.includes("Couldn't find the required `xsel` binary")) { window.showErrorMessage( 'Unable to copy remote url, xsel is not installed. Please install it via your package manager, e.g. `sudo apt install xsel`' diff --git a/src/keyboard.ts b/src/keyboard.ts index de37ecd76f1ad..52290c9526416 100644 --- a/src/keyboard.ts +++ b/src/keyboard.ts @@ -32,8 +32,7 @@ export class KeyboardScope implements Disposable { if (index === mappings.length - 1) { mappings.pop(); await this.updateKeyCommandsContext(mappings[mappings.length - 1]); - } - else { + } else { mappings.splice(index, 1); } } @@ -62,8 +61,7 @@ export class KeyboardScope implements Disposable { if (!mapping[key]) { mapping[key] = command; await setCommandContext(`${CommandContext.Key}:${key}`, true); - } - else { + } else { mapping[key] = command; } } @@ -111,8 +109,7 @@ export class Keyboard implements Disposable { Logger.log('Keyboard.execute', key); return await command.onDidPressKey(key); - } - catch (ex) { + } catch (ex) { Logger.error(ex, 'Keyboard.execute'); return undefined; } diff --git a/src/logger.ts b/src/logger.ts index 38422a7866be0..2bd488cdeeb28 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -44,8 +44,7 @@ export class Logger { this.output.dispose(); this.output = undefined; } - } - else { + } else { this.output = this.output || window.createOutputChannel(extensionOutputChannelName); } } @@ -58,8 +57,7 @@ export class Logger { let message; if (typeof contextOrMessage === 'string') { message = contextOrMessage; - } - else { + } else { message = params.shift(); if (contextOrMessage !== undefined) { @@ -84,8 +82,7 @@ export class Logger { let message; if (contextOrMessage === undefined || typeof contextOrMessage === 'string') { message = contextOrMessage; - } - else { + } else { message = params.shift(); if (contextOrMessage !== undefined) { @@ -130,8 +127,7 @@ export class Logger { let message; if (typeof contextOrMessage === 'string') { message = contextOrMessage; - } - else { + } else { message = params.shift(); if (contextOrMessage !== undefined) { @@ -158,8 +154,7 @@ export class Logger { let message; if (typeof contextOrMessage === 'string') { message = contextOrMessage; - } - else { + } else { message = params.shift(); if (contextOrMessage !== undefined) { @@ -184,8 +179,7 @@ export class Logger { let message; if (typeof contextOrMessage === 'string') { message = contextOrMessage; - } - else { + } else { message = params.shift(); if (contextOrMessage !== undefined) { @@ -218,8 +212,7 @@ export class Logger { try { return JSON.stringify(p, sanitize); - } - catch { + } catch { return ''; } } @@ -232,8 +225,7 @@ export class Logger { } name = instance.prototype.constructor.name; - } - else { + } else { name = instance.constructor != null ? instance.constructor.name : emptyStr; } diff --git a/src/messages.ts b/src/messages.ts index 37012468e36ce..0cd67a3961dd3 100644 --- a/src/messages.ts +++ b/src/messages.ts @@ -116,11 +116,9 @@ export class Messages { let uri; if (result === actions[0]) { uri = Uri.parse('https://www.patreon.com/eamodio'); - } - else if (result === actions[1]) { + } else if (result === actions[1]) { uri = Uri.parse('https://www.paypal.me/eamodio'); - } - else if (result === actions[2]) { + } else if (result === actions[2]) { uri = Uri.parse('https://cash.me/$eamodio'); } @@ -146,14 +144,12 @@ export class Messages { if (result != null) { if (result === actions[0]) { await commands.executeCommand(Commands.ShowWelcomePage); - } - else if (result === actions[1]) { + } else if (result === actions[1]) { await commands.executeCommand( BuiltInCommands.Open, Uri.parse('https://github.com/eamodio/vscode-gitlens/blob/master/CHANGELOG.md') ); - } - else if (result === actions[2]) { + } else if (result === actions[2]) { await commands.executeCommand( BuiltInCommands.Open, Uri.parse('https://gitlens.amod.io/#support-gitlens') diff --git a/src/system/decorators/gate.ts b/src/system/decorators/gate.ts index 22d0cd156f42a..3530ff61507eb 100644 --- a/src/system/decorators/gate.ts +++ b/src/system/decorators/gate.ts @@ -6,8 +6,7 @@ export function gate() { let fn: Function | undefined; if (typeof descriptor.value === 'function') { fn = descriptor.value; - } - else if (typeof descriptor.get === 'function') { + } else if (typeof descriptor.get === 'function') { fn = descriptor.get; } if (fn == null) throw new Error('Not supported'); diff --git a/src/system/decorators/log.ts b/src/system/decorators/log.ts index 85343f34202e5..11e81aa6a30d7 100644 --- a/src/system/decorators/log.ts +++ b/src/system/decorators/log.ts @@ -89,8 +89,7 @@ export function log any>( let fn: Function | undefined; if (typeof descriptor.value === 'function') { fn = descriptor.value; - } - else if (typeof descriptor.get === 'function') { + } else if (typeof descriptor.get === 'function') { fn = descriptor.get; } if (fn == null) throw new Error('Not supported'); @@ -115,8 +114,7 @@ export function log any>( if (this.constructor != null && this.constructor[LogInstanceNameFn]) { instanceName = target.constructor[LogInstanceNameFn](this, instanceName); } - } - else { + } else { instanceName = emptyStr; } @@ -157,8 +155,7 @@ export function log any>( if (!options.singleLine) { logFn(`${prefix}${enter}`); } - } - else { + } else { const argFns = typeof options.args === 'object' ? options.args : undefined; let argFn; let loggable; @@ -170,8 +167,7 @@ export function log any>( if (argFn !== undefined) { loggable = argFn(v); if (loggable === false) return undefined; - } - else { + } else { loggable = Logger.toLoggable(v, options.sanitize); } @@ -183,8 +179,7 @@ export function log any>( if (!options.singleLine) { if (!options.debug) { Logger.logWithDebugParams(`${prefix}${enter}`, loggableParams); - } - else { + } else { logFn(`${prefix}${enter}`, loggableParams); } } @@ -207,8 +202,7 @@ export function log any>( }${timing}`, loggableParams ); - } - else { + } else { Logger.error( ex, prefix, @@ -228,8 +222,7 @@ export function log any>( let result; try { result = fn!.apply(this, args); - } - catch (ex) { + } catch (ex) { logError(ex); throw ex; } @@ -241,12 +234,10 @@ export function log any>( if (options.exit != null) { try { exit = options.exit(r); - } - catch (ex) { + } catch (ex) { exit = `@log.exit error: ${ex}`; } - } - else { + } else { exit = 'completed'; } @@ -260,8 +251,7 @@ export function log any>( }${timing}`, loggableParams ); - } - else { + } else { logFn( `${prefix}${enter} ${exit}${ correlationContext !== undefined && correlationContext.exitDetails @@ -271,8 +261,7 @@ export function log any>( loggableParams ); } - } - else { + } else { logFn( `${prefix} ${exit}${ correlationContext !== undefined && correlationContext.exitDetails @@ -290,8 +279,7 @@ export function log any>( if (result != null && Functions.isPromise(result)) { const promise = result.then(logResult); promise.catch(logError); - } - else { + } else { logResult(result); } diff --git a/src/system/decorators/memoize.ts b/src/system/decorators/memoize.ts index 367e77c9b0f0b..dd6ce20a349ce 100644 --- a/src/system/decorators/memoize.ts +++ b/src/system/decorators/memoize.ts @@ -11,12 +11,10 @@ export function memoize(target: any, key: string, descriptor: any) { if (fn!.length !== 0) { console.warn('Memoize should only be used in functions with no parameters'); } - } - else if (typeof descriptor.get === 'function') { + } else if (typeof descriptor.get === 'function') { fn = descriptor.get; fnKey = 'get'; - } - else { + } else { throw new Error('Not supported'); } diff --git a/src/views/nodes/branchTrackingStatusNode.ts b/src/views/nodes/branchTrackingStatusNode.ts index dabfbc2437d32..e3b91e3fbd03c 100644 --- a/src/views/nodes/branchTrackingStatusNode.ts +++ b/src/views/nodes/branchTrackingStatusNode.ts @@ -62,8 +62,7 @@ export class BranchTrackingStatusNode extends ViewNode implements } children = [...insertDateMarkers(Iterables.map(commits, c => new CommitNode(this.view, this, c)), this, 1)]; - } - else { + } else { children = [ ...insertDateMarkers( Iterables.map(log.commits.values(), c => new CommitNode(this.view, this, c)), @@ -89,8 +88,7 @@ export class BranchTrackingStatusNode extends ViewNode implements item.id = this.id; if (this._root) { item.contextValue = ahead ? ResourceType.StatusAheadOfUpstream : ResourceType.StatusBehindUpstream; - } - else { + } else { item.contextValue = ahead ? ResourceType.BranchStatusAheadOfUpstream : ResourceType.BranchStatusBehindUpstream; diff --git a/src/views/nodes/commitFileNode.ts b/src/views/nodes/commitFileNode.ts index d999dac1fe6a8..56f37ce7cc19b 100644 --- a/src/views/nodes/commitFileNode.ts +++ b/src/views/nodes/commitFileNode.ts @@ -55,8 +55,7 @@ export class CommitFileNode extends ViewRefNode { if (log !== undefined) { this.commit = log.commits.get(this.commit.sha) || this.commit; } - } - else { + } else { this.commit = commit; } } @@ -71,15 +70,13 @@ export class CommitFileNode extends ViewRefNode { dark: Container.context.asAbsolutePath(paths.join('images', 'dark', 'icon-commit.svg')), light: Container.context.asAbsolutePath(paths.join('images', 'light', 'icon-commit.svg')) }; - } - else if ((this._displayAs & CommitFileNodeDisplayAs.StatusIcon) === CommitFileNodeDisplayAs.StatusIcon) { + } else if ((this._displayAs & CommitFileNodeDisplayAs.StatusIcon) === CommitFileNodeDisplayAs.StatusIcon) { const icon = GitFile.getStatusIcon(this.file.status); item.iconPath = { dark: Container.context.asAbsolutePath(paths.join('images', 'dark', icon)), light: Container.context.asAbsolutePath(paths.join('images', 'light', icon)) }; - } - else if ((this._displayAs & CommitFileNodeDisplayAs.Gravatar) === CommitFileNodeDisplayAs.Gravatar) { + } else if ((this._displayAs & CommitFileNodeDisplayAs.Gravatar) === CommitFileNodeDisplayAs.Gravatar) { item.iconPath = this.commit.getGravatarUri(Container.config.defaultGravatarsStyle); } @@ -164,8 +161,7 @@ export class CommitFileNode extends ViewRefNode { dateFormat: Container.config.defaultDateFormat } ); - } - else { + } else { // eslint-disable-next-line no-template-curly-in-string this._tooltip = StatusFileFormatter.fromTemplate('${file}\n${directory}/\n\n${status}', this.file); } diff --git a/src/views/nodes/commitNode.ts b/src/views/nodes/commitNode.ts index 8b10f43aa4bac..51a4ad2fca90e 100644 --- a/src/views/nodes/commitNode.ts +++ b/src/views/nodes/commitNode.ts @@ -46,8 +46,7 @@ export class CommitNode extends ViewRefNode { const root = new FolderNode(this.view, this, this.repoPath, '', hierarchy); children = (await root.getChildren()) as FileNode[]; - } - else { + } else { children.sort((a, b) => a.label!.localeCompare(b.label!, undefined, { numeric: true, sensitivity: 'base' }) ); @@ -80,8 +79,7 @@ export class CommitNode extends ViewRefNode { if (this.view.config.avatars) { item.iconPath = this.commit.getGravatarUri(Container.config.defaultGravatarsStyle); - } - else { + } else { item.iconPath = { dark: Container.context.asAbsolutePath('images/dark/icon-commit.svg'), light: Container.context.asAbsolutePath('images/light/icon-commit.svg') diff --git a/src/views/nodes/compareNode.ts b/src/views/nodes/compareNode.ts index 76d7f03c53038..a05e1f0bae76d 100644 --- a/src/views/nodes/compareNode.ts +++ b/src/views/nodes/compareNode.ts @@ -39,8 +39,7 @@ export class CompareNode extends ViewNode { if (pinned.length !== 0) { this._children.push(...pinned); } - } - else if (this._comparePickerNode === undefined || !this._children.includes(this._comparePickerNode)) { + } else if (this._comparePickerNode === undefined || !this._children.includes(this._comparePickerNode)) { // Not really sure why I can't reuse this node -- but if I do the Tree errors out with an id already exists error this._comparePickerNode = new ComparePickerNode(this.view, this); this._children.splice(0, 0, this._comparePickerNode); @@ -72,8 +71,7 @@ export class CompareNode extends ViewNode { if (pinned.length !== 0) { this._children.push(...pinned); } - } - else { + } else { if (this._comparePickerNode !== undefined) { const index = this._children.indexOf(this._comparePickerNode); if (index !== -1) { @@ -131,8 +129,7 @@ export class CompareNode extends ViewNode { if (repoPath === undefined) { repoPath = this._selectedRef.repoPath; - } - else if (repoPath !== this._selectedRef.repoPath) { + } else if (repoPath !== this._selectedRef.repoPath) { // If we don't have a matching repoPath, then start over void this.selectForCompare(repoPath, ref); return; diff --git a/src/views/nodes/comparePickerNode.ts b/src/views/nodes/comparePickerNode.ts index 2e0cfd818659c..b3c996b5ad433 100644 --- a/src/views/nodes/comparePickerNode.ts +++ b/src/views/nodes/comparePickerNode.ts @@ -40,8 +40,7 @@ export class ComparePickerNode extends ViewNode { title: `Compare${GlyphChars.Ellipsis}`, command: this.view.getQualifiedCommand('selectForCompare') }; - } - else { + } else { item = new TreeItem( `Compare ${selectedRef.label} with `, TreeItemCollapsibleState.None diff --git a/src/views/nodes/fileHistoryNode.ts b/src/views/nodes/fileHistoryNode.ts index 07de67018eb66..634de68d2fe07 100644 --- a/src/views/nodes/fileHistoryNode.ts +++ b/src/views/nodes/fileHistoryNode.ts @@ -39,12 +39,10 @@ export class FileHistoryNode extends SubscribeableViewNode { sha = GitService.uncommittedSha; if (status.indexStatus !== undefined) { previousSha = GitService.stagedUncommittedSha; - } - else if (status.workingTreeStatus !== '?') { + } else if (status.workingTreeStatus !== '?') { previousSha = 'HEAD'; } - } - else { + } else { sha = GitService.stagedUncommittedSha; previousSha = 'HEAD'; } diff --git a/src/views/nodes/folderNode.ts b/src/views/nodes/folderNode.ts index 3e0a0ab5c370a..6ce04154bcbb4 100644 --- a/src/views/nodes/folderNode.ts +++ b/src/views/nodes/folderNode.ts @@ -60,8 +60,7 @@ export class FolderNode extends ViewNode { folder.value.relativePath = this.root.relativePath; children.push(folder.value); } - } - else { + } else { this.root.descendants.forEach(n => (n.relativePath = this.root.relativePath)); children = this.root.descendants; } diff --git a/src/views/nodes/remoteNode.ts b/src/views/nodes/remoteNode.ts index beae153a8daed..8f70246c86972 100644 --- a/src/views/nodes/remoteNode.ts +++ b/src/views/nodes/remoteNode.ts @@ -75,14 +75,11 @@ export class RemoteNode extends ViewNode { let separator; if (fetch && push) { separator = GlyphChars.ArrowLeftRightLong; - } - else if (fetch) { + } else if (fetch) { separator = GlyphChars.ArrowLeft; - } - else if (push) { + } else if (push) { separator = GlyphChars.ArrowRight; - } - else { + } else { separator = GlyphChars.Dash; } @@ -105,8 +102,7 @@ export class RemoteNode extends ViewNode { dark: Container.context.asAbsolutePath(`images/dark/icon-${this.remote.provider.icon}.svg`), light: Container.context.asAbsolutePath(`images/light/icon-${this.remote.provider.icon}.svg`) }; - } - else { + } else { item.iconPath = { dark: Container.context.asAbsolutePath('images/dark/icon-remote.svg'), light: Container.context.asAbsolutePath('images/light/icon-remote.svg') diff --git a/src/views/nodes/repositoriesNode.ts b/src/views/nodes/repositoriesNode.ts index 4b756d3ed054b..37a6ed0d470aa 100644 --- a/src/views/nodes/repositoriesNode.ts +++ b/src/views/nodes/repositoriesNode.ts @@ -82,8 +82,7 @@ export class RepositoriesNode extends SubscribeableViewNode { if (child !== undefined) { children.push(child); void child.refresh(); - } - else { + } else { children.push(new RepositoryNode(GitUri.fromRepoPath(repo.path), this.view, this, repo)); } } @@ -134,8 +133,7 @@ export class RepositoriesNode extends SubscribeableViewNode { } void this.view.reveal(node, { expand: true }); - } - catch (ex) { + } catch (ex) { Logger.error(ex); } } diff --git a/src/views/nodes/resultsFilesNode.ts b/src/views/nodes/resultsFilesNode.ts index 0a0c70d899672..fa1c5e83afc3c 100644 --- a/src/views/nodes/resultsFilesNode.ts +++ b/src/views/nodes/resultsFilesNode.ts @@ -44,8 +44,7 @@ export class ResultsFilesNode extends ViewNode { const root = new FolderNode(this.view, this, this.repoPath, '', hierarchy); children = (await root.getChildren()) as FileNode[]; - } - else { + } else { children.sort( (a, b) => a.priority - b.priority || @@ -82,7 +81,10 @@ export class ResultsFilesNode extends ViewNode { } private async getFilesQueryResultsCore(): Promise { - const diff = await Container.git.getDiffStatus(this.uri.repoPath!, this._ref1, this._ref2); + const diff = await Container.git.getDiffStatus(this.uri.repoPath!, this._ref1, this._ref2, { + findRenames: Container.config.views.compare.findRenames + }); + return { label: `${Strings.pluralize('file', diff !== undefined ? diff.length : 0, { zero: 'No' })} changed`, diff: diff diff --git a/src/views/nodes/searchNode.ts b/src/views/nodes/searchNode.ts index 5a5d1c48a8391..740568ffb6a6e 100644 --- a/src/views/nodes/searchNode.ts +++ b/src/views/nodes/searchNode.ts @@ -113,8 +113,7 @@ export class SearchNode extends ViewNode { if (this._children.length !== 0 && replace) { this._children.length = 0; this._children.push(results); - } - else { + } else { this._children.splice(0, 0, results); } diff --git a/src/views/nodes/statusFileNode.ts b/src/views/nodes/statusFileNode.ts index 17d50d28162d6..ffeed3cbfcf9b 100644 --- a/src/views/nodes/statusFileNode.ts +++ b/src/views/nodes/statusFileNode.ts @@ -25,8 +25,7 @@ export class StatusFileNode extends ViewNode { for (const c of this.commits) { if (c.isStagedUncommitted) { this._hasStagedChanges = true; - } - else if (c.isUncommitted) { + } else if (c.isUncommitted) { this._hasUnstagedChanges = true; } @@ -63,8 +62,7 @@ export class StatusFileNode extends ViewNode { '${file}\n${directory}/\n\n${status} in Index (staged)', this.file ); - } - else { + } else { item.contextValue += '+unstaged'; item.tooltip = StatusFileFormatter.fromTemplate( // eslint-disable-next-line no-template-curly-in-string @@ -78,26 +76,22 @@ export class StatusFileNode extends ViewNode { item.iconPath = ThemeIcon.File; item.command = this.getCommand(); - } - else { + } else { item.collapsibleState = TreeItemCollapsibleState.Collapsed; if (this._hasStagedChanges || this._hasUnstagedChanges) { item.contextValue = ResourceType.File; if (this._hasStagedChanges && this._hasUnstagedChanges) { item.contextValue += '+staged+unstaged'; - } - else if (this._hasStagedChanges) { + } else if (this._hasStagedChanges) { item.contextValue += '+staged'; - } - else { + } else { item.contextValue += '+unstaged'; } // Use the file icon and decorations item.resourceUri = GitUri.resolveToUri(this.file.fileName, this.repoPath); item.iconPath = ThemeIcon.File; - } - else { + } else { item.contextValue = ResourceType.StatusFileCommits; const icon = GitFile.getStatusIcon(this.file.status); diff --git a/src/views/nodes/statusFilesNode.ts b/src/views/nodes/statusFilesNode.ts index fcf0d9bef5ac5..f4c60676e1b66 100644 --- a/src/views/nodes/statusFilesNode.ts +++ b/src/views/nodes/statusFilesNode.ts @@ -70,8 +70,7 @@ export class StatusFilesNode extends ViewNode { this.toStatusFile(s, GitService.uncommittedSha, GitService.stagedUncommittedSha), this.toStatusFile(s, GitService.stagedUncommittedSha, 'HEAD', older) ]; - } - else if (s.indexStatus !== undefined) { + } else if (s.indexStatus !== undefined) { return [this.toStatusFile(s, GitService.stagedUncommittedSha, 'HEAD')]; } @@ -102,8 +101,7 @@ export class StatusFilesNode extends ViewNode { const root = new FolderNode(this.view, this, repoPath, '', hierarchy, true); children = (await root.getChildren()) as FileNode[]; - } - else { + } else { children.sort( (a, b) => a.priority - b.priority || @@ -131,8 +129,7 @@ export class StatusFilesNode extends ViewNode { files = uniques.size; } - } - else { + } else { const stats = await Container.git.getChangedFilesCount(this.repoPath, `${this.status.upstream}...`); if (stats !== undefined) { files += stats.files; diff --git a/src/views/nodes/viewNode.ts b/src/views/nodes/viewNode.ts index 4951f45dc4ce7..24d1396d7d2df 100644 --- a/src/views/nodes/viewNode.ts +++ b/src/views/nodes/viewNode.ts @@ -205,8 +205,7 @@ export abstract class SubscribeableViewNode extends V if (e.element === this) { this._state = e.state; this.onStateChanged(e.state); - } - else if (e.element === this.parent) { + } else if (e.element === this.parent) { this.onParentStateChanged(e.state); } } diff --git a/src/webviews/apps/shared/appBase.ts b/src/webviews/apps/shared/appBase.ts index c637a392d21d8..0867403c7ca21 100644 --- a/src/webviews/apps/shared/appBase.ts +++ b/src/webviews/apps/shared/appBase.ts @@ -60,8 +60,7 @@ export abstract class App { private nextIpcId() { if (ipcSequence === Number.MAX_SAFE_INTEGER) { ipcSequence = 1; - } - else { + } else { ipcSequence++; } diff --git a/src/webviews/apps/shared/appWithConfigBase.ts b/src/webviews/apps/shared/appWithConfigBase.ts index 789d3012cb1b5..f145a6f0d6150 100644 --- a/src/webviews/apps/shared/appWithConfigBase.ts +++ b/src/webviews/apps/shared/appWithConfigBase.ts @@ -112,8 +112,7 @@ export abstract class AppWithConfig e if (element.checked) { set(setting, props.join('.'), fromCheckboxValue(element.value)); - } - else { + } else { set(setting, props.join('.'), false); } @@ -128,8 +127,7 @@ export abstract class AppWithConfig e if (!setting.includes(element.value)) { setting.push(element.value); } - } - else { + } else { const i = setting.indexOf(element.value); if (i !== -1) { setting.splice(i, 1); @@ -143,8 +141,7 @@ export abstract class AppWithConfig e default: { if (element.checked) { this._changes[element.name] = fromCheckboxValue(element.value); - } - else { + } else { this._changes[element.name] = false; } @@ -293,8 +290,7 @@ export abstract class AppWithConfig e option.selected = true; } } - } - finally { + } finally { this._updating = false; } @@ -317,15 +313,13 @@ export abstract class AppWithConfig e const disabled = !this.evaluateStateExpression(el.dataset.enablement!, state); if (disabled) { el.setAttribute('disabled', ''); - } - else { + } else { el.removeAttribute('disabled'); } if (el.matches('input,select')) { (el as HTMLInputElement | HTMLSelectElement).disabled = disabled; - } - else { + } else { const input = el.querySelector('input,select'); if (input == null) continue; @@ -397,8 +391,7 @@ function flatten(o: { [key: string]: any }, path?: string): { [key: string]: any if (typeof value === 'object') { Object.assign(results, flatten(value, path === undefined ? key : `${path}.${key}`)); - } - else { + } else { results[path === undefined ? key : `${path}.${key}`] = value; } } diff --git a/src/webviews/apps/shared/theme.ts b/src/webviews/apps/shared/theme.ts index 41117a885c255..c74a0b652c06e 100644 --- a/src/webviews/apps/shared/theme.ts +++ b/src/webviews/apps/shared/theme.ts @@ -14,8 +14,7 @@ export function initializeAndWatchThemeColors() { bodyStyle.setProperty('--font-family', font); bodyStyle.setProperty('--font-size', computedStyle.getPropertyValue('--vscode-font-size').trim()); bodyStyle.setProperty('--font-weight', computedStyle.getPropertyValue('--vscode-font-weight').trim()); - } - else { + } else { bodyStyle.setProperty( '--font-family', computedStyle.getPropertyValue('--vscode-editor-font-family').trim()