mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 02:28:34 +01:00
auto-fixed prefer-const violation
This commit is contained in:
@@ -78,8 +78,8 @@ export class ReferencesModel implements SymbolItemNavigation<FileItem | Referenc
|
||||
}
|
||||
|
||||
private static _compareUriIgnoreFragment(a: vscode.Uri, b: vscode.Uri): number {
|
||||
let aStr = a.with({ fragment: '' }).toString();
|
||||
let bStr = b.with({ fragment: '' }).toString();
|
||||
const aStr = a.with({ fragment: '' }).toString();
|
||||
const bStr = b.with({ fragment: '' }).toString();
|
||||
if (aStr < bStr) {
|
||||
return -1;
|
||||
} else if (aStr > bStr) {
|
||||
@@ -89,16 +89,16 @@ export class ReferencesModel implements SymbolItemNavigation<FileItem | Referenc
|
||||
}
|
||||
|
||||
private static _compareLocations(a: vscode.Location | vscode.LocationLink, b: vscode.Location | vscode.LocationLink): number {
|
||||
let aUri = a instanceof vscode.Location ? a.uri : a.targetUri;
|
||||
let bUri = b instanceof vscode.Location ? b.uri : b.targetUri;
|
||||
const aUri = a instanceof vscode.Location ? a.uri : a.targetUri;
|
||||
const bUri = b instanceof vscode.Location ? b.uri : b.targetUri;
|
||||
if (aUri.toString() < bUri.toString()) {
|
||||
return -1;
|
||||
} else if (aUri.toString() > bUri.toString()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
let aRange = a instanceof vscode.Location ? a.range : a.targetRange;
|
||||
let bRange = b instanceof vscode.Location ? b.range : b.targetRange;
|
||||
const aRange = a instanceof vscode.Location ? a.range : a.targetRange;
|
||||
const bRange = b instanceof vscode.Location ? b.range : b.targetRange;
|
||||
if (aRange.start.isBefore(bRange.start)) {
|
||||
return -1;
|
||||
} else if (aRange.start.isAfter(bRange.start)) {
|
||||
@@ -163,10 +163,10 @@ export class ReferencesModel implements SymbolItemNavigation<FileItem | Referenc
|
||||
|
||||
// (3) pick the file with the longest common prefix
|
||||
let best = 0;
|
||||
let bestValue = ReferencesModel._prefixLen(this.items[best].toString(), uri.toString());
|
||||
const bestValue = ReferencesModel._prefixLen(this.items[best].toString(), uri.toString());
|
||||
|
||||
for (let i = 1; i < this.items.length; i++) {
|
||||
let value = ReferencesModel._prefixLen(this.items[i].uri.toString(), uri.toString());
|
||||
const value = ReferencesModel._prefixLen(this.items[i].uri.toString(), uri.toString());
|
||||
if (value > bestValue) {
|
||||
best = i;
|
||||
}
|
||||
@@ -340,7 +340,7 @@ export class FileItem {
|
||||
|
||||
async asCopyText() {
|
||||
let result = `${vscode.workspace.asRelativePath(this.uri)}\n`;
|
||||
for (let ref of this.references) {
|
||||
for (const ref of this.references) {
|
||||
result += ` ${await ref.asCopyText()}\n`;
|
||||
}
|
||||
return result;
|
||||
@@ -379,8 +379,8 @@ export class ReferenceItem {
|
||||
}
|
||||
|
||||
async asCopyText() {
|
||||
let doc = await this.getDocument();
|
||||
let chunks = getPreviewChunks(doc, this.location.range, 21, false);
|
||||
const doc = await this.getDocument();
|
||||
const chunks = getPreviewChunks(doc, this.location.range, 21, false);
|
||||
return `${this.location.range.start.line + 1}, ${this.location.range.start.character + 1}: ${chunks.before + chunks.inside + chunks.after}`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user