microsoft / microsoft/vscode-test-web
Using `vscode.RelativePattern` and `vscode.workspace.findFiles`
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 87
- Forks
- 31
- Avg merge
- 23h 49m
- Merged PRs (30d)
- 5
Description
I've changed the helloworld-web-sample with this simple testing code below but it can't find files when running it with the vscode-test-web (files.length always 0). It works fine when I run it using the Run Web Extension in VS Code though (files.length > 0).
Is there a different way of using vscode.RelativePattern and vscode.workspace.findFiles for browser? Thanks!
diff --git a/helloworld-web-sample/src/web/extension.ts b/helloworld-web-sample/src/web/extension.ts
index 176a2dd..482892a 100644
--- a/helloworld-web-sample/src/web/extension.ts
+++ b/helloworld-web-sample/src/web/extension.ts
@@ -13,11 +13,13 @@ export function activate(context: vscode.ExtensionContext) {
// The command has been defined in the package.json file
// Now provide the implementation of the command with registerCommand
// The commandId parameter must match the command field in package.json
- let disposable = vscode.commands.registerCommand('helloworld-web-sample.helloWorld', () => {
+ let disposable = vscode.commands.registerCommand('helloworld-web-sample.helloWorld', async () => {
// The code you place here will be executed every time your command is executed
// Display a message box to the user
- vscode.window.showInformationMessage('Hello World from helloworld-web-sample in a web extension host!');
+ const relativePattern = new vscode.RelativePattern(vscode.workspace.workspaceFolders![0], "**/*");
+ const files = await vscode.workspace.findFiles(relativePattern);
+ await vscode.window.showInformationMessage(`Hello World from helloworld-web-sample in a web extension host! ${files.length}`);
});
context.subscriptions.push(disposable);
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with helloworld-web-sample/src/web/extension.ts and reproduce the issue through vscode-test-web using the shown RelativePattern and findFiles call. Compare the browser run with Run Web Extension in VS Code and determine the expected browser behavior; done means the sample's file lookup works as intended or the limitation and required usage are documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- testing, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100