Skip to content

Commit 711886c

Browse files
committed
Only show web app files for server-side web app folders
1 parent 6f489c1 commit 711886c

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

src/utils/documentPicker.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as vscode from "vscode";
22
import { AtelierAPI } from "../api";
3-
import { cspAppsForApi, handleError } from ".";
3+
import { cspAppsForApi, handleError, notIsfs } from ".";
4+
import { isfsConfig } from "./FileProviderUtil";
45

56
interface DocumentPickerItem extends vscode.QuickPickItem {
67
/** The full name of this item, including its parent(s). */
@@ -293,6 +294,9 @@ export async function pickDocument(
293294
let gen: "0" | "1" = "0";
294295
let map: "0" | "1" = "1";
295296
const query = "SELECT Name, Type FROM %Library.RoutineMgr_StudioOpenDialog(?,1,1,?,1,0,?,,0,?)";
297+
// Only show web app files in the list if we're in a server-side web app folder.
298+
// Hiding these files in other cases will improve performance.
299+
const showWeb = typeof api.wsOrFile == "object" && !notIsfs(api.wsOrFile) && isfsConfig(api.wsOrFile).csp;
296300

297301
return new Promise<string>((resolve) => {
298302
const quickPick = vscode.window.createQuickPick();
@@ -325,7 +329,16 @@ export async function pickDocument(
325329
const getItems = (): Promise<void> => {
326330
quickPick.busy = true;
327331
return api
328-
.actionQuery(query, [typeSuffix ? `*.${typeSuffix}` : "*,'*.prj,'*.bpl,'*.dtl", sys, gen, map])
332+
.actionQuery(query, [
333+
typeSuffix
334+
? `*.${typeSuffix}`
335+
: showWeb
336+
? "*,'*.prj,'*.bpl,'*.dtl"
337+
: "*.cls,*.mac,*.int,*.inc,*.other,'*.bpl,'*.dtl",
338+
sys,
339+
gen,
340+
map,
341+
])
329342
.then((data) => {
330343
quickPick.items = data.result.content.map((i) => createSingleSelectItem(i));
331344
quickPick.selectedItems = [];

0 commit comments

Comments
 (0)