File tree 2 files changed +21
-2
lines changed
2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -120,14 +120,29 @@ end
120
120
--- @return DebugprintFileTypeConfig ?
121
121
local get_filetype_config = function ()
122
122
local effective_filetypes = utils .get_effective_filetypes ()
123
+ local config = {}
124
+ local found_config = false
123
125
124
126
for _ , effective_filetype in ipairs (effective_filetypes ) do
125
127
if global_opts .filetypes [effective_filetype ] ~= nil then
126
- return global_opts .filetypes [effective_filetype ]
128
+ found_config = true
129
+ -- Combine all valid configs into the same object. This seems to
130
+ -- make sense as an approach; the only case where I've found where
131
+ -- this applies so far is ["bash", "sh"]. If this causes problems we
132
+ -- may need to come up with something more sophisticated.
133
+ config = vim .tbl_deep_extend (
134
+ " keep" ,
135
+ vim .deepcopy (global_opts .filetypes [effective_filetype ]),
136
+ config
137
+ )
127
138
end
128
139
end
129
140
130
- return nil
141
+ if not found_config then
142
+ return nil
143
+ else
144
+ return config
145
+ end
131
146
end
132
147
133
148
--- @param opts DebugprintFunctionOptionsInternal
Original file line number Diff line number Diff line change @@ -88,6 +88,10 @@ M.get_effective_filetypes = function()
88
88
:lang ()
89
89
90
90
local filetypes = vim .treesitter .language .get_filetypes (treesitter_lang )
91
+ -- The order in which filetypes are provided seems to be semi-random
92
+ -- (esp on NeoVim 0.9.5) so we are sorting them to at least give some
93
+ -- stability.
94
+ table.sort (filetypes )
91
95
assert (vim .tbl_count (filetypes ) > 0 )
92
96
return filetypes
93
97
else
You can’t perform that action at this time.
0 commit comments