vscode-copilot-release icon indicating copy to clipboard operation
vscode-copilot-release copied to clipboard

How to disable Copilot chat "fix all" handle ?

Open QuentinLemCode opened this issue 1 year ago • 15 comments
trafficstars

Hello My editor is set to apply auto-fixes (mainly ESLint and Typescript) on save.

Since recently, Copilot chat also applies auto-fixes.

image

It's a real pain because it's far much slower than ESLint and Typescript and when I was working on a merging conflict, it created a lot of mess in my code.

I have searched in the settings how to disable this, but found nothing.

Can you tell me how to disable Copilot chat auto-fixes please ?

  • VS Code Version: 1.89.1
  • OS Version: macOS Sonoma 14.4.1

QuentinLemCode avatar May 21 '24 08:05 QuentinLemCode

what does clicking configure do? check out the editor.codeActionsOnSave setting and see if there are any code actions that are turned on there.

justschen avatar May 23 '24 20:05 justschen

Hello @justschen Clicking on configure open the settings.json file. I have the following settings for editor.codeActionsOnSave :

  "editor.codeActionsOnSave": {
    "source.fixAll": "always",
    "source.organizeImports": "always"
  },

Until now, it has been used to fix ESLint issues when saving. But for some days/weeks, Github Copilot Chat has also been doing something at this stage, and it's very slow compared to ESLint. Moreover, it sometimes gave me weird results like adding random strings in imports.

Is there a way to disable specific Github Copilot Chat action on save, while keeping the ESLint action on save ?

QuentinLemCode avatar May 24 '24 10:05 QuentinLemCode

Hi @QuentinLemCode.

I have the same issue - were you able to resolve it? I came across this issue after reading Wes' comment here https://github.com/microsoft/vscode-eslint/issues/1055#issuecomment-2161238028.

natterstefan avatar Jun 14 '24 14:06 natterstefan

Hello @natterstefan No, unfortunately I'm still waiting for an answer here :(

Feel free to upvote !

QuentinLemCode avatar Jun 14 '24 14:06 QuentinLemCode

@justschen Do you have update on this ?

QuentinLemCode avatar Jun 19 '24 09:06 QuentinLemCode

+1.

Copilot Chat causes codeActionsOnSave first load to take 3000ms+ for me. (I haven't profiled latency on subsequent saves.)

I'm running Windows latest with Intel i9-12900K, NVIDIA GeForce RTX 4090, plenty o' RAM; on a 2 Gbps down / 300 Mbps up internet connection (not to flex since that's pretty unimpressive for 98052 - 98122, just pointing out that it takes 3 seconds on my primary dev machine, not some random container).

My wishlist:

  • Would you consider removing Copilot Chat from the fixAll list for codeActionsOnSave, and make it it's own class of thing, much like organizeImports, etc.? I can see why it's treated as a fixAller, since accepting a Chat Suggestion I assume will use the fix hook to edit the document. That said, I don't think that's appropriate, as it's a non-deterministic fixer unlike linters, which are the intended use case for fixing.
  • Can you make it possible to uninstall GitHub Copilot Chat extension without uninstalling GitHub Copilot extension? I assume that GitHub Copilot Chat depends upon GitHub Copilot, but I don't see why the other way around should be true. I feel that the reverse dependency violates the principles of VSCode extension design and if there truly is a reverse dependency, that dependency should be moved downlevel into the VSCode app itself as a hardpoint, OR the two extensions merged, rather than any scenario in which two extensions ever have a circular dependency on each other. If the PM for GitHub Copilot Chat complains that this will reduce their number of installations and look bad for them... GOOD.
  • If not, can you please add an 'Enable' toggle to Copilot Chat in settings so we're not forced to have this thing on inevitably degrading our performance in future unexpected ways?

jimmy-zhening-luo avatar Jun 26 '24 02:06 jimmy-zhening-luo

This just came to my attention again, I apologize.

I'm taking a look and when I have the mentioned settings, I don't ever see this happening.

 "editor.codeActionsOnSave": {
   "source.fixAll": "always",
   "source.organizeImports": "always"
 },

As I look for a reliable repro, can you confirm on the latest nightly Insiders build (which is now on 1.91 and has some improvements to contributed code actions on save) that this happens in your workspaces with your current settings as well?

Could you alternatively try "github.copilot.editor.enableCodeActions": false and see if that changes the code actions being run?

At the moment, I don't believe copilot contributes any code actions on save, so it's unlikely that it is coming from editor.codeActionsOnSave (i'm unaware of a source.fixAll.copilot command that is contributed, so having that setting in editor.codeActionsOnSave shouldn't do anything). Definitely suspicious that a Copilot Chat code action is taking so long on save though 🤔

justschen avatar Jun 26 '24 03:06 justschen

I confirmed on today's Insider build that there is no longer any perceivable latency upon saving files. Thanks for the hint (and for your additional insights on fixAll -- I stand corrected). Sorry for my slow response. Below is my repo environment, if there's any other cases/profiling I can run for you, feel free to tell me.

Environment

Extensions Enabled

  • dbaeumer.vscode-eslint: 3.0.10
  • GitHub Copilot: 1.208.0
  • GitHub Copilot Chat: 0.16.1

Aside: there was a GitHub Copilot (not Chat) extension update between yesterday and today, which I installed. The behavior persists in the VSCode Stable repo, however.

Version

Insider (no repo)

Version: 1.91.0-insider (user setup)
Commit: 0354163c1c66b950b0762364f5b4cd37937b624a
Date: 2024-06-26T10:11:25.363Z
Electron: 29.4.0
ElectronBuildId: 9728852
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Windows_NT x64 10.0.22631

Stable (repo)

Version: 1.90.2 (user setup)
Commit: 5437499feb04f7a586f677b155b039bc2b3669eb
Date: 2024-06-18T22:34:26.404Z
Electron: 29.4.0
ElectronBuildId: 9728852
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Windows_NT x64 10.0.22631

jimmy-zhening-luo avatar Jun 26 '24 20:06 jimmy-zhening-luo

@jimmy-zhening-luo appreciate the update! I'm glad that this does not repro in insiders.

Will continue doing some digging regardless (checking in Extension Host to see where it's spending most of its time) since I've been seeing some eslint code action slowdowns issues here and there.

However, I'm still suspicious if it's eslint or copilot chat extension - have you tried using the pre-release version of Copilot Chat in stable? Otherwise, it's definitely a core issue and will be resolved with the 1.91 release then.

justschen avatar Jun 26 '24 20:06 justschen

I apologize, I missed your two points at the top:

Could you alternatively try "github.copilot.editor.enableCodeActions": false and see if that changes the code actions being run?

I tried that yesterday (and checked again today when I saw your comment, it's still set to false), but I did not observe any improvement or change in latency with "github.copilot.editor.enableCodeActions": false.

I'm taking a look and when I have the mentioned settings, I don't ever see this happening.

Sharing my settings with you to see if they can trigger a repo. My settings are a bit "exotic" (bad). Pasting the relevant portions and attaching rest as a file.

N.B. When I got no repo on the VSCode Insider build, I had:

  • copied over the user settings file + user keyboard shortcuts file from VSCode (Stable) to VSCode Insider
  • signed into Settings sync and Copilot using my same GitHub account to try to ensure consistency

My Config

settings.json

{
    // Save
    "files.autoSave": "onFocusChange",
    "files.autoSaveWorkspaceFilesOnly": true,


    // Format
    "editor.formatOnSave": true,


    // Lint
    "editor.codeActionsOnSave": {
      "source.fixAll": "never",
      "source.fixAll.eslint": "always",
      "source.organizeImports": "never",
    },
    "eslint.codeActionsOnSave.mode": "all", // "problems" | "all" (default)
    "eslint.format.enable": true,
    "eslint.useESLintClass": true,
    "eslint.useFlatConfig": true,
    "github.copilot.editor.enableCodeActions": false,


    // Lint: Options
    "eslint.codeAction.disableRuleComment": { "enable": false },


    // Lint: Languages
    "eslint.probe": [
      "javascript",
      "typescript",
      "svelte",
      "html",
      "json",
      "jsonc",
      "yaml",
      "github-actions-workflow",
    ],
    "eslint.validate": [
      "javascript",
      "typescript",
      "svelte",
      "html",
      "json",
      "jsonc",
      "yaml",
      "github-actions-workflow",
    ],

    "typescript.format.enable": false,
    "[typescript]": {
      "editor.formatOnSave": false,
      "editor.defaultFormatter": "dbaeumer.vscode-eslint",
    },

    "javascript.format.enable": false,
    "[javascript]": {
      "editor.formatOnSave": false,
      "editor.defaultFormatter": "dbaeumer.vscode-eslint",
    },

    "svelte.plugin.svelte.format.enable": false,
    "[svelte]": {
      "editor.formatOnSave": false,
      "editor.defaultFormatter": "dbaeumer.vscode-eslint",
    },

    "html.format.enable": false,
    "[html]": {
      "editor.formatOnSave": false,
      "editor.defaultFormatter": "dbaeumer.vscode-eslint",
    },

    "json.format.enable": false,
    "[json]": {
      "editor.formatOnSave": false,
      "editor.defaultFormatter": "dbaeumer.vscode-eslint",
    },
    "[jsonc]": {
      "editor.formatOnSave": false,
      "editor.defaultFormatter": "dbaeumer.vscode-eslint",
    },
}

jimmy-zhening-luo avatar Jun 26 '24 20:06 jimmy-zhening-luo

No repo (no observed latency) on VSCode (Stable) with GitHub Copilot Chat Pre-release.

GitHub.copilot-chat: 0.16.2024061102

I tried to repo it in a bunch of different project types and saw no observable latency on first or subsequent saves in any case.

jimmy-zhening-luo avatar Jun 26 '24 20:06 jimmy-zhening-luo

Will continue doing some digging regardless (checking in Extension Host to see where it's spending most of its time) since I've been seeing some eslint code action slowdowns issues here and there.

On this matter I know enough to be worried about leading you down the wrong path :p, but I'll note that I've been running eslint npm binary 8.57.0 for three months, and my dbaeumer.vscode-eslint VSCode extension uses my project dir eslint binary in node_modules. I noticed this past week that eslint was slow to load my ESLint config file both in VSCode and from CLI (e.g. npx eslint foo.ts). I shared your suspicions and observed this slowdown irrespective of the Copilot Chat latency or VSCode itself.

I felt that either the VSCode ESLint extension or an ESLint plugin was causing the latency, and if I had to bet, I'd bet on some ESLint plugin (mostly because I was seeing the latency degradation in the CLI too).

The manual updates I made to my lint setup this past week:

  • dbaeumer.vscode-eslint patch version bump from 3.0.7 to 3.0.8
  • @typescript-eslint minor version bump from 7.13 to 7.14
  • @stylistic/eslint-plugin lots of updates: 2.2.1, 2.2.2, 2.3.0

I didn't do too much digging because the latency was still acceptable to me (<1.5 seconds), and I won't make any claims as to understanding what's going on, just passing on the information above in case you can pattern match it to whatever you're seeing as you profile the extension host.

jimmy-zhening-luo avatar Jun 26 '24 21:06 jimmy-zhening-luo

Same here.

"editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit",
    "source.organizeImports": "never"
  },

When I set it up like this, I have to wait for ESLint, TS Lang, and Copilot Chat actions every time I save, and there is no way to close it. I can barely save any files

JohnGuan avatar Jul 24 '24 10:07 JohnGuan

Wow wait what, there's no way to configure WHICH code actions should run?! It's either all or nothing?

I'm just going to remove copilot chat for now as I only use copilot autocomplete really, copilot has a code actions disable setting but this shouldn't be up to extension developers to add, we should be able to enable/disable custom via a global vscode setting..

Edit..

Wait, Copilot and Copilot chat install each other ?! You can't have 1 without the other?!

lopugit avatar Aug 04 '24 06:08 lopugit

@lopugit Well, if it was so easy I wouldn't have open an issue 😄 But I agree on the lack of code actions settings in VSCode

QuentinLemCode avatar Aug 05 '24 08:08 QuentinLemCode

Closing this issue since this is actually not Copilot or Copilot Chat related. (see https://github.com/microsoft/vscode/issues/214771)

As @jimmy-zhening-luo and I mentioned, this is caused by the ESLint extension. There are a few options for code actions on save atm, and disabling source.fixAll.eslint ( "source.fixAll.eslint": "never") wouldn't cause long save times.

Check out https://github.com/microsoft/vscode-eslint/issues/1344 for some instructions on how to debug. You could also try re-installing ESLint and restarting the TS server, or follow https://code.visualstudio.com/docs/setup/uninstall for a clean uninstall process

justschen avatar Aug 22 '24 00:08 justschen