Skip to content

GitHub Copilot refuses to use VS Code search tools for multi-root workspaces #292754

@garretwilson

Description

@garretwilson

GitHub Copilot refuses to use its search functionality to look for files in another root of a multi-root workspace.

This is exhaustingly frustrating. This has gone on for hours and there is no solution. It's just a GitHub Copilot bug.

Reproduction

(I'm using Git Bash on Windows 11, so I'm showing Git Bash style Windows paths.)

  1. Open /c/foo in VS Code.
  2. Use "File > Save Workspace As..." to save the project as /c/projects/foobar.code-workspace.
  3. Use "File > Add Folder to Workspace..." to add the folder /c/bar. You wind up with:
    /c/projects/foobar.code-workspace
    • /c/foo
    • /c/bar
  4. Add a default instructions file and add the following:
## Tools

- **Always use VS Code tools (`file_search`, `grep_search`, `read_file`) for file operations.** Use `file_search` with a glob pattern (e.g., `**/Filename.java`) to locate files before assuming they are external.
- Terminal file commands (`grep`, `cat`, `find`, `sed -i`) are permitted **only** for paths listed under "allowed external paths" that `file_search` confirms are not in the workspace.
- For `grep_search`, use workspace-relative paths in `includePattern` (e.g., `**/ByteOrderMark.java`), not absolute paths.
- For `read_file`, use the absolute path returned by `file_search`.
- When performing search-and-replace operations across multiple files in the workspace, use VS Code's built-in search-and-replace facility rather than shell tools like `sed -i`. VS Code preserves line endings, provides change preview, and integrates with the editor's undo system. Reserve `sed` for stream processing or piped transformations where output goes to `stdout`. **Do not** use `sed -i` for in-place file modification.

## Code Search

For searching the code of dependency libraries (especially the `bar` library), the source code may have been added to the workspace as a separate root workspace. **First see if the appropriate directories have been added to the workspace as described above. If so, use workspace tools to search the files directly.**

## Instructions Checklist

- **Stop!** Before any file operation, run `file_search` with a glob pattern (e.g., `**/Filename.java`).
- If `file_search` returns a result, use VS Code tools. Do not use `cat`, `grep`, or `find`.
- If `grep_search` returns no results due to `.gitignore` or exclude settings, retry with `includeIgnoredFiles: true` before falling back to terminal commands.
  1. Ask GitHub Copilot to look up something in the bar library.

Expected: GitHub Copilot will use a VS Code tool such as file_search, grep_search, or read_file to search /c/bar in the workspace.

Actual: GitHub Copilot will try to search GitHub for the source code. Or it will try to download something. Or it will make stuff up. Or heaven forbid that it sees in the terminal that you used some command to access the /c/bar directory, in which case it will try to grep or cat or sed -i in /c/bar

I don't care if you write a whole book of instructions. They are futile. GitHub Copilot will ignore all of it. Even a top model such as Claude Open 4.5.

I'm not saying it can't use tools to search other workspace roots. If you force it to, and call it out, and deny its terminal commands, and ask it to read the instructions again, even weaker models such as Claude Haiku 4.5 will eventually relent and use the VS Code search tools in the other workspace roots as requested.

This is not only a huge GitHub Copilot usability issue, it is also a security issue. The issue here is not to prevent access to other directories (although that is a separate issue #282211). This ticket is not about denying the terminal commands; I've already done that to large extent in settings.json. The issue here is that VS Code GitHub Copilot refuses to use the built-in search tools as a first resort, without wasting half my day telling it over and over again each time to RTF instructions.

One can say, "ah, LLMs will be LLMs", but I do not believe that. Tool usage is an essential part of using GitHub Copilot in VS Code, and if you do not put in the appropriate safeguards and/or prompt structures to make sure the LLM tries to use the bult-in tools first, the product is broken. LLMs have all sorts of biases and defects. You must find out how to work around them, and the behavior here tells me that not only is GitHub Copilot not effectively working around these LLM issues, something about the way built-in tools and instructions are presented to the LLM is biasing the LLM against using the built-in tools.

Version: 1.108.2 (user setup)
Commit: c9d77990917f3102ada88be140d28b038d1dd7c7
Date: 2026-01-21T13:52:09.270Z
Electron: 39.2.7
ElectronBuildId: 12953945
Chromium: 142.0.7444.235
Node.js: 22.21.1
V8: 14.2.231.21-electron.0
OS: Windows_NT x64 10.0.26200

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugchat-agentverifiedVerification succeeded

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions