microsoft / vscode-copilot-release

Feedback on GitHub Copilot Chat UX in Visual Studio Code.
https://marketplace.visualstudio.com/items?itemName=GitHub.copilot-chat
Creative Commons Attribution 4.0 International
322 stars 29 forks source link

How to disable Copilot chat "fix all" handle ? #1230

Closed QuentinLemCode closed 1 month ago

QuentinLemCode commented 4 months ago

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 ?

justschen commented 4 months ago

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

QuentinLemCode commented 4 months ago

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 ?

natterstefan commented 3 months ago

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.

QuentinLemCode commented 3 months ago

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

Feel free to upvote !

QuentinLemCode commented 3 months ago

@justschen Do you have update on this ?

jimmy-zhening-luo commented 3 months ago

+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:

justschen commented 3 months ago

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 🤔

jimmy-zhening-luo commented 3 months ago

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

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
justschen commented 3 months ago

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

jimmy-zhening-luo commented 3 months ago

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:

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 commented 3 months ago

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 commented 3 months ago

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:

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.

JohnGuan commented 2 months ago

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

lopugit commented 2 months ago

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?!

QuentinLemCode commented 2 months ago

@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

justschen commented 1 month ago

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