From f19c7a086e9d558152e614f43f114193864f029b Mon Sep 17 00:00:00 2001 From: Bao Trinh Date: Sat, 11 May 2024 10:10:21 -0500 Subject: [PATCH] add documentation explaining compound filetypes --- lua/lspconfig/util.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua index 7e9255f0f5..e43a7ec765 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 |'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)