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 showing of CSP files in project folders #1408

Merged
merged 2 commits into from
Jul 24, 2024
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
10 changes: 7 additions & 3 deletions src/commands/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ async function pickAdditions(
if (items.findIndex((pi) => pi.Type == "DIR" && pi.Name == app) == -1) {
return {
label: "$(folder) " + app,
fullName: app,
fullName: i,
buttons: [
{
iconPath: new vscode.ThemeIcon("chevron-right"),
Expand Down Expand Up @@ -536,7 +536,7 @@ async function pickAdditions(
if (category == "CLS" || !item.fullName.includes("/")) {
tmpParams = [item.fullName + "/*.cls", sys, gen, project, item.fullName + ".", item.fullName + "."];
} else {
tmpParams = [item.fullName + "/*", sys, gen, project, item.fullName + "/"];
tmpParams = [item.fullName + "/*", sys, gen, project, item.fullName.slice(1) + "/"];
}
if (category == undefined) {
if (item.fullName.includes("/")) {
Expand Down Expand Up @@ -749,7 +749,11 @@ export async function modifyProject(

let newAdd: ProjectItem[] = [];
let newRemove: ProjectItem[] = [];
const addResult = addProjectItem(type == "CLS" || type == "PKG" ? pick.slice(0, -4) : pick, type, items);
const addResult = addProjectItem(
type == "CLS" || type == "PKG" ? pick.slice(0, -4) : type == "CSP" || type == "DIR" ? pick.slice(1) : pick,
type,
items
);
newAdd = addResult.add;
newRemove = addResult.remove;

Expand Down
2 changes: 1 addition & 1 deletion src/utils/FileProviderUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export async function projectContentsFromUri(uri: vscode.Uri, overrideFlat?: boo
`SELECT DISTINCT BY (${nameCol}) ${nameCol} ` +
"Name, Type FROM %Studio.Project_ProjectItemsList(?,1) AS pil WHERE " +
"(Type = 'MAC' AND EXISTS (SELECT sod.Size FROM %Library.RoutineMgr_StudioOpenDialog('*.mac,*.int,*.inc,*.bas,*.mvi',1,1,1,1,0,1) AS sod WHERE pil.Name = sod.Name)) OR " +
"(Type = 'CSP' AND EXISTS (SELECT sod.Size FROM %Library.RoutineMgr_StudioOpenDialog('*.cspall',1,1,1,1,0,1) AS sod WHERE pil.Name = sod.Name)) OR " +
"(Type = 'CSP' AND EXISTS (SELECT sod.Size FROM %Library.RoutineMgr_StudioOpenDialog('*.cspall',1,1,1,1,0,1) AS sod WHERE '/'||pil.Name = sod.Name)) OR " +
"(Type NOT IN ('CLS','PKG','MAC','CSP','DIR','GBL') AND EXISTS (SELECT sod.Size FROM %Library.RoutineMgr_StudioOpenDialog('*.other',1,1,1,1,0,1) AS sod WHERE " +
"$PIECE(sod.Name,'.',1,$LENGTH(sod.Name,'.')-1) = $PIECE(pil.Name,'.',1,$LENGTH(pil.Name,'.')-1) AND UPPER($PIECE(sod.Name,'.',$LENGTH(sod.Name,'.'))) = $PIECE(pil.Name,'.',$LENGTH(pil.Name,'.')))) OR " +
"(Type = 'CLS' AND EXISTS (SELECT dcd.ID FROM %Dictionary.ClassDefinition AS dcd WHERE dcd.ID = pil.Name)) OR " +
Expand Down