Rename the forEachProject
function to something sane
This commit is contained in:
parent
fb0d720da7
commit
db6f5bd832
3 changed files with 6 additions and 11 deletions
|
@ -94,12 +94,7 @@ namespace ts {
|
|||
export function contains<T>(array: T[], value: T, areEqual?: (a: T, b: T) => boolean): boolean {
|
||||
if (array) {
|
||||
for (const v of array) {
|
||||
if (areEqual) {
|
||||
if (areEqual(v, value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (v === value) {
|
||||
if (areEqual ? areEqual(v, value) : v === value) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -464,7 +464,7 @@ namespace ts.server {
|
|||
return copiedList;
|
||||
}
|
||||
|
||||
export function forEachProject<T>(projects: Project[], action: (project: Project) => T[], comparer?: (a: T, b: T) => number, areEqual?: (a: T, b: T) => boolean) {
|
||||
export function processEachProjectThenConcatSortDeduplicateResults<T>(projects: Project[], action: (project: Project) => T[], comparer?: (a: T, b: T) => number, areEqual?: (a: T, b: T) => boolean) {
|
||||
const result = projects.reduce<T[]>((previous, current) => concatenate(previous, action(current)), []).sort(comparer);
|
||||
return projects.length > 1 ? deduplicate(result, areEqual) : result;
|
||||
}
|
||||
|
|
|
@ -434,7 +434,7 @@ namespace ts.server {
|
|||
};
|
||||
}
|
||||
|
||||
const fileSpans = forEachProject(
|
||||
const fileSpans = processEachProjectThenConcatSortDeduplicateResults(
|
||||
projects,
|
||||
(project: Project) => {
|
||||
const compilerService = project.compilerService;
|
||||
|
@ -511,7 +511,7 @@ namespace ts.server {
|
|||
const nameSpan = nameInfo.textSpan;
|
||||
const nameColStart = defaultProject.compilerService.host.positionToLineOffset(file, nameSpan.start).offset;
|
||||
const nameText = defaultProject.compilerService.host.getScriptSnapshot(file).getText(nameSpan.start, ts.textSpanEnd(nameSpan));
|
||||
const refs = forEachProject<protocol.ReferencesResponseItem>(
|
||||
const refs = processEachProjectThenConcatSortDeduplicateResults<protocol.ReferencesResponseItem>(
|
||||
projects,
|
||||
(project: Project) => {
|
||||
const compilerService = project.compilerService;
|
||||
|
@ -872,7 +872,7 @@ namespace ts.server {
|
|||
throw Errors.NoProject;
|
||||
}
|
||||
|
||||
const allNavToItems = forEachProject(
|
||||
const allNavToItems = processEachProjectThenConcatSortDeduplicateResults(
|
||||
projects,
|
||||
(project: Project) => {
|
||||
const compilerService = project.compilerService;
|
||||
|
@ -891,7 +891,7 @@ namespace ts.server {
|
|||
start: start,
|
||||
end: end,
|
||||
};
|
||||
if (navItem.kindModifiers && (navItem.kindModifiers != "")) {
|
||||
if (navItem.kindModifiers && (navItem.kindModifiers !== "")) {
|
||||
bakedItem.kindModifiers = navItem.kindModifiers;
|
||||
}
|
||||
if (navItem.matchKind !== "none") {
|
||||
|
|
Loading…
Reference in a new issue