Skip to content

Commit f19c7a0

Browse files
committed
add documentation explaining compound filetypes
1 parent ba97875 commit f19c7a0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lua/lspconfig/util.lua

+8-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@ M.default_config = {
2121
-- global on_setup hook
2222
M.on_setup = nil
2323

24-
---@param filetype string the filetype to check (can be a compound, dot-separated filetype; see |'filetype'|)
24+
---Test if a given filetype string matches any of the expected filetypes
25+
---
26+
---Note that vim filetypes can be a dot-separated string containing multiple filetypes, and the plugins/syntax rules for
27+
---all sub-filetypes are applied to the buffer. e.g. a buffer with a filetype of `yaml.ansible` will load the ftplugin
28+
---and syntax rules for both `yaml` and `ansible` (and in that order). see |'filetype'|
29+
---
30+
---Accordingly, this will attempt to match any of the sub-filetypes against the expected filetype(s)
31+
---@param filetype string the filetype to check (can be a compound, dot-separated filetype)
2532
---@param expected string|string[] the filetype(s) to match against
2633
---@return boolean
2734
function M.ft_matches(filetype, expected)

0 commit comments

Comments
 (0)