@emeryld/manager 1.4.3 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -103,13 +103,13 @@ function ensureFileSnapshot(fileSnapshots, filePath, normalizedLines, lines, sou
|
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
function fingerprintLine(entry) {
|
|
106
|
+
if (entry.isImport)
|
|
107
|
+
return undefined;
|
|
106
108
|
if (entry.normalized)
|
|
107
109
|
return entry.normalized;
|
|
108
110
|
const collapsed = entry.trimmed.replace(/\s+/g, ' ');
|
|
109
111
|
if (!collapsed)
|
|
110
112
|
return undefined;
|
|
111
|
-
if (!/[A-Za-z0-9]/.test(collapsed))
|
|
112
|
-
return undefined;
|
|
113
113
|
return collapsed.toLowerCase();
|
|
114
114
|
}
|
|
115
115
|
function buildOccurrenceInfo(occurrence, fileSnapshots) {
|
|
@@ -136,7 +136,17 @@ function expandDuplicateTracker(tracker, fileSnapshots) {
|
|
|
136
136
|
if (infos.length < 2)
|
|
137
137
|
return undefined;
|
|
138
138
|
expandRangeAcrossOccurrences(infos);
|
|
139
|
-
const primary = infos
|
|
139
|
+
const primary = infos.reduce((current, info) => {
|
|
140
|
+
if (!current)
|
|
141
|
+
return info;
|
|
142
|
+
const pathComparison = current.file.localeCompare(info.file);
|
|
143
|
+
if (pathComparison > 0)
|
|
144
|
+
return info;
|
|
145
|
+
if (pathComparison === 0 && info.startIndex < current.startIndex) {
|
|
146
|
+
return info;
|
|
147
|
+
}
|
|
148
|
+
return current;
|
|
149
|
+
}, infos[0]);
|
|
140
150
|
const lines = primary.snapshot.normalizedLines
|
|
141
151
|
.slice(primary.startIndex, primary.endIndex + 1)
|
|
142
152
|
.map((entry) => entry.trimmed)
|
|
@@ -154,9 +164,16 @@ function expandDuplicateTracker(tracker, fileSnapshots) {
|
|
|
154
164
|
endLine,
|
|
155
165
|
endColumn,
|
|
156
166
|
});
|
|
167
|
+
const detailInfos = [...infos].sort((a, b) => {
|
|
168
|
+
const pathComparison = a.file.localeCompare(b.file);
|
|
169
|
+
if (pathComparison !== 0)
|
|
170
|
+
return pathComparison;
|
|
171
|
+
return a.startIndex - b.startIndex;
|
|
172
|
+
});
|
|
173
|
+
const detail = detailInfos.map(formatOccurrenceDetail).join('\n');
|
|
157
174
|
return {
|
|
158
175
|
snippet,
|
|
159
|
-
detail
|
|
176
|
+
detail,
|
|
160
177
|
requiredVariables,
|
|
161
178
|
};
|
|
162
179
|
}
|