luckasRanarison / nvim-devdocs

Neovim DevDocs integration
MIT License
269 stars 19 forks source link

Feature: DevdocsOpenCurrent would benefit from including additional relevant doc sources #30

Closed benelan closed 11 months ago

benelan commented 1 year ago

Description

I love the DevdocsOpenCurrent idea but it's too restrictive right now, especially for web development filetypes.

For example, executing DevdocsOpenCurrent in jsx/tsx files opens the React documentation source. However, there are frameworks besides React that use those filetypes (SolidJS, StencilJS, etc). So including other relevant sources would make the command more useful in a lot of cases. A couple other examples off the top of my head:

Solution

A potential solution would be creating a configuration option that maps filetypes to doc sources, so you could do something like this:

require("nvim-devdocs").setup {
  filetype_sources = {
    ["javascript"] = { "javascript", "dom", "node" },
    ["typescriptreact"] = { "javascript", "typescript", "react", "dom", "html", "tailwindcss" },
    ["vue"] = { "javascript", "typescript", "dom", "vue-3", "html", "css", "tailwindcss" },
    ["scss"] = { "css", "sass", "tailwindcss" },
  },
}

Personally, I think the DevdocsOpenCurrent default behavior should be to include all sources that are relevant to the filetype since we have fuzzy finding to filter it down from there. But leaving the defaults as is and adding the new config option would be great too.

Thanks for making this plugin!

luckasRanarison commented 11 months ago

It's now possible with the filetypes config.