With the current default configuration of the "docker_compose_language_service" LSP, it will not start, nor attach after being started to the current buffer.
When taking a look at the configuration here: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#docker_compose_language_service
I noticed that the file type is, "yaml.docker-compose". However docker-compose files are usually postfixed with either .yaml or .yml so the filetype will never be detected as such.
The way I got around this is running :setfiletype yaml.docker-compose
and then the LSP would behave normally. The first solution I thought was to change the filetypes from the setup to .yaml and .yml but I don't think that's the right approach.
In my neovim configuration, I now have this in my options.lua to automatically run this depending on whether the file is named, "docker-compose.yaml".
function docker_fix()
local filename = vim.fn.expand("%:t")
if filename == "docker-compose.yaml" then
vim.bo.filetype = "yaml.docker-compose"
print("matched!")
else
print(filename)
end
end
vim.cmd[[au BufRead * lua docker_fix()]]
I don't think this normal behavior. Is having the filetype, "yaml.docker-compose" intended or is there something wrong with my working environment? The only other thing I can think of is that the current working directory does have a docker-compose.yaml (and of course it would, I'm working on that exact file!) and it doesn't pick up the current_dir as the root_dir.
If anyone could give me a clue or insight, I'd appreciate it. Thank you!
filetype
and file extension are not supposed to be the same. Theyaml.docker-compose
is a combinedfiletype
that trigger theyaml
filetype
extensions and thedocker-compose
filetype
extension.