copilot.lua icon indicating copy to clipboard operation
copilot.lua copied to clipboard

Disabled filetypes not respected

Open brentonk opened this issue 1 year ago • 2 comments

I'm on commit 096c8f6 and experiencing an issue where Copilot is activating in filetypes I've set to disable in the config, then telling me that it was enabled manually.

Confirmed this occurs with a minimal config:

-- init_tmp.lua

-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
  local lazyrepo = "https://github.com/folke/lazy.nvim.git"
  local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
  if vim.v.shell_error ~= 0 then
    vim.api.nvim_echo({
      { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
      { out, "WarningMsg" },
      { "\nPress any key to exit..." },
    }, true, {})
    vim.fn.getchar()
    os.exit(1)
  end
end
vim.opt.rtp:prepend(lazypath)

-- Make sure to setup `mapleader` and `maplocalleader` before
-- loading lazy.nvim so that mappings are correct.
-- This is also a good place to setup other settings (vim.opt)
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"

-- Setup lazy.nvim
require("lazy").setup({
    spec = {
        {
            "zbirenbaum/copilot.lua",
            cmd = "Copilot",
      event = "InsertEnter",
            config = function()
                require("copilot").setup({
          filetypes = {
            markdown = false,
          },
        })
            end,
        },
    },
    -- Configure any other settings here. See the documentation for more details.
    -- colorscheme that will be used when installing plugins.
    install = { colorscheme = { "habamax" } },
    -- automatically check for plugin updates
    checker = { enabled = true },
})

Steps to replicate problem:

  1. Run nvim -u init_tmp.lua test.md

  2. Enter and exit insert mode

  3. Run :Copilot status, it returns

     [Copilot.lua] Status:
     Online
     Enabled manually ('filetype' markdown rejected by config filetypes[markdown])
    

brentonk avatar Jul 29 '25 17:07 brentonk

Do you get suggestions for it? I have a feeling it might be the status that is incorrect.

Edit: nevermind it seems that it does in fact yield results.

AntoineGS avatar Jul 29 '25 19:07 AntoineGS

The issue should be fixed, let me know if you have any issues!

AntoineGS avatar Jul 29 '25 19:07 AntoineGS