Closed Arkoprabho closed 1 year ago
The built-in Kubernetes matcher only triggers when kind
is equal to one of the values in https://github.com/someone-stole-my-name/yaml-companion.nvim/blob/main/lua/yaml-companion/builtin/kubernetes/resources.lua. If you want to set any file with kind
in it to Kubernetes, you should create your own alternative matcher:
I have been trying with Deployments and Pods. I tried explicitly confirming the kubernetes schema from the telescope picker. It has the output as mentioned in the root comment
Not sure if the closing of the issue was intentional or not, hence the tag @someone-stole-my-name
What is your nvim version? Do you have more details about how to reproduce your issue? The behaviour you describe is tested here, so it should work 😓
nvim --version
nvim --version
NVIM v0.8.1
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@Ventura-arm64.local
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.8.1/share/nvim"
Run :checkhealth for more info
Do you think it might be to do with the yaml-language-server? My line of thought here is that if it is the language server, then it shouldn't work even with the schema defined explicitly. Is that a correct understanding? Another thought process is that it seems to be working without the plugin. The tests and the code logic looks ok 🤔 . Might be a bad configuration or a gotcha. My dotfiles are here. If we do find something that we can mention as a part of documentation or code update, I'll be delighted to submit a PR for the same.
Give me some time to come up with a way to replicate the issue with least possible setup.
After some more digging these are my observations:
local yaml_companion = require("yaml-companion")
yaml_companion.setup({
-- ovverrides here
})
The above code doesnt work. But
local yaml_companion = require("yaml-companion").setup({
-- ovverrides here
})
This works. 🤔
Glad you got it working 🚀 The setup
function returns the config you must use when configuring the server.
local cfg = require("yaml-companion").setup({})
require("lspconfig")["yamlls"].setup(cfg)
You can't throw away the result of setup
and configure the server with your own table. If you need to customize the setup table, you can pass your own flags inside require("yaml-companion").setup({ lspconfig = {...} })
or leave it empty to use the default.
Expected behaviour: When opening a file that has
kind:
autocomplete should work and the schema should be detected.Do note that when the file starts with the directive:
# yaml-language-server: $schema=https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.26.0-standalone-strict/all.json
the autocomplete works as expected.LspInfo:
lua =require("yaml-companion.config").options
lua =require("yaml-companion").get_buf_schema(0)
The plugin config is default as mentioned in the readme