Skip to content

Disable copilot extension when certain files are open listed in a .copilotignore file

License

Notifications You must be signed in to change notification settings

ahrefs/copilotignore-vscode

 
 

Repository files navigation

VSCode Copilot Ignore

This is my way of solving Copilot Discussion #10305 .copilotignore support while waiting for official support.

ℹ️ Description

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.

⚠️ Limitations

  1. 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 all false/true value, be aware of this overwrite!

  2. If you have a github.copilot.enable entry in your workspace settings or in .vscode/settings.json, that would take precedent meaning this extension will not work.

  3. Patterns of multiple .copilotignore files will simply be concatenated into one list of patterns. Meaning the .copilotignore file does not work recursively based on its own path yet (like other .ignore files).

✅ Features

Ignore file: Create a .copilotignore file in the root of a workspace to specify patterns of files and directories. 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.

📋 To do list

  • 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.
  • Add option to take into account files that are open, but not in active editor.
  • Make .copilotignore take into account it's own path/location (apply patterns recursive)

⚙️ Usage

  • 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.

🔧 Build/Install from source

  • 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

🛠️ Debugging

For debugging an output channel with the name Copilot Ignore is available in the output tab of VS Code.

🤝 Contribute

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.

📜 License

This extension is licensed under the MIT License.

About

Disable copilot extension when certain files are open listed in a .copilotignore file

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 93.8%
  • Jupyter Notebook 6.2%