Skip to content

Respect files.exclude values set to false #1696

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

Merged
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
9 changes: 6 additions & 3 deletions src/ui/ProjectPanelProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ const LOADING_ICON = "loading~spin";
*/
function excludedFilesForProjectPanelExplorer(): string[] {
const config = vscode.workspace.getConfiguration("files");
const vscodeExcludeList = config.get<{ [key: string]: boolean }>("exclude");
const packageDepsExcludeList = configuration.excludePathsFromPackageDependencies;

if (!Array.isArray(packageDepsExcludeList)) {
throw new Error("Expected excludePathsFromPackageDependencies to be an array");
}
return [...packageDepsExcludeList, ...Object.keys(vscodeExcludeList ?? {})];

const vscodeExcludeList = config.get<{ [key: string]: boolean }>("exclude") ?? {};
const vscodeFileTypesToExclude = Object.keys(vscodeExcludeList).filter(
key => vscodeExcludeList[key]
);
return [...packageDepsExcludeList, ...vscodeFileTypesToExclude];
}

/**
Expand Down
8 changes: 4 additions & 4 deletions test/integration-tests/ui/ProjectPanelProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ suite("ProjectPanelProvider Test Suite", function () {
let resetSettings: (() => Promise<void>) | undefined;
beforeEach(async function () {
resetSettings = await updateSettings({
"files.exclude": { "**/*.swift": true },
"files.exclude": { "**/*.swift": true, "**/*.txt": false },
"swift.excludePathsFromPackageDependencies": ["**/*.md"],
});
});
Expand All @@ -374,11 +374,11 @@ suite("ProjectPanelProvider Test Suite", function () {

const folders = await treeProvider.getChildren(dep);
const manifest = folders.find(n => n.name === "Package.swift") as FileNode;
expect(manifest).to.be.undefined;
expect(manifest, "Package.swift was not found").to.be.undefined;
const readme = folders.find(n => n.name === "README.md") as FileNode;
expect(readme).to.be.undefined;
expect(readme, "README.md was not found").to.be.undefined;
const licence = folders.find(n => n.name === "LICENSE.txt") as FileNode;
expect(licence).to.not.be.undefined;
expect(licence, "LICENSE.txt was not found").to.not.be.undefined;
});

afterEach(async () => {
Expand Down