Giter Site home page Giter Site logo

uros-5 / jinja-lsp Goto Github PK

View Code? Open in Web Editor NEW
74.0 3.0 1.0 4.58 MB

Language Server for jinja

Home Page: https://crates.io/crates/jinja-lsp

License: MIT License

TypeScript 1.43% Rust 91.16% JavaScript 5.90% Jinja 1.16% Python 0.24% Shell 0.11%
helix jinja jinja2 lsp minijinja nvim rust

jinja-lsp's Issues

Neovim support

Hey mate,

I saw in your description that it supports nvim. Is there documentation somewhere on how to set it up? Great stuff :)

Not clear where to put configuration

I would really like to use this language server, but i do not have a clue on where to put the configuration json string.

I am using neovim and installed the lsp using mason, but it is clearly not attaching to buffers.

If more informations are needed just ask me

How can I disable undefined_variable errors in jinja-lsp?

I am using jinja-lsp for language server support in my Neovim setup, and I would like to configure it to ignore undefined_variable errors. How can I achieve this? Are there specific configuration settings or options I need to adjust, either in the server's configuration file or through init_options?

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

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.