zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
49.76k stars 3.06k forks source link

Supermaven not working #16065

Open monarcode opened 3 months ago

monarcode commented 3 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Hello, i have read up that there is supermaven support for zed, i have added the following to my config

"features": {
    "inline_completion_provider": "supermaven"
  },

But nothing happens, apparently the supermaven icon is supposed to appear at the bottom, but that does not happen for me.

how can i fix this

Environment

Zed: v0.147.2 (Zed) OS: macOS 14.4.1 Memory: 32 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log


josser commented 2 months ago

Removing ~/Library/Application Support/Zed/supermaven helped to fix this issue

0x100101 commented 2 months ago

Removing ~/Library/Application Support/Zed/supermaven helped to fix this issue

I've tried this, but Zed doesn't re-download the binary. I've wiped everything and re-installed without any luck. Unfortunately the Zed logs don't show anything of interest.

0x100101 commented 1 month ago

A quick update for anyone having this issue. I wiped my custom config file and was able to get it working. Upon rebuilding my previous config, I was able to track the issue down to this line:

"format_on_save": "true",

After adding this to the config, Supermaven was disabled, and the bottom toolbar entered a broken state. If I removed it, Supermaven came back.

After referencing the base config I saw it was supposed to be:

"format_on_save": "on",

After correcting this, everything appears to work correctly.

It seems as though a malformed config will silently fail, and cause unexpected results.

dangdennis commented 1 month ago

A quick update for anyone having this issue. I wiped my custom config file and was able to get it working. Upon rebuilding my previous config, I was able to track the issue down to this line:

"format_on_save": "true",

After adding this to the config, Supermaven was disabled, and the bottom toolbar entered a broken state. If I removed it, Supermaven came back.

After referencing the base config I saw it was supposed to be:

"format_on_save": "on",

After correcting this, everything appears to work correctly.

It seems as though a malformed config will silently fail, and cause unexpected results.

Sharing that I'm seeing this too. Strange that enabling format_on_save swaps the Supermaven icon back to the Copilot icon. After restarting Zed, Supermaven's working now. Autoformat still works despite it not being set in my local or "regular" setting.

SomeoneToIgnore commented 1 month ago

Strange that enabling format_on_save swaps the Supermaven icon back to the Copilot icon

Autoformat still works despite it not being set in my local or "regular" setting.

This all sounds like user settings contain issues and Zed silently falls back to defaults.

We have some validation of parameters that cause pop-ups to appear if invalid contents is printed: image

Apparently, we do not do the same for wrong field names, so something might be broken there. Hard to say without seeing the settings, but I'd start with {} and slowly add things one by one until things start to break. One good candidate is to check v0.141.2 deprecation notes:

SETTINGS DEPRECATION NOTICE

In your settings.json the following keys will need to be renamed:

    language_overrides -> languages
    copilot -> inline_completions
    show_copilot_suggestions -> show_inline_completions
monarcode commented 1 month ago
// Zed settings
//
// For information on how to configure Zed, see the Zed
// documentation: https://zed.dev/docs/configuring-zed
//
// To see all of Zed's default settings without changing your
// custom settings, run the `open default settings` command
// from the command palette or from `Zed` application menu.
{
  "assistant": {
    "default_model": {
      "provider": "anthropic",
      "model": "claude-3-5-sonnet-20240620"
    },
    "version": "2"
  },
  "theme": "Catbox",
  "project_panel": {
    "dock": "right"
  },
  "base_keymap": "VSCode",
  "ui_font_size": 16,
  "buffer_font_size": 16,
  "vim_mode": false,
  "tab_size": 2,
  "buffer_font_family": "JetBrains Mono",
  "buffer_font_weight": 200,
  "buffer_font_features": {
    "calt": true
  },
  "linter": "eslint",
  "ui_font_family": "JetBrains Mono",
  "ui_font_weight": 200,
  "terminal": {
    "font_family": "MesloLGS NF",
    "font_size": 13,
    "shell": "system"
  },
  "languages": {
    "TypeScript": {
      "formatter": "prettier",
      "code_actions_on_format": {
        "source.fixAll.eslint": true,
        "source.organizeImports": true,
        "source.removeUnusedImports": true
      },
      "format_on_save": {
        "external": {
          "command": "prettier",
          "arguments": ["--stdin-filepath", "{buffer_path}"]
        }
      }
    },
    "TSX": {
      "formatter": "prettier",
      "code_actions_on_format": {
        "source.fixAll.eslint": true,
        "source.organizeImports": true,
        "source.removeUnusedImports": true
      },
      "format_on_save": "on"
    },
    "JavaScript": {
      "formatter": "prettier",
      "code_actions_on_format": {
        "source.fixAll.eslint": true,
        "source.organizeImports": true,
        "source.removeUnusedImports": true
      },
      "format_on_save": "on"
    }
  },
  "format_on_save": "on",
  "formatter": {
    "external": {
      "command": "node_modules/.bin/prettier",
      "arguments": [
        "--config",
        ".prettierrc",
        "--stdin-filepath",
        "{buffer_path}"
      ]
    },
    "code_actions_on_format": {
      "source.fixAll.eslint": true,
      "source.organizeImports": true,
      "source.removeUnusedImports": true
    }
  },
  "features": {
    "inline_completion_provider": "supermaven"
  },
  "code_actions_on_format": {
    "source.fixAll.eslint": true,
    "source.organizeImports": true,
    "source.removeUnusedImports": true
  },
  "prettier": {
    "printWidth": 80,
    "tabWidth": 2,
    "useTabs": false,
    "semi": true,
    "singleQuote": true,
    "trailingComma": "all",
    "bracketSpacing": true,
    "jsxBracketSameLine": false,
    "arrowParens": "avoid",
    "proseWrap": "preserve",
    "endOfLine": "lf",
    "plugins": []
  },
  "bracket_pairing": "always",
  "eslint": {
    "enabled": true,
    "autoFixOnSave": true,
    "autoFixOnFormat": true,
    "autoFixOnFormatDelay": 0
  },
  "inlay_hints": {
    "enabled": true,
    "typeHints": false,
    "parameterHints": true,
    "chainingHints": false
  },
  "lsp": {
    "eslint": {
      "settings": {
        "codeActionOnSave": {
          "rules": ["import/order"]
        }
      }
    },
    "typescript-language-server": {
      "initialization_options": {
        "preferences": {
          "importModuleSpecifierPreference": "non-relative"
        }
      }
    },
    "wakatime": {
      "settings": {
        "api-key": "..."
      }
    }
  },
  "language_servers": ["vtsls", "typescript-language-server", "eslint"],
  "language_server_options": {
    "vtsls": {
      "language_ids": [
        "typescript",
        "javascript",
        "typescriptreact",
        "javascriptreact"
      ]
    },
    "typescript-language-server": {
      "language_ids": [
        "typescript",
        "javascript",
        "typescriptreact",
        "javascriptreact"
      ],
      "initialization_options": {
        "preferences": {
          "includeInlayParameterNameHints": "all",
          "includeInlayParameterNameHintsWhenArgumentMatchesName": true,
          "includeInlayFunctionParameterTypeHints": true,
          "includeInlayVariableTypeHints": true,
          "includeInlayVariableTypeHintsWhenTypeMatchesName": false,
          "includeInlayPropertyDeclarationTypeHints": true,
          "includeInlayFunctionLikeReturnTypeHints": true,
          "includeInlayEnumMemberValueHints": true
        }
      }
    },
    "eslint": {
      "language_ids": [
        "typescript",
        "javascript",
        "typescriptreact",
        "javascriptreact"
      ],
      "initialization_options": {
        "run_formatter": true
      }
    }
  },
  "experimental.theme_overrides": {
    "background.appearance": "blurred",
    "background": "#000000aa",
    "panel.background": "#00000000",
    "editor.background": "#00000000",
    "tab_bar.background": "#00000000",
    "terminal.background": "#00000000",
    "toolbar.background": "#00000000",
    "tab.active_background": "#00000000",
    "tab.inactive_background": "#0000001a",
    "border": "#00000000",
    "status_bar.background": "#00000000",
    "title_bar.background": "#00000000",
    "border.variant": "#00000000",
    "scrollbar.track.background": "#00000000",
    "scrollbar.thumb.background": "#ffffff66",
    "scrollbar.thumb.border": "#00000000",
    "elevated_surface.background": "#00000090",
    "surface.background": "#00000090",
    "editor.active_line_number": "#ffffffcc",
    "editor.gutter.background": "#00000000",
    "editor.indent_guide": "#ffffff30",
    "editor.indent_guide_active": "#ffffff80",
    "editor.line_number": "#ffffff80",
    "editor.active_line.background": "#00000000",
    "scrollbar.track.border": "#00000000"
  }
}

this is my entire config at the moment, i have still not been able to get supermaven to work, please help

monarcode commented 1 month ago
// Zed settings
//
// For information on how to configure Zed, see the Zed
// documentation: https://zed.dev/docs/configuring-zed
//
// To see all of Zed's default settings without changing your
// custom settings, run the `open default settings` command
// from the command palette or from `Zed` application menu.
{
  "assistant": {
    "default_model": {
      "provider": "anthropic",
      "model": "claude-3-5-sonnet-20240620"
    },
    "version": "2"
  },
  "theme": "Catbox",
  "project_panel": {
    "dock": "right"
  },
  "base_keymap": "VSCode",
  "ui_font_size": 16,
  "buffer_font_size": 16,
  "vim_mode": false,
  "tab_size": 2,
  "buffer_font_family": "JetBrains Mono",
  "buffer_font_weight": 200,
  "buffer_font_features": {
    "calt": true
  },
  "linter": "eslint",
  "ui_font_family": "JetBrains Mono",
  "ui_font_weight": 200,
  "terminal": {
    "font_family": "MesloLGS NF",
    "font_size": 13,
    "shell": "system"
  },
  "languages": {
    "TypeScript": {
      "formatter": "prettier",
      "code_actions_on_format": {
        "source.fixAll.eslint": true,
        "source.organizeImports": true,
        "source.removeUnusedImports": true
      },
      "format_on_save": {
        "external": {
          "command": "prettier",
          "arguments": ["--stdin-filepath", "{buffer_path}"]
        }
      }
    },
    "TSX": {
      "formatter": "prettier",
      "code_actions_on_format": {
        "source.fixAll.eslint": true,
        "source.organizeImports": true,
        "source.removeUnusedImports": true
      },
      "format_on_save": "on"
    },
    "JavaScript": {
      "formatter": "prettier",
      "code_actions_on_format": {
        "source.fixAll.eslint": true,
        "source.organizeImports": true,
        "source.removeUnusedImports": true
      },
      "format_on_save": "on"
    }
  },
  "format_on_save": "on",
  "formatter": {
    "external": {
      "command": "node_modules/.bin/prettier",
      "arguments": [
        "--config",
        ".prettierrc",
        "--stdin-filepath",
        "{buffer_path}"
      ]
    },
    "code_actions_on_format": {
      "source.fixAll.eslint": true,
      "source.organizeImports": true,
      "source.removeUnusedImports": true
    }
  },
  "features": {
    "inline_completion_provider": "supermaven"
  },
  "code_actions_on_format": {
    "source.fixAll.eslint": true,
    "source.organizeImports": true,
    "source.removeUnusedImports": true
  },
  "prettier": {
    "printWidth": 80,
    "tabWidth": 2,
    "useTabs": false,
    "semi": true,
    "singleQuote": true,
    "trailingComma": "all",
    "bracketSpacing": true,
    "jsxBracketSameLine": false,
    "arrowParens": "avoid",
    "proseWrap": "preserve",
    "endOfLine": "lf",
    "plugins": []
  },
  "bracket_pairing": "always",
  "eslint": {
    "enabled": true,
    "autoFixOnSave": true,
    "autoFixOnFormat": true,
    "autoFixOnFormatDelay": 0
  },
  "inlay_hints": {
    "enabled": true,
    "typeHints": false,
    "parameterHints": true,
    "chainingHints": false
  },
  "lsp": {
    "eslint": {
      "settings": {
        "codeActionOnSave": {
          "rules": ["import/order"]
        }
      }
    },
    "typescript-language-server": {
      "initialization_options": {
        "preferences": {
          "importModuleSpecifierPreference": "non-relative"
        }
      }
    },
    "wakatime": {
      "settings": {
        "api-key": "..."
      }
    }
  },
  "language_servers": ["vtsls", "typescript-language-server", "eslint"],
  "language_server_options": {
    "vtsls": {
      "language_ids": [
        "typescript",
        "javascript",
        "typescriptreact",
        "javascriptreact"
      ]
    },
    "typescript-language-server": {
      "language_ids": [
        "typescript",
        "javascript",
        "typescriptreact",
        "javascriptreact"
      ],
      "initialization_options": {
        "preferences": {
          "includeInlayParameterNameHints": "all",
          "includeInlayParameterNameHintsWhenArgumentMatchesName": true,
          "includeInlayFunctionParameterTypeHints": true,
          "includeInlayVariableTypeHints": true,
          "includeInlayVariableTypeHintsWhenTypeMatchesName": false,
          "includeInlayPropertyDeclarationTypeHints": true,
          "includeInlayFunctionLikeReturnTypeHints": true,
          "includeInlayEnumMemberValueHints": true
        }
      }
    },
    "eslint": {
      "language_ids": [
        "typescript",
        "javascript",
        "typescriptreact",
        "javascriptreact"
      ],
      "initialization_options": {
        "run_formatter": true
      }
    }
  },
  "experimental.theme_overrides": {
    "background.appearance": "blurred",
    "background": "#000000aa",
    "panel.background": "#00000000",
    "editor.background": "#00000000",
    "tab_bar.background": "#00000000",
    "terminal.background": "#00000000",
    "toolbar.background": "#00000000",
    "tab.active_background": "#00000000",
    "tab.inactive_background": "#0000001a",
    "border": "#00000000",
    "status_bar.background": "#00000000",
    "title_bar.background": "#00000000",
    "border.variant": "#00000000",
    "scrollbar.track.background": "#00000000",
    "scrollbar.thumb.background": "#ffffff66",
    "scrollbar.thumb.border": "#00000000",
    "elevated_surface.background": "#00000090",
    "surface.background": "#00000090",
    "editor.active_line_number": "#ffffffcc",
    "editor.gutter.background": "#00000000",
    "editor.indent_guide": "#ffffff30",
    "editor.indent_guide_active": "#ffffff80",
    "editor.line_number": "#ffffff80",
    "editor.active_line.background": "#00000000",
    "scrollbar.track.border": "#00000000"
  }
}

this is my entire config at the moment, i have still not been able to get supermaven to work, please help

@SomeoneToIgnore any help?

josser commented 1 month ago

@monarcode maybe it worth to try with default config also, have you tried removing ~/Library/Application Support/Zed/supermaven ?

SomeoneToIgnore commented 1 month ago

I see this but not sure how to interpret it.

At least, the video shows the methodology I've used quite clearly: you comment the old json entirely, and paste the new fields one by one, saving.

https://github.com/user-attachments/assets/085435c4-2f2a-4890-be11-b6c8d7e652d2

SomeoneToIgnore commented 1 month ago

Well yes,

"formatter": {
    "external": {
      "command": "node_modules/.bin/prettier",
      "arguments": ["--config", ".prettierrc", "--stdin-filepath", "{buffer_path}"]
    },
    "code_actions_on_format": {
      "source.fixAll.eslint": true,
      "source.organizeImports": true,
      "source.removeUnusedImports": true
    }
  },

is wrong, formatter does not accept any field that's named code_actions_on_format It has to be code_actions, according to the docs: https://zed.dev/docs/configuring-zed?highlight=formatter#formatter

You're configuring it completely wrong, as two fields inside a dictionary, while it has to be an array:

  1. Or to use multiple formatters consecutively, use an array of formatters:
    {
    "formatter": [
    {"language_server": {"name": "rust-analyzer"}},
    {"external": {
    "command": "sed",
    "arguments": ["-e", "s/ *$//"]
    }
    ]
    }
monarcode commented 1 month ago

Well yes,

"formatter": {
    "external": {
      "command": "node_modules/.bin/prettier",
      "arguments": ["--config", ".prettierrc", "--stdin-filepath", "{buffer_path}"]
    },
    "code_actions_on_format": {
      "source.fixAll.eslint": true,
      "source.organizeImports": true,
      "source.removeUnusedImports": true
    }
  },

is wrong, formatter does not accept any field that's named code_actions_on_format It has to be code_actions, according to the docs: https://zed.dev/docs/configuring-zed?highlight=formatter#formatter

You're configuring it completely wrong, as two fields inside a dictionary, while it has to be an array:

  1. Or to use multiple formatters consecutively, use an array of formatters:
{
  "formatter": [
    {"language_server": {"name": "rust-analyzer"}},
    {"external": {
      "command": "sed",
      "arguments": ["-e", "s/ *$//"]
    }
  ]
}

omg, thanks.. this fixed it, after some tinkering, i figured something about my "external" is what was breaking the config

"formatter": {
    // "external": {
    //   // "command": "node_modules/.bin/prettier",
    //   // "arguments": [
    //   //   "--config",
    //   //   ".prettierrc",
    //   //   "--stdin-filepath",
    //   //   "{buffer_path}"
    //   // ]
    // },
    "code_actions": {
      "source.fixAll.eslint": true,
      "source.organizeImports": true,
      "source.removeUnusedImports": true
    }
  },

this is what i have currently... any idea what might be breaking in that external part?

SomeoneToIgnore commented 1 month ago

You're configuring it completely wrong, as two fields inside a dictionary, while it has to be an array:

Please re-read my comment better, below is an example from the documentation with two formatters working.

monarcode commented 1 month ago

Finally got it to work

"formatter": [
    {
      "external": {
        "command": "node_modules/.bin/prettier",
        "arguments": ["--config", "--stdin-filepath", "{buffer_path}"]
      }
    },
    {
      "code_actions": {
        "source.fixAll.eslint": true,
        "source.organizeImports": true,
        "source.removeUnusedImports": true
      }
    }
  ],

this is the correct code, thanks for pointing it out @SomeoneToIgnore