This is my way of solving Copilot Discussion #10305 .copilotignore support while waiting for official support.
The VSCode Copilot Ignore extension enhances your Visual Studio Code experience by allowing you to specify files and directories where GitHub Copilot should be disabled. This helps you customize the Copilot suggestions to only focus on code you want assistance with.
-
As soon as you your treeview contains a .copilotignore file, it's an all or nothing situation. If a match is found it will overwrite your GLOBAL copilot settings
github.copilot.enable
with allfalse
/true
value, be aware of this overwrite! -
If you have a
github.copilot.enable
entry in yourworkspace settings
or in.vscode/settings.json
, that would take precedent meaning this extension will not work.
Ignore file: Create a .copilotignore file anywhere in open workspace to specify patterns of files and directories. Patterns will apply relative to where they are defined. If the file of the active editor matches a pattern, Copilot will be disabled. Works just like .gitignore but for copilot.
Global file: A global file can be used at $HOME/.copilotignore
Reactive: Changes made to the .copilotignore file(s) are immediately reflected.
- Create a working proof of concept for .copilotignore
- Make .copilotignore file change trigger a reload of patterns
- Usage should be compatible as .gitignore
- Upload the extension to Visual Studio Code Marketplace.
- Make .copilotignore take into account it's own path/location (apply patterns recursive)
- Add option to take into account files that are open, but not in active/visible editor.
- Implement closeAllCopilotWindows as intended (closing copilot panels when disabled by the extension)
- Implement refreshStatusBarCopilot as intended (when state is toggled with setConfigEnabledBySettings, the sidebar does not render the correct copilot state immediately)
- Install the extension from the Visual Studio Code Marketplace.
- Reload the window with the
> Developer: Reload Window
command in VS Code to make sure. - Create a .copilotignore file in the root of your workspace.
- Specify the file patterns, directories, or files that you want Copilot to ignore in the .copilotignore file.
- Save the file, and Copilot will adapt its suggestions accordingly.
The copilot icon should be crossed when copilot should be disabled.
Any configured Copilot Organisation/Repository Exclusion list(s) from Copilot Business should still take effect.
- Clone git repository
- Edit src/extension.ts as needed
- Run
npm run install
&npm run build
- Install the copilotignore-X.X.X.vsix file through vscode (right click install Extension VSIX)
- Reload the window with the
> Developer: Reload Window
command in VS Code
For debugging an output channel with the name Copilot Ignore
is available in the output tab of VS Code.
Continuous improvement is encouraged and your contributions are valuable!
If you identify areas for improvement, have suggestions or encounter issues, please create a GitHub issue.
This extension is licensed under the MIT License.