Skip to content

Commit c361461

Browse files
authored
fix(applicationcomposer): support out of workspace file watching #4877
Problem: - We found a bug: File watch is not working on template files which out side workspace Solution: - use a [complex glob pattern](https://code.visualstudio.com/api/references/vscode-api#RelativePattern) instead of a string as the parameter of [`createFileSystemWatcher` function](https://vscode-api.js.org/modules/vscode.workspace.html#createFileSystemWatcher)
1 parent cf59577 commit c361461

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "support template file watching out of workspace for Application Composer"
4+
}

packages/core/src/applicationcomposer/messageHandlers/addFileWatchMessageHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export async function addFileWatchMessageHandler(request: AddFileWatchRequestMes
2222
}
2323
const filePath = context.defaultTemplatePath
2424
const fileName = context.defaultTemplateName
25-
const fileWatch = vscode.workspace.createFileSystemWatcher(filePath)
25+
const fileWatch = vscode.workspace.createFileSystemWatcher(new vscode.RelativePattern(filePath, '*'))
2626
context.disposables.push(fileWatch)
2727

2828
fileWatch.onDidChange(async () => {

0 commit comments

Comments
 (0)