diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua index 7e9255f0f5..39bd8382ba 100644 --- a/lua/lspconfig/util.lua +++ b/lua/lspconfig/util.lua @@ -21,7 +21,14 @@ M.default_config = { -- global on_setup hook M.on_setup = nil ----@param filetype string the filetype to check (can be a compound, dot-separated filetype; see |'filetype'|) +---Test if a given filetype string matches any of the expected filetypes +--- +---Note that vim filetypes can be a dot-separated string containing multiple filetypes, and the plugins/syntax rules for +---all sub-filetypes are applied to the buffer. e.g. a buffer with a filetype of `yaml.ansible` will load the ftplugin +---and syntax rules for both `yaml` and `ansible` (and in that order). see `:h 'filetype'` +--- +---Accordingly, this will attempt to match any of the sub-filetypes against the expected filetype(s) +---@param filetype string the filetype to check (can be a compound, dot-separated filetype) ---@param expected string|string[] the filetype(s) to match against ---@return boolean function M.ft_matches(filetype, expected)