Skip to content

Commit b61fd80

Browse files
A new serverless function doesn't appear in os view if created not in ws folder (#3255)
* initial commit Signed-off-by: msivasubramaniaan <msivasub@redhat.com> * check func.yaml recursively under workspace sub folder Signed-off-by: msivasubramaniaan <msivasub@redhat.com> --------- Signed-off-by: msivasubramaniaan <msivasub@redhat.com>
1 parent 356e942 commit b61fd80

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/serverlessFunction/functionModel.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ export class ServerlessFunctionModel implements Disposable {
3636
const folders: Uri[] = [];
3737
if (workspace.workspaceFolders) {
3838
for (const wf of workspace.workspaceFolders) {
39+
const entries = await fs.readdir(wf.uri.fsPath, { withFileTypes: true });
40+
for (const file of entries) {
41+
if (file.isDirectory() && fs.existsSync(path.join(wf.uri.fsPath, file.name, 'func.yaml'))) {
42+
folders.push(Uri.file(path.join(wf.uri.fsPath, file.name)));
43+
}
44+
}
3945
if (fs.existsSync(path.join(wf.uri.fsPath, 'func.yaml'))) {
4046
folders.push(wf.uri);
4147
}

src/webview/serverless-function/serverlessFunctionLoader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ async function messageListener(panel: vscode.WebviewPanel, event: any): Promise<
2828
let response: CliExitData;
2929
const eventName = event.action;
3030
const functionName = event.name;
31-
const functionPath: vscode.Uri = event.folderPath ? vscode.Uri.from(event.folderPath) : undefined;
31+
const functionPath: vscode.Uri = event.folderPath;
3232
switch (eventName) {
3333
case 'validateName':
3434
const flag = validateName(functionName);

0 commit comments

Comments
 (0)