Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copilot stays disabled for yaml and markdown file types #304

Open
udmehrot opened this issue Jul 26, 2024 · 2 comments
Open

Copilot stays disabled for yaml and markdown file types #304

udmehrot opened this issue Jul 26, 2024 · 2 comments

Comments

@udmehrot
Copy link

udmehrot commented Jul 26, 2024

Enabled copilot for Markdown and Yaml with following -

   1   │ return {
   2   │   "zbirenbaum/copilot.lua",
   3   │   cmd = "Copilot",
   4   │   event = "InsertEnter",
   5   │   config = function()
   6   │     require("copilot").setup({
   7   │       suggestion = { enabled = false },
   8   │       panel = { enabled = false },
   9   │       filetypes = {
  10   │         yaml = true,
  11   │         markdown = true,
  12   │       },
  13   │     })
  14   │   end,
  15   │ }

Exit out of nvim and enter again.

Open a yaml file. Copilot is not loaded.

Open a JSON file and Copilot is loaded.

Switch to YAML file buffer and run :Copilot status. I get the following error - [Copilot] Disabled ('filetype' yaml rejected by internal_filetypes[yaml])

@udmehrot
Copy link
Author

udmehrot commented Jul 27, 2024

I tried to add ["*"] = true to filtypes in my plugins filetypes configuration to no avail.

Adding following to init.lua does not work either.

-- Enable copilot filetypes
vim.g.copilot_filetypes = {
  "yaml",
  "yml",
  "markdown",
}

A point to note, I had installed gihub/copilot.vim before installing this plugin. I am wondering if there is lingering config from that plugin that is preventing me from overriding defaults.

Any help with be appreciated.

@antonkesy
Copy link

I tried the example config from the projects README and it kinda works.

Using only ["."] = true, does not work for markdown, but explicitly adding markdown = true, does.
BUT
It did not automatically start Copilot inside the markdown buffer (other buffers like make, C++, Python worked without any issue).
I had to run Copilot enable manually.

Hope this helps.
Here is my config as reference:

  {
    "zbirenbaum/copilot.lua",
    cmd = "Copilot",
    event = "InsertEnter",
    config = function()
      require("copilot").setup({
        suggestion = {
          enabled = true,
          auto_trigger = true,
          keymap = {
            accept = "<M-y>",
            accept_word = false,
            accept_line = false,
            next = "<M-l>",
            prev = "<M-h>",
            dismiss = "<C-]>",
          },
        },
        filetypes = {
          yaml = true,
          markdown = true,
          help = true,
          gitcommit = true,
          gitrebase = true,
          hgcommit = true,
          svn = true,
          cvs = false,
          ["."] = true,
        }
      })
    end,
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants