Null ls not started with command `tab new`
FAQ
- [X] I have checked the FAQ and it didn't resolve my problem.
Issues
- [X] I have checked existing issues and there are no issues with the same problem.
Neovim Version
NVIM v0.10.0 Build type: Release LuaJIT 2.1.1716656478
Dev Version?
- [ ] I am using a stable Neovim release version, or if I am using a dev version of Neovim I have confirmed that my issue is reproducible on a stable version.
Operating System
Darwin wisers-MacBook-Pro.local 22.3.0 Darwin Kernel Version 22.3.0
Minimal Config
return {
"nvimtools/none-ls.nvim",
dependencies = {
"nvimtools/none-ls-extras.nvim",
},
lazy = true,
event = { "BufReadPre", "BufNewFile" },
config = function()
local null_ls = require("null-ls")
-- custom setup
null_ls.setup({
border = "single",
sources = {
require("none-ls.formatting.jq"), -- json formatter
},
-- configure format on save
on_attach = function(current_client, bufnr)
if current_client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ async = false })
end,
})
end
end,
})
end,
}
Steps to Reproduce
- nvim
- :tab new
- :set filetype=json
- :NullLsInfo
Reproducibility Check
- [ ] I confirm that my minimal config is based on the
minimal_init.luatemplate and that my issue is reproducible by runningnvim --clean -u minimal_init.luaand following the steps above.
Expected Behavior
:NullLsInfo
Actual Behavior
:NullLsInfo
Debug Log
No debug log because of null ls is not started.
Help
No
Implementation Help
No response
Requirements
- [X] I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.
In this case, filetype is only set after null-ls initialized, you have to manually start the sources.
I consider this not an issue? I'm open to discussing.
In this case, filetype is only set after null-ls initialized, you have to manually start the sources.
I don't know when and how null-ls initialized, but lsp server is started after set filetype.
PS: If null-ls's sources could be attached manually, please tell me, thx.
You could could force it to start by starting the buffer with a file name, even if it does not exist yet
:tabnew tmp-file.json