From ba3a762e7273d8069b3e4ec72cd9bab03b8f057a Mon Sep 17 00:00:00 2001 From: Uros Mrkobrada Date: Mon, 13 May 2024 15:36:21 +0200 Subject: [PATCH] updated README.md --- README.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/README.md b/README.md index 11b0489..4c8c98a 100644 --- a/README.md +++ b/README.md @@ -85,4 +85,48 @@ name = "jinja" language-servers = ["jinja-lsp"] ``` +Neovim configuration + +```lua +vim.filetype.add { + extension = { + jinja = 'jinja', + jinja2 = 'jinja', + j2 = 'jinja', + }, +} + +-- if you want to debug +vim.lsp.set_log_level("debug") + +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 = { 'path_to_lsp_or_command' }, + filetypes = { 'jinja', 'rust' }, + root_dir = function(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 { +} +``` + + Supported languages: Python, Rust