Current state
lua/config/plugins/lang/yaml.lua calls vim.api.nvim_create_autocmd('LspAttach', ...) at the top level of the file, before the return block. This call runs when the lang file is evaluated by require_all_files_in_config_directory — outside any plugin config callback — so the autocmd is registered regardless of whether associated plugins have loaded. The same issue is tracked for nvim-dap-ui.lua (#54) and nvim-lspconfig.lua (#55); yaml.lua has the same pattern unaddressed.
Ideal state
- The LspAttach autocmd is registered inside the
config function of the relevant plugin spec in yaml.lua
- The top level of
yaml.lua contains only a return table of plugin specs, with no imperative calls before the return
- The autocmd still fires on LSP attach for yaml files
Starting points
lua/config/plugins/lang/yaml.lua — the LspAttach autocmd at the top level
QA plan
- Open
lua/config/plugins/lang/yaml.lua — expect no imperative calls before the return statement
- Run
nvim --headless -c "qall" — expect exit 0 with no Lua errors
- Open a
.yaml file in Neovim — expect LSP attach behavior to work as before (keymaps and formatting on save)
Done when
lua/config/plugins/lang/yaml.lua has no imperative calls outside the return block.
Current state
lua/config/plugins/lang/yaml.luacallsvim.api.nvim_create_autocmd('LspAttach', ...)at the top level of the file, before thereturnblock. This call runs when the lang file is evaluated byrequire_all_files_in_config_directory— outside any pluginconfigcallback — so the autocmd is registered regardless of whether associated plugins have loaded. The same issue is tracked fornvim-dap-ui.lua(#54) andnvim-lspconfig.lua(#55);yaml.luahas the same pattern unaddressed.Ideal state
configfunction of the relevant plugin spec inyaml.luayaml.luacontains only areturntable of plugin specs, with no imperative calls before thereturnStarting points
lua/config/plugins/lang/yaml.lua— the LspAttach autocmd at the top levelQA plan
lua/config/plugins/lang/yaml.lua— expect no imperative calls before thereturnstatementnvim --headless -c "qall"— expect exit 0 with no Lua errors.yamlfile in Neovim — expect LSP attach behavior to work as before (keymaps and formatting on save)Done when
lua/config/plugins/lang/yaml.luahas no imperative calls outside thereturnblock.