Comments (7)
I have exactly the same problem, bump!
from jinja-lsp.
Check this #6
from jinja-lsp.
Unsure of what I'm doing wrong, but everywhere where I'm using the {} syntax I get "Undefined variable" warning
{% import 'components/test.html' as tests %} <-- Warning here
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>HTML5 Boilerplate</title>
<link href="../static/output.css" rel="stylesheet">
<script src="../static/htmx.min.js"></script>
</head>
<body>
<h1 class="bg-red-50 text-zinc-50">Page Title</h1>
<h2>Another juan</h2>
<div class="bg-red-500 text-zinc-50">
Hello from a box
</div>
{{tests.test('test thingy')}} <-- Warning here
{{request}} <-- Warning here
<div class="bg-blue-500 text-[50px]">
{{id}} <-- Warning here
</div>
</body>
</html>
Although I get snippets help everywhere.
I copied the setup from that other post, but changed lang to python. It doesn't seem to parse the variables from other files.
Am I missing some treesitter thing or something?
extension = {
jinja = 'jinja',
jinja2 = 'jinja',
j2 = 'jinja',
},
}
-- uncomment this part if language server is not working
vim.lsp.set_log_level("debug")
local configs = require('lspconfig.configs')
-- try to remove this if statement at the moment and leave only that inner block
-- if it succeeds then add it again
-- if not configs.jinja_lsp then
configs.jinja_lsp = {
default_config = {
name = "jinja-lsp",
cmd = { "/home/john/.cargo/bin/jinja-lsp" },
filetypes = { "html", "jinja", "rs", "css" },
root_dir = function(fname)
return "."
-- return require("lspconfig").util.find_git_ancestor(fname)
end,
init_options = {
templates = './templates',
backend = { './src' },
lang = "python"
}
}
}
-- end
require("lspconfig").jinja_lsp.setup {}
lsp.setup()
src
__pycache__
main.py
static
htmx.min.js
output.css
templates
components
test.html
index.html
input.css
requirements.txt
tailwind.config.js
from jinja-lsp.
Check this #6
I in fact checked that and (using my modified version of kickstart) the lsp is started correctly. (I can maybe write a PR to write about it in the readme for future people to see?)
The next problem is that, even if started correctly, when first starting the server it gives me the error: RPC[Error] code_name = InvalidParams, message = "invalid type: string \"utf-8\", expected a sequence"
Edit: I should also mention that i am trying to use it with python. Maybe it's better to use the 'python' branch?
from jinja-lsp.
Activate this LSP for Python files, by modifying filetypes
.
filetypes = { 'jinja', 'python' },
Can you try to run it with this example?
git clone https://github.com/uros-5/jinja-lsp.git --depth 1
cd jinja-lsp/example
git init .
nvim .
Enable debugging.
from jinja-lsp.
Activate this LSP for Python files, by modifying
filetypes
.filetypes = { 'jinja', 'python' },Can you try to run it with this example?
git clone https://github.com/uros-5/jinja-lsp.git --depth 1 cd jinja-lsp/example git init . nvim .Enable debugging.
It works, I think the key is initing Git
from jinja-lsp.
Activate this LSP for Python files, by modifying
filetypes
.filetypes = { 'jinja', 'python' },Can you try to run it with this example?
git clone https://github.com/uros-5/jinja-lsp.git --depth 1 cd jinja-lsp/example git init . nvim .Enable debugging.
Still the same error. Cannot figure out why.
from jinja-lsp.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jinja-lsp.