uros-5 / jinja-lsp Goto Github PK
View Code? Open in Web Editor NEWLanguage Server for jinja
Home Page: https://crates.io/crates/jinja-lsp
License: MIT License
Language Server for jinja
Home Page: https://crates.io/crates/jinja-lsp
License: MIT License
Hey mate,
I saw in your description that it supports nvim. Is there documentation somewhere on how to set it up? Great stuff :)
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
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?
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.