Skip to content

Commit

Permalink
Use fast OBJECT_STATISTICS call to list all libarries in QSYS fs
Browse files Browse the repository at this point in the history
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
  • Loading branch information
sebjulliand committed Jan 31, 2025
1 parent 2b7dfb0 commit 7299a1b
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions src/filesystems/qsys/QSysFs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,19 +242,23 @@ export class QSysFS implements vscode.FileSystemProvider {
}

async readDirectory(uri: vscode.Uri): Promise<[string, vscode.FileType][]> {
const content = instance.getConnection()?.content;
if (content) {
const qsysPath = Tools.parseQSysPath(uri.path);
if (qsysPath.name) {
return (await content.getMemberList({ library: qsysPath.library, sourceFile: qsysPath.name }))
.map(member => [`${member.name}${member.extension ? `.${member.extension}` : ''}`, vscode.FileType.File]);
}
else if (qsysPath.library) {
return (await content.getObjectList({ library: qsysPath.library, types: ["*SRCPF"] }))
.map(srcPF => [srcPF.name, vscode.FileType.Directory]);
}
else if (uri.path === '/') {
return (await content.getLibraries({ library: '*' })).map(library => [library.name, vscode.FileType.Directory]);
const connection = instance.getConnection();
if (connection) {
const content = connection.getContent();
if (content) {
const qsysPath = Tools.parseQSysPath(uri.path);
if (qsysPath.name) {
return (await content.getMemberList({ library: qsysPath.library, sourceFile: qsysPath.name }))
.map(member => [`${member.name}${member.extension ? `.${member.extension}` : ''}`, vscode.FileType.File]);
}
else if (qsysPath.library) {
return (await content.getObjectList({ library: qsysPath.library, types: ["*SRCPF"] }))
.map(srcPF => [srcPF.name, vscode.FileType.Directory]);
}
else if (uri.path === '/') {
return (await connection.runSQL(`select OBJNAME from table (QSYS2.OBJECT_STATISTICS ('*ALLSIMPLE', 'LIB', '*ALLSIMPLE'))`))
.map(row => [row.OBJNAME as string, vscode.FileType.Directory]);
}
}
}
throw FileSystemError.FileNotFound(uri);
Expand Down

0 comments on commit 7299a1b

Please sign in to comment.