jinja-lsp icon indicating copy to clipboard operation
jinja-lsp copied to clipboard

Can't get it to work with neovim (NvChad)

Open seamus-45 opened this issue 6 months ago • 1 comments

I used recommended setup:

  vim.filetype.add {
    extension = {
      jinja = 'jinja',
      jinja2 = 'jinja',
      j2 = 'jinja',
    },
  }

  -- if you want to debug
  vim.lsp.set_log_level("debug")
  if vim.fn.has 'nvim-0.5.1' == 1 then
    require('vim.lsp.log').set_format_func(vim.inspect)
  end

  local nvim_lsp = require('lspconfig')
  local configs = require('lspconfig.configs')

  if not configs.jinja_lsp then
  configs.jinja_lsp = {
    default_config = {
      name = "jinja-lsp",
      cmd = { '/home/seamus/.local/share/nvim/mason/bin/jinja-lsp' },
      filetypes = { 'jinja', 'rust' },
      root_dir = function(fname)      Unused local `fname`.
        return "."
        --return nvim_lsp.util.find_git_ancestor(fname)
      end,
      init_options = {
        templates = './templates',
        backend = { './src' },
        lang = "rust"
      },
  },
  }
  end
  local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
  nvim_lsp.jinja_lsp.setup {
    capabilities = capabilities
  }
  nvim_lsp.jinja_lsp.setup {
  }

Client is shown at LspInfo as attached:

Language client log: /home/seamus/.local/state/nvim/lsp.log
Detected filetype:   jinja

client(s) attached to this buffer:
Client: jinja_lsp (id: 1, bufnr: [1])
filetypes:       jinja, rust
 autostart:       true
root directory:  .
cmd:             /home/seamus/.local/share/nvim/mason/bin/jinja-lsp

Configured servers list: jinja_lsp, lua_ls

Server reported its initizlized:

[DEBUG][2024-08-16 18:47:02] .../vim/lsp/rpc.lua:408    "rpc.receive"   {
  jsonrpc = "2.0",
  method = "window/logMessage",
  params = {
    message = "Initialized",
    type = 3
  }
}

But as I can see server does not respond properly:

[DEBUG][2024-08-16 18:47:09] .../vim/lsp/rpc.lua:286    "rpc.send"      {
  id = 2,
  jsonrpc = "2.0",
  method = "textDocument/completion",
  params = {
    context = {
      triggerCharacter = "%",
      triggerKind = 2
    },
    position = {
      character = 2,
      line = 1
    },
    textDocument = {
      uri = "file:///home/seamus/gitlab/frontends-configs/acquiring/templates/acquiring.conf.j2"
    }
  }
}
[DEBUG][2024-08-16 18:47:09] .../vim/lsp/rpc.lua:408    "rpc.receive"   {
  id = 2,
  jsonrpc = "2.0"
}

What could I be missing?

seamus-45 avatar Aug 16 '24 13:08 seamus-45