diff --git a/extensions/vscode/webviews/homeView/src/components/views/projectFiles/ProjectFile.vue b/extensions/vscode/webviews/homeView/src/components/views/projectFiles/ProjectFile.vue index b88cff7bc..283ff4719 100644 --- a/extensions/vscode/webviews/homeView/src/components/views/projectFiles/ProjectFile.vue +++ b/extensions/vscode/webviews/homeView/src/components/views/projectFiles/ProjectFile.vue @@ -4,7 +4,7 @@ :checked="isIncluded" :disabled="isDisabled" :list-style="listStyle" - :disable-opacity="isEntrypoint" + :disable-opacity="isEntrypoint || isPackageFile" :indent-level="file.indent + 1" :expandable="file.isDir" :tooltip="tooltip" @@ -60,6 +60,7 @@ const isDisabled = computed((): boolean => { const source = props.file.reason?.source; return ( (isEntrypoint.value && isIncluded.value) || + (isPackageFile.value && isIncluded.value) || source === "built-in" || source === "permissions" ); @@ -89,6 +90,26 @@ const isEntrypoint = computed((): boolean => { return false; }); +const isPackageFile = computed((): boolean => { + return isPythonPackageFile.value || isRPackageFile.value; +}); + +const isPythonPackageFile = computed((): boolean => { + const config = home.selectedConfiguration; + if (config != undefined && !isConfigurationError(config)) { + return props.file.id === config.configuration.python?.packageFile; + } + return false; +}); + +const isRPackageFile = computed((): boolean => { + const config = home.selectedConfiguration; + if (config != undefined && !isConfigurationError(config)) { + return props.file.id === config.configuration.r?.packageFile; + } + return false; +}); + const listStyle = computed((): "emphasized" | "default" | "deemphasized" => { return isEntrypoint.value ? "emphasized" @@ -99,7 +120,10 @@ const listStyle = computed((): "emphasized" | "default" | "deemphasized" => { const tooltip = computed((): string => { return isIncluded.value - ? includedFileTooltip(props.file, isEntrypoint.value) + ? includedFileTooltip(props.file, { + isEntrypoint: isEntrypoint.value, + isPackageFile: isPackageFile.value, + }) : excludedFileTooltip(props.file); }); diff --git a/extensions/vscode/webviews/homeView/src/components/views/projectFiles/tooltips.test.ts b/extensions/vscode/webviews/homeView/src/components/views/projectFiles/tooltips.test.ts index aacc95ad9..14f12c31d 100644 --- a/extensions/vscode/webviews/homeView/src/components/views/projectFiles/tooltips.test.ts +++ b/extensions/vscode/webviews/homeView/src/components/views/projectFiles/tooltips.test.ts @@ -30,11 +30,19 @@ describe("includedFileTooltip", () => { it("should return correct tooltip for entrypoint file", () => { const file = { rel: "src/index.ts", reason: null }; - const tooltip = includedFileTooltip(file, true); + const tooltip = includedFileTooltip(file, { isEntrypoint: true }); expect(tooltip).toBe( `src/index.ts will be included in the next deployment.\nsrc/index.ts is the entrypoint. Entrypoints must be included in the configuration 'files' list.`, ); }); + + it("should return correct tooltip for package file", () => { + const file = { rel: "src/requirements.txt", reason: null }; + const tooltip = includedFileTooltip(file, { isPackageFile: true }); + expect(tooltip).toBe( + `src/requirements.txt will be included in the next deployment.\nsrc/requirements.txt is a package file. Package files must be included in the configuration 'files' list.`, + ); + }); }); describe("excludedFileTooltip", () => { diff --git a/extensions/vscode/webviews/homeView/src/components/views/projectFiles/tooltips.ts b/extensions/vscode/webviews/homeView/src/components/views/projectFiles/tooltips.ts index 2475eea78..559f846af 100644 --- a/extensions/vscode/webviews/homeView/src/components/views/projectFiles/tooltips.ts +++ b/extensions/vscode/webviews/homeView/src/components/views/projectFiles/tooltips.ts @@ -5,7 +5,10 @@ import { export function includedFileTooltip( file: Pick, - isEntrypoint: boolean = false, + { + isEntrypoint = false, + isPackageFile = false, + }: { isEntrypoint?: boolean; isPackageFile?: boolean } = {}, ) { let tooltip = `${file.rel} will be included in the next deployment.`; if (file.reason) { @@ -14,6 +17,9 @@ export function includedFileTooltip( if (isEntrypoint) { tooltip += `\n${file.rel} is the entrypoint. Entrypoints must be included in the configuration 'files' list.`; } + if (isPackageFile) { + tooltip += `\n${file.rel} is a package file. Package files must be included in the configuration 'files' list.`; + } return tooltip; }