supermaven-inc / supermaven-nvim

The official Neovim plugin for Supermaven
https://supermaven.com/
MIT License
279 stars 16 forks source link

fix(#12): ensure ignoring filetypes properly #35

Open AlejandroSuero opened 1 month ago

AlejandroSuero commented 1 month ago

When testing out the issue in #12 I found that the files in ignore_filetypes were not being ignored properly causing it to still process them. In my case I ignored .lua and .md filetypes and still was giving me suggestions.

After this fix, it no longer gives me suggestions and it prevents supermaven from starting in ignored files but works fine when changing to a non-ingored filetype.

For the video I used this configuration:

require("supermaven-nvim").setup({
  ignore_filetypes = {
    "lua",
  },
})

https://github.com/supermaven-inc/supermaven-nvim/assets/71392160/a3ff66c4-a372-4995-8112-a340b8b69352

[!NOTE] In the video I forgot to show that going from the non-ignored .md to an ingored .lua stops showing suggestions or 'polling' or updating until you change to a non-ignored filetype.

Fixes #12

hboon commented 1 month ago

@AlejandroSuero this worked for me before the PR:

ignore_filetypes = { markdown = true },
AlejandroSuero commented 1 month ago

@hboon I added the support for filetype = boolean so it can be compatible.

Although it should be an array of filetypes like ignore_filetypes = { "markdown", "help", ... } because markdown = true doesn't make sense, since if you don't want a filetype to be ignore simply do not include it in the ignored filetypes.

sm-victorw commented 1 month ago

I agree that supporting an array of filetypes such as ignore_filetypes = { "markdown", "help", ... } would be good to include. I'm not sure if we should kill the binary child process upon encountering an ignored filetype, as the vscode and intellij plugins don't do this, and I'm concerned about changing the design/interaction with the binary too much - it's conceivable that this would result in problems down the line

AlejandroSuero commented 1 month ago

@sm-victorw I modified this PR to only do the stopping so we can have the feature of ignore_filetypes as string[] in #45 separate to better discuss the changes.

AlejandroSuero commented 4 weeks ago

@hboon This still works for me with dfaed31 changes, tell me if it still works for you as well.

hboon commented 4 weeks ago

@AlejandroSuero works for me