Skip to content
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

Fix filtering objects when filter contains both source files and other object types #2457

Merged
merged 5 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ Thanks so much to everyone [who has contributed](https://github.com/codefori/vsc
* [@NicolasSchindler](https://github.com/NicolasSchindler)
* [@marcin-ogon](https://github.com/marcin-ogon)
* [@Detrytus59](https://github.com/Detrytus59)
* [@janfh](https://github.com/janfh)
6 changes: 4 additions & 2 deletions src/api/IBMiContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,6 @@ export default class IBMiContent {
const nameFilter = parseFilter(filters.object, filters.filterType);
const objectFilter = filters.object && (nameFilter.noFilter || singleEntry) && filters.object !== `*` ? this.ibmi.upperCaseName(filters.object) : undefined;

const typeFilter = filters.types && filters.types.length > 1 ? (t: string) => filters.types?.includes(t) : undefined;
const type = filters.types && filters.types.length === 1 && filters.types[0] !== '*' ? filters.types[0] : '*ALL';

const sourceFilesOnly = filters.types && filters.types.length === 1 && filters.types.includes(`*SRCPF`);
Expand Down Expand Up @@ -615,7 +614,10 @@ export default class IBMiContent {
owner: object.OWNER,
asp: this.ibmi.aspInfo[Number(object.IASP_NUMBER)]
} as IBMiObject))
.filter(object => !typeFilter || typeFilter(object.type))
.filter(object => !filters.types || filters.types.length < 1
|| filters.types.includes('*ALL')
|| (filters.types.includes('*SRCPF') && object.sourceFile)
|| filters.types.includes(object.type))
.filter(object => objectFilter || nameFilter.test(object.name))
.sort((a, b) => {
if (a.library.localeCompare(b.library) != 0) {
Expand Down
Loading