Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

need help for configuring django-template-lsp (djlsp) #1304

Open
1 task done
AmZaDin14 opened this issue Jan 11, 2025 · 0 comments
Open
1 task done

need help for configuring django-template-lsp (djlsp) #1304

AmZaDin14 opened this issue Jan 11, 2025 · 0 comments

Comments

@AmZaDin14
Copy link

Before Reporting an Issue

  • I have read the kickstart.nvim README.md.

  • I have read the appropiate plugin's documentation.

  • I have searched that this issue has not been reported before.

  • By checking this, I confirm that the above steps are completed. I understand leaving this unchecked will result in this report being closed immediately.

Describe the bug

The djlsp package is not found by mason.lspconfig, causing an error when added to lspconfig servers

To Reproduce

  1. Add djlsp to lspconfig servers
diff --git a/init.lua b/init.lua
index 610018e..ff956cd 100644
--- a/init.lua
+++ b/init.lua
@@ -631,6 +631,7 @@ require('lazy').setup({
         -- ts_ls = {},
         --
 
+        djlsp = {},
         lua_ls = {
           -- cmd = { ... },
           -- filetypes = { ... },
  1. Rerun neovim, got this error:
Error executing vim.schedule lua callback: ...l/share/nvim/lazy/mason.nvim/lua/mason-registry/init.lua:80: Cannot find package "djlsp".                                                       
stack traceback:                                                                                                                                                                              
        [C]: in function 'error'                                                                                                                                                              
        ...l/share/nvim/lazy/mason.nvim/lua/mason-registry/init.lua:80: in function 'get_package'                                                                                             
        ...on-tool-installer.nvim/lua/mason-tool-installer/init.lua:166: in function 'callback'                                                                                               
        ...share/nvim/lazy/mason.nvim/lua/mason-core/async/init.lua:87: in function 'step'                                                                                                    
        ...share/nvim/lazy/mason.nvim/lua/mason-core/async/init.lua:96: in function 'run'                                                                                                     
        ...l/share/nvim/lazy/mason.nvim/lua/mason-registry/init.lua:202: in function 'refresh'                                                                                                
        ...on-tool-installer.nvim/lua/mason-tool-installer/init.lua:195: in function ''                                                                                                       
        vim/_editor.lua: in function ''                                                                                                                                                       
        vim/_editor.lua: in function <vim/_editor.lua:0>

Workaround

  1. Manually install django-template-lsp using :Mason
  2. Execute djlsp.setup at the end of init.lua
diff --git a/init.lua b/init.lua
index 610018e..5e3c46b 100644
--- a/init.lua
+++ b/init.lua
@@ -972,5 +972,6 @@ require('lazy').setup({
   },
 })
 
+require('lspconfig').djlsp.setup {}
 -- The line beneath this is called `modeline`. See `:help modeline`
 -- vim: ts=2 sts=2 sw=2 et

output of :LspInfo

==============================================================================
lspconfig: require("lspconfig.health").check()

LSP configs active in this session (globally) ~
- Configured servers: lua_ls, djlsp
- OK Deprecated servers: (none)

LSP configs active in this buffer (bufnr: 1) ~
- Language client log: ~/.local/state/nvim/lsp.log
- Detected filetype: `htmldjango`
- 0 client(s) attached to this buffer
- Other clients that match the "htmldjango" filetype:
- Config: djlsp
  filetypes:         html, htmldjango
  cmd:               ~/Code/django-w3schools/djlsp
  version:           `?` (Failed to get version) Tried:
  `djlsp --version`
  `djlsp -version`
  `djlsp version`
  `djlsp --help`
  
  executable:        true
  autostart:         true
  root directory:    ~/code/django-project/

Docs for active configs:
- djlsp docs:
  
        https://github.com/fourdigits/django-template-lsp
  
        `djlsp`, a language server for Django templates.

Desktop

  • OS: Arch Linux
  • Terminal: Kitty

Neovim Version

NVIM v0.10.3
Build type: RelWithDebInfo
LuaJIT 2.1.1731601260
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant