-
Notifications
You must be signed in to change notification settings - Fork 115
Add search item tooltip #2523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add search item tooltip #2523
Changes from all commits
2af5b58
0843250
958de1f
128cbbf
d48e73a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ export namespace Search { | |
export async function searchMembers(connection: IBMi, library: string, sourceFile: string, searchTerm: string, members: string|IBMiMember[], readOnly?: boolean,): Promise<SearchResults> { | ||
const config = connection.getConfig(); | ||
const content = connection.getContent(); | ||
const infoComponent = connection.getComponent<GetMemberInfo>(GetMemberInfo.ID); | ||
|
||
if (connection && config && content) { | ||
let detailedMembers: IBMiMember[]|undefined; | ||
|
@@ -47,26 +48,24 @@ export namespace Search { | |
const [lib, spf] = dir.split(`/`); | ||
return detailedMembers!.some(member => member.name === name && member.library === lib && member.file === spf); | ||
}); | ||
} | ||
|
||
} else { | ||
// Else, we need to fetch the member info for each hit so we can display the correct extension | ||
const infoComponent = connection?.getComponent<GetMemberInfo>(GetMemberInfo.ID); | ||
const memberInfos: IBMiMember[] = hits.map(hit => { | ||
const { name, dir } = path.parse(hit.path); | ||
const [library, file] = dir.split(`/`); | ||
|
||
return { | ||
name, | ||
library, | ||
file, | ||
extension: `` | ||
}; | ||
}); | ||
// We need to fetch the member info for each hit so we can display the correct extension and info. | ||
const memberInfos: IBMiMember[] = hits.map(hit => { | ||
const { name, dir } = path.parse(hit.path); | ||
const [library, file] = dir.split(`/`); | ||
|
||
detailedMembers = await infoComponent?.getMultipleMemberInfo(connection, memberInfos); | ||
} | ||
return { | ||
name, | ||
library, | ||
file, | ||
extension: `` | ||
}; | ||
}); | ||
|
||
// Then fix the extensions in the hit | ||
detailedMembers = await infoComponent?.getMultipleMemberInfo(connection, memberInfos); | ||
|
||
// Add extension and member info to the hit. | ||
for (const hit of hits) { | ||
const { name, dir } = path.parse(hit.path); | ||
const [lib, spf] = dir.split(`/`); | ||
|
@@ -75,6 +74,7 @@ export namespace Search { | |
|
||
if (foundMember) { | ||
hit.path = connection.sysNameInLocal(`${asp ? `${asp}/` : ``}${lib}/${spf}/${name}.${foundMember.extension}`); | ||
hit.member = foundMember; | ||
} | ||
} | ||
|
||
|
@@ -110,9 +110,13 @@ export namespace Search { | |
}); | ||
|
||
if (grepRes.code == 0) { | ||
const hits = parseGrepOutput(grepRes.stdout); | ||
for (var i = 0; i < hits.length; i++) { | ||
hits[i].file = await connection.content.getFileInfo(hits[i].path) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Has this been testing with a large There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It has not been tested, but both |
||
}; | ||
return { | ||
term: searchTerm, | ||
hits: parseGrepOutput(grepRes.stdout) | ||
hits: hits | ||
} | ||
} | ||
} else { | ||
|
@@ -141,9 +145,13 @@ export namespace Search { | |
}); | ||
|
||
if (findRes.code == 0 && findRes.stdout) { | ||
const hits = parseFindOutput(findRes.stdout); | ||
for (var i = 0; i < hits.length; i++) { | ||
hits[i].file = await connection.content.getFileInfo(hits[i].path) | ||
}; | ||
return { | ||
term: findTerm, | ||
hits: parseFindOutput(findRes.stdout) | ||
hits: hits | ||
} | ||
} | ||
} else { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are going to need some new test cases for this method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will add some test cases...