Skip to content

Commit 700f06b

Browse files
authored
Remove workspaceFolders check from assertFileOkForTool (#259)
In empty workspaces, can only operate on open editors
1 parent 565d748 commit 700f06b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/extension/tools/node/toolUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ export async function assertFileOkForTool(accessor: ServicesAccessor, uri: URI):
8686
const ignoreService = accessor.get(IIgnoreService);
8787
const promptPathRepresentationService = accessor.get(IPromptPathRepresentationService);
8888

89-
if (workspaceService.getWorkspaceFolders().length > 0 && !workspaceService.getWorkspaceFolder(normalizePath(uri))) {
89+
if (!workspaceService.getWorkspaceFolder(normalizePath(uri))) {
9090
const fileOpenInSomeTab = tabsAndEditorsService.tabs.some(tab => isEqual(tab.uri, uri));
9191
if (!fileOpenInSomeTab) {
92-
throw new Error(`File ${promptPathRepresentationService.getFilePath(uri)} is outside of the workspace and can't be read`);
92+
throw new Error(`File ${promptPathRepresentationService.getFilePath(uri)} is outside of the workspace, and not open in an editor, and can't be read`);
9393
}
9494
}
9595

0 commit comments

Comments
 (0)