Open mosheavni opened 2 months ago
save yourself the hassle, this repo seems to be dead. this guy made a out of the box implementation of crd detection:
https://github.com/msvechla/yaml-companion.nvim/tree/kubernetes_crd_detection
save yourself the hassle, this repo seems to be dead. this guy made a out of the box implementation of crd detection:
https://github.com/msvechla/yaml-companion.nvim/tree/kubernetes_crd_detection
switched to using it, but still no completion if I don't specify kubernetes
inside schemas = {}
Bumped into this too, it worked before. I based my setup to this one: https://www.arthurkoziel.com/json-schemas-in-neovim/
Hi, I'll start off by saying I am not sure if the issue is relevant here or on the yaml-language-server issues. I read through many issues regarding registering kubernetes schemas but not sure my issue is the same.
If I set in my
lspconfig.settings.yaml.schemas.kubernetes = '/*'
I get kubernetes completions, but then I get it for EVERY yaml file and it's obviously wrong. If I remove thekubernetes = '/*'
, then there are no Kubernetes completion, even after I select a schema.Using minimal_init.lua and comparing the logs, the only difference I see is:
To reproduce:
save
minimal_init.lua
minimal_init.lua
```lua local function join_paths(...) local path_sep = '/' local result = table.concat({ ... }, path_sep) return result end local temp_dir = vim.uv.os_getenv 'TEMP' or '/tmp' local package_root = join_paths(temp_dir, 'nvim', 'site', 'lazy') local lazypath = join_paths(temp_dir, 'nvim', 'site') .. '/lazy/lazy.nvim' if not vim.loop.fs_stat(lazypath) then vim .system({ 'git', 'clone', '--filter=blob:none', '--single-branch', 'https://github.com/folke/lazy.nvim.git', lazypath, }, { text = true }) :wait() end vim.opt.runtimepath:prepend(lazypath) _G.load_config = function() vim.lsp.set_log_level 'trace' require('vim.lsp.log').set_format_func(vim.inspect) ---@diagnostic disable-next-line: missing-fields require('nvim-treesitter.configs').setup { highlight = { enable = true }, } -- Set up completion local cmp = require 'cmp' cmp.setup { mapping = cmp.mapping.preset.insert { ['save a kubernetes resource yaml:
pod.yaml
```yaml --- apiVersion: v1 kind: Pod metadata: name: init-demo spec: containers: - name: nginx image: nginx ports: - containerPort: 80 volumeMounts: - name: workdir mountPath: /usr/share/nginx/html resources: limits: memory: '1Gi' cpu: '800m' requests: memory: '700Mi' cpu: '400m' # These containers are run during pod initialization initContainers: - name: install image: busybox command: - wget - '-O' - '/work-dir/index.html' - http://kubernetes.io volumeMounts: - name: workdir mountPath: '/work-dir' dnsPolicy: Default volumes: - name: workdir emptyDir: {} ```open the
pod.yaml
usingminimal_init.lua
:make sure the lsp started and try to get completions in the
metadata:
block. no completions comment outkubernetes = '/*',
onminimal_init.lua
open the file again, now there are completions. now open a completely different yaml file, and there would be diagnostics for Kubernetes schema even though it's not a kubernetes file.Desired behavior
When I open a kubernetes file, get kubernetes completion. when I open every other file, use schema store or set no schema at all.
If there's any more information I can add, please let me know. Thanks.