Closed aaronjconway closed 1 month ago
Hmm, since this works fine in VS Code, Zed and other editors, I assume it's something specific to Neovim. Not too sure what, my guess would be something with the path handling, since this only happens on dynamic routes with []
@aaronjconway I have the same problem, but not really sure if it's a problem with astro or with neovim. Please post an update if you find the culprit or a solution to this.
Update: Downgrading astro lsp to version 2.6.3 resolved the issue. Still looking for a proper solution to this.
I have had the exact same issue and the solution with downgrading fixed the problem as @frametreon said.
I will try to see what I can find, when time allows for it on my end.
If there's any logs or something that Neovim outputs, I'd be happy to take a look
If there's any logs or something that Neovim outputs, I'd be happy to take a look
I think I have the time during the weekend, so I will give some update then!
I am having the same problem here.
Same issue happend with me today Working on normal routes: /blog.astro, /index.astro etc Not working on dynamic: /blog/[slug]/index.astro ...etc
All those "It happens to me too" comments are unfortunately not helpful. If there's any logs from either Neovim or the language server, please share them.
[DEBUG][2024-02-29 18:53:51] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 35, jsonrpc = "2.0", method = "workspace/configuration", params = { items = { { scopeUri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro?virtualCodeId=root", section = "prettier" } } }}
[DEBUG][2024-02-29 18:53:51] .../vim/lsp/rpc.lua:403 "server_request: callback result" { result = { vim.NIL }, status = true}
[DEBUG][2024-02-29 18:53:51] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 35, jsonrpc = "2.0", result = { vim.NIL }}
[DEBUG][2024-02-29 18:53:52] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 58, jsonrpc = "2.0", result = { { newText = "---\nimport { getEvent } from '../../utils/directusClient'\nimport EventsBody from '../../components/Events/EventsBody.astro'\nconst { id } = Astro.params\n\nif (!id) throw new Error('Missing ID parameter')\n\nconst event = await getEvent(id)\n\nexport const prerender = false\n---\n\n<p></p>\n<div class=\"my-48 flex flex-col items-center justify-center space-y-6\">\n <EventsBody content={event.event_info} />\n</div>\n", range = { ["end"] = { character = 0, line = 15 }, start = { character = 0, line = 0 } } } }}
[DEBUG][2024-02-29 18:53:52] .../vim/lsp/rpc.lua:284 "rpc.send" { jsonrpc = "2.0", method = "textDocument/didChange", params = { contentChanges = { { text = "---\nimport { getEvent } from '../../utils/directusClient'\nimport EventsBody from '../../components/Events/EventsBody.astro'\nconst { id } = Astro.params\n\nif (!id) throw new Error('Missing ID parameter')\n\nconst event = await getEvent(id)\n\nexport const prerender = false\n---\n\n<p></p>\n<div class=\"my-48 flex flex-col items-center justify-center space-y-6\">\n <EventsBody content={event.event_info} />\n</div>\n</div>\n" } }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", version = 38 } }}
[DEBUG][2024-02-29 18:53:52] .../vim/lsp/rpc.lua:284 "rpc.send" { jsonrpc = "2.0", method = "textDocument/didChange", params = { contentChanges = { { range = { ["end"] = { character = 6, line = 15 }, start = { character = 3, line = 0 } }, rangeLength = 416, text = "\nimport { getEvent } from '../../utils/directusClient'\nimport EventsBody from '../../components/Events/EventsBody.astro'\nconst { id } = Astro.params\n\nif (!id) throw new Error('Missing ID parameter')\n\nconst event = await getEvent(id)\n\nexport const prerender = false\n---\n\n<p></p>\n<div class=\"my-48 flex flex-col items-center justify-center space-y-6\">\n <EventsBody content={event.event_info} />\n</div>\n</div>" } }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", version = 38 } }}
[DEBUG][2024-02-29 18:53:52] .../vim/lsp/rpc.lua:284 "rpc.send" { jsonrpc = "2.0", method = "textDocument/didSave", params = { textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" } }}
[DEBUG][2024-02-29 18:53:52] .../vim/lsp/rpc.lua:284 "rpc.send" { jsonrpc = "2.0", method = "textDocument/didSave", params = { textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" } }}
[DEBUG][2024-02-29 18:53:52] .../lua/vim/lsp.lua:1391 "LSP[astro]" "client.request" 5 "textDocument/documentHighlight" { position = { character = 25, line = 1 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" }} <function 1> 19
[DEBUG][2024-02-29 18:53:52] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 59, jsonrpc = "2.0", method = "textDocument/documentHighlight", params = { position = { character = 25, line = 1 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" } }}
[DEBUG][2024-02-29 18:53:52] .../vim/lsp/rpc.lua:284 "rpc.send" { jsonrpc = "2.0", method = "$/cancelRequest", params = { id = 59 }}
[DEBUG][2024-02-29 18:53:52] .../lua/vim/lsp.lua:1391 "LSP[astro]" "client.request" 5 "textDocument/documentHighlight" { position = { character = 25, line = 1 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" }} <function 1> 19
[DEBUG][2024-02-29 18:53:52] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 60, jsonrpc = "2.0", method = "textDocument/documentHighlight", params = { position = { character = 25, line = 1 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" } }}
[DEBUG][2024-02-29 18:53:52] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 59, jsonrpc = "2.0", result = { { kind = 2, range = { ["end"] = { character = 52, line = 1 }, start = { character = 26, line = 1 } } } }}
[DEBUG][2024-02-29 18:53:52] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 60, jsonrpc = "2.0", result = { { kind = 2, range = { ["end"] = { character = 52, line = 1 }, start = { character = 26, line = 1 } } } }}
[DEBUG][2024-02-29 18:53:52] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 36, jsonrpc = "2.0", method = "workspace/configuration", params = { items = { { section = "typescript.validate.enable" } } }}
[DEBUG][2024-02-29 18:53:52] .../vim/lsp/rpc.lua:403 "server_request: callback result" { result = { vim.NIL }, status = true}
[DEBUG][2024-02-29 18:53:52] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 36, jsonrpc = "2.0", result = { vim.NIL }}
[DEBUG][2024-02-29 18:53:52] .../vim/lsp/rpc.lua:387 "rpc.receive" { jsonrpc = "2.0", method = "textDocument/publishDiagnostics", params = { diagnostics = {}, uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", version = 38 }}
[DEBUG][2024-02-29 18:53:52] .../vim/lsp/rpc.lua:387 "rpc.receive" { jsonrpc = "2.0", method = "textDocument/publishDiagnostics", params = { diagnostics = {}, uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" }}
After turning on logging in neovim.
Probably a little hard to read, but I can't make it much more readable than this😅
Just a note, this is when I save the file after making a change. I added something to the html template and then also something to the JS section(not script element) I will try and show it looks with a recording in a moment.
Using version 2.7.6
https://github.com/withastro/language-tools/assets/9026132/ddb21205-dc5a-47e3-9fe1-6970e919e9aa
Here is a small video of the issue in action, this is purely for reference.
Thank you, the logs are helpful. I assume that perhaps VS Code decodes the paths and Neovim doesn't, not sure who's right. We'll investigate!
Thank you, the logs are helpful. I assume that perhaps VS Code decodes the paths and Neovim doesn't, not sure who's right. We'll investigate!
Let me know if you need any more logs, I can always send a lot more😆
Thank you, the logs are helpful. I assume that perhaps VS Code decodes the paths and Neovim doesn't, not sure who's right. We'll investigate!
Let me know if you need any more logs, I can always send a lot more😆
Something that would be useful is logs from 2.6.3 if you have them, just to see the difference in encoding
Thank you, the logs are helpful. I assume that perhaps VS Code decodes the paths and Neovim doesn't, not sure who's right. We'll investigate!
Let me know if you need any more logs, I can always send a lot more😆
Something that would be useful is logs from 2.6.3 if you have them, just to see the difference in encoding
Yes let me get them those real quick.
[DEBUG][2024-02-29 19:47:36] .../vim/lsp/rpc.lua:387 "rpc.receive" { jsonrpc = "2.0", method = "textDocument/publishDiagnostics", params = { diagnostics = {}, uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" }}
[DEBUG][2024-02-29 19:47:37] .../lua/vim/lsp.lua:1391 "LSP[astro]" "client.request" 2 "textDocument/documentHighlight" { position = { character = 2, line = 10 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" }} <function 1> 19
[DEBUG][2024-02-29 19:47:37] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 2, jsonrpc = "2.0", method = "textDocument/documentHighlight", params = { position = { character = 2, line = 10 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" } }}
[DEBUG][2024-02-29 19:47:37] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 2, jsonrpc = "2.0", method = "workspace/configuration", params = { items = { { section = "typescript.preferences" } } }}
[DEBUG][2024-02-29 19:47:37] .../vim/lsp/rpc.lua:403 "server_request: callback result" { result = { vim.NIL }, status = true}
[DEBUG][2024-02-29 19:47:37] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 2, jsonrpc = "2.0", result = { vim.NIL }}
[DEBUG][2024-02-29 19:47:38] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 3, jsonrpc = "2.0", method = "workspace/configuration", params = { items = { { section = "html.customData" } } }}
[DEBUG][2024-02-29 19:47:38] .../vim/lsp/rpc.lua:403 "server_request: callback result" { result = { vim.NIL }, status = true}
[DEBUG][2024-02-29 19:47:38] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 3, jsonrpc = "2.0", result = { vim.NIL }}
[DEBUG][2024-02-29 19:47:38] .../vim/lsp/rpc.lua:387 "rpc.receive" { jsonrpc = "2.0", method = "textDocument/publishDiagnostics", params = { diagnostics = {}, uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", version = 0 }}
[DEBUG][2024-02-29 19:47:38] .../vim/lsp/rpc.lua:387 "rpc.receive" { jsonrpc = "2.0", method = "textDocument/publishDiagnostics", params = { diagnostics = {}, uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", version = 0 }}
[DEBUG][2024-02-29 19:47:38] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 2, jsonrpc = "2.0", result = {}}
[DEBUG][2024-02-29 19:47:38] .../lua/vim/lsp.lua:1391 "LSP[astro]" "client.request" 2 "textDocument/documentHighlight" { position = { character = 2, line = 10 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" }} <function 1> 19
[DEBUG][2024-02-29 19:47:38] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 3, jsonrpc = "2.0", method = "textDocument/documentHighlight", params = { position = { character = 2, line = 10 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" } }}
[DEBUG][2024-02-29 19:47:38] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 3, jsonrpc = "2.0", result = {}}
[DEBUG][2024-02-29 19:47:38] .../lua/vim/lsp.lua:1391 "LSP[astro]" "client.request" 2 "textDocument/documentHighlight" { position = { character = 3, line = 10 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" }} <function 1> 19
[DEBUG][2024-02-29 19:47:38] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 4, jsonrpc = "2.0", method = "textDocument/documentHighlight", params = { position = { character = 3, line = 10 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" } }}
[DEBUG][2024-02-29 19:47:38] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 4, jsonrpc = "2.0", result = {}}
[DEBUG][2024-02-29 19:47:38] .../vim/lsp/rpc.lua:284 "rpc.send" { jsonrpc = "2.0", method = "textDocument/didChange", params = { contentChanges = { { range = { ["end"] = { character = 3, line = 10 }, start = { character = 3, line = 10 } }, rangeLength = 0, text = "\n" } }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", version = 3 } }}
[DEBUG][2024-02-29 19:47:38] .../lua/vim/lsp.lua:1391 "LSP[astro]" "client.request" 2 "textDocument/documentHighlight" { position = { character = 0, line = 11 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" }} <function 1> 19
[DEBUG][2024-02-29 19:47:38] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 5, jsonrpc = "2.0", method = "textDocument/documentHighlight", params = { position = { character = 0, line = 11 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" } }}
[DEBUG][2024-02-29 19:47:38] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 5, jsonrpc = "2.0", result = {}}
[DEBUG][2024-02-29 19:47:39] .../vim/lsp/rpc.lua:284 "rpc.send" { jsonrpc = "2.0", method = "textDocument/didChange", params = { contentChanges = { { range = { ["end"] = { character = 0, line = 11 }, start = { character = 0, line = 11 } }, rangeLength = 0, text = "\n" } }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", version = 4 } }}
[DEBUG][2024-02-29 19:47:39] .../lua/vim/lsp.lua:1391 "LSP[astro]" "client.request" 2 "textDocument/documentHighlight" { position = { character = 0, line = 12 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" }} <function 1> 19
[DEBUG][2024-02-29 19:47:39] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 6, jsonrpc = "2.0", method = "textDocument/documentHighlight", params = { position = { character = 0, line = 12 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" } }}
[DEBUG][2024-02-29 19:47:39] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 6, jsonrpc = "2.0", result = {}}
[DEBUG][2024-02-29 19:47:39] .../vim/lsp/rpc.lua:284 "rpc.send" { jsonrpc = "2.0", method = "textDocument/didChange", params = { contentChanges = { { text = "---\nimport { getEvent } from '../../utils/directusClient'\nimport EventsBody from '../../components/Events/EventsBody.astro'\nconst { id } = Astro.params\n\nif (!id) throw new Error('Missing ID parameter')\n\nconst event = await getEvent(id)\n\nexport const prerender = false\n---\n\n\n<div class=\"my-48 flex flex-col items-center justify-center space-y-6\">\n <EventsBody content={event.event_info} />\n</div>\n" } }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", version = 4 } }}
[DEBUG][2024-02-29 19:47:39] .../vim/lsp/rpc.lua:284 "rpc.send" { jsonrpc = "2.0", method = "textDocument/didChange", params = { contentChanges = { { range = { ["end"] = { character = 0, line = 12 }, start = { character = 0, line = 12 } }, rangeLength = 0, text = "p" } }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", version = 5 } }}
[DEBUG][2024-02-29 19:47:39] .../lua/vim/lsp.lua:1391 "LSP[astro]" "client.request" 2 "textDocument/documentHighlight" { position = { character = 1, line = 12 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" }} <function 1> 19
[DEBUG][2024-02-29 19:47:39] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 7, jsonrpc = "2.0", method = "textDocument/documentHighlight", params = { position = { character = 1, line = 12 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" } }}
[DEBUG][2024-02-29 19:47:39] .../vim/lsp/rpc.lua:284 "rpc.send" { jsonrpc = "2.0", method = "textDocument/didChange", params = { contentChanges = { { text = "---\nimport { getEvent } from '../../utils/directusClient'\nimport EventsBody from '../../components/Events/EventsBody.astro'\nconst { id } = Astro.params\n\nif (!id) throw new Error('Missing ID parameter')\n\nconst event = await getEvent(id)\n\nexport const prerender = false\n---\n\np\n<div class=\"my-48 flex flex-col items-center justify-center space-y-6\">\n <EventsBody content={event.event_info} />\n</div>\n" } }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", version = 5 } }}
[DEBUG][2024-02-29 19:47:39] .../lua/vim/lsp.lua:1391 "LSP[tailwindcss]" "client.request" 1 "textDocument/completion" { context = { triggerKind = 1 }, position = { character = 1, line = 12 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" }} <function 1> 19
[DEBUG][2024-02-29 19:47:39] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 2, jsonrpc = "2.0", method = "textDocument/completion", params = { context = { triggerKind = 1 }, position = { character = 1, line = 12 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" } }}
[DEBUG][2024-02-29 19:47:39] .../lua/vim/lsp.lua:1391 "LSP[astro]" "client.request" 2 "textDocument/completion" { context = { triggerKind = 1 }, position = { character = 1, line = 12 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" }} <function 1> 19
[DEBUG][2024-02-29 19:47:39] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 8, jsonrpc = "2.0", method = "textDocument/completion", params = { context = { triggerKind = 1 }, position = { character = 1, line = 12 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" } }}
[DEBUG][2024-02-29 19:47:39] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 2, jsonrpc = "2.0"}
[DEBUG][2024-02-29 19:47:39] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 7, jsonrpc = "2.0", result = {}}
[DEBUG][2024-02-29 19:47:39] .../vim/lsp/rpc.lua:387 "rpc.receive" { jsonrpc = "2.0", method = "textDocument/publishDiagnostics", params = { diagnostics = {}, uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", version = 4 }}
[DEBUG][2024-02-29 19:47:39] .../vim/lsp/rpc.lua:387 "rpc.receive" { jsonrpc = "2.0", method = "textDocument/publishDiagnostics", params = { diagnostics = {}, uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", version = 4 }}
[DEBUG][2024-02-29 19:47:39] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 4, jsonrpc = "2.0", method = "workspace/configuration", params = { items = { { section = "html.completion" } } }}
[DEBUG][2024-02-29 19:47:39] .../vim/lsp/rpc.lua:403 "server_request: callback result" { result = { vim.NIL }, status = true}
[DEBUG][2024-02-29 19:47:39] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 4, jsonrpc = "2.0", result = { vim.NIL }}
[DEBUG][2024-02-29 19:47:39] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 5, jsonrpc = "2.0", method = "workspace/configuration", params = { items = { { section = "emmet" } } }}
[DEBUG][2024-02-29 19:47:39] .../vim/lsp/rpc.lua:403 "server_request: callback result" { result = { vim.NIL }, status = true}
[DEBUG][2024-02-29 19:47:39] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 5, jsonrpc = "2.0", result = { vim.NIL }}
[DEBUG][2024-02-29 19:47:39] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 8, jsonrpc = "2.0", result = { isIncomplete = true, items = { { data = { original = { textEdit = { newText = "<p>${0}</p>", range = { ["end"] = { character = 1, line = 2 }, start = { character = 0, line = 2 } } } }, serviceId = "emmet", uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", virtualDocumentUri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5Bid%5D.astro.html" }, detail = "Emmet Abbreviation", documentation = "<p>|</p>", insertTextFormat = 2, label = "p", textEdit = { newText = "<p>${0}</p>", range = { ["end"] = { character = 1, line = 12 }, start = { character = 0, line = 12 } } } }, { data = { original = { textEdit = { newText = "<pre>${0}</pre>", range = { ["end"] = { character = 1, line = 2 }, start = { character = 0, line = 2 } } } }, serviceId = "emmet", uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", virtualDocumentUri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5Bid%5D.astro.html" }, detail = "Emmet Abbreviation", documentation = "<pre>|</pre>", insertTextFormat = 2, label = "pre", textEdit = { newText = "<pre>${0}</pre>", range = { ["end"] = { character = 1, line = 12 }, start = { character = 0, line = 12 } } } }, { data = { original = { textEdit = { newText = '<param name="${1}" value="${0}">', range = { ["end"] = { character = 1, line = 2 }, start = { character = 0, line = 2 } } } }, serviceId = "emmet", uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", virtualDocumentUri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5Bid%5D.astro.html" }, detail = "Emmet Abbreviation", documentation = '<param name="|" value="|">', insertTextFormat = 2, label = "param", textEdit = { newText = '<param name="${1}" value="${0}">', range = { ["end"] = { character = 1, line = 12 }, start = { character = 0, line = 12 } } } }, { data = { original = { textEdit = { newText = "<plaintext>${0}</plaintext>", range = { ["end"] = { character = 1, line = 2 }, start = { character = 0, line = 2 } } } }, serviceId = "emmet", uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", virtualDocumentUri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5Bid%5D.astro.html" }, detail = "Emmet Abbreviation", documentation = "<plaintext>|</plaintext>", insertTextFormat = 2, label = "plaintext", textEdit = { newText = "<plaintext>${0}</plaintext>", range = { ["end"] = { character = 1, line = 12 }, start = { character = 0, line = 12 } } } } } }}
[DEBUG][2024-02-29 19:47:39] .../lua/vim/lsp.lua:1391 "LSP[astro]" "client.request" 2 "completionItem/resolve" { data = { original = { textEdit = { newText = "<p>${0}</p>", range = { ["end"] = { character = 1, line = 2 }, start = { character = 0, line = 2 } } } }, serviceId = "emmet", uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", virtualDocumentUri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5Bid%5D.astro.html" }, detail = "Emmet Abbreviation", documentation = "<p>|</p>", insertTextFormat = 2, label = "p", textEdit = { newText = "<p>${0}</p>", range = { ["end"] = { character = 1, line = 12 }, start = { character = 0, line = 12 } } }} <function 1> 19
[DEBUG][2024-02-29 19:47:39] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 9, jsonrpc = "2.0", method = "completionItem/resolve", params = { data = { original = { textEdit = { newText = "<p>${0}</p>", range = { ["end"] = { character = 1, line = 2 }, start = { character = 0, line = 2 } } } }, serviceId = "emmet", uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", virtualDocumentUri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5Bid%5D.astro.html" }, detail = "Emmet Abbreviation", documentation = "<p>|</p>", insertTextFormat = 2, label = "p", textEdit = { newText = "<p>${0}</p>", range = { ["end"] = { character = 1, line = 12 }, start = { character = 0, line = 12 } } } }}
[DEBUG][2024-02-29 19:47:39] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 9, jsonrpc = "2.0", result = { data = { original = { textEdit = { newText = "<p>${0}</p>", range = { ["end"] = { character = 1, line = 2 }, start = { character = 0, line = 2 } } } }, serviceId = "emmet", uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", virtualDocumentUri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5Bid%5D.astro.html" }, detail = "Emmet Abbreviation", documentation = "<p>|</p>", insertTextFormat = 2, label = "p", textEdit = { newText = "<p>${0}</p>", range = { ["end"] = { character = 1, line = 12 }, start = { character = 0, line = 12 } } } }}
[DEBUG][2024-02-29 19:47:39] .../vim/lsp/rpc.lua:387 "rpc.receive" { jsonrpc = "2.0", method = "textDocument/publishDiagnostics", params = { diagnostics = {}, uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" }}
[DEBUG][2024-02-29 19:47:40] .../vim/lsp/rpc.lua:387 "rpc.receive" { jsonrpc = "2.0", method = "textDocument/publishDiagnostics", params = { diagnostics = {}, uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", version = 5 }}
[DEBUG][2024-02-29 19:47:40] .../vim/lsp/rpc.lua:387 "rpc.receive" { jsonrpc = "2.0", method = "textDocument/publishDiagnostics", params = { diagnostics = {}, uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", version = 5 }}
[DEBUG][2024-02-29 19:47:40] .../vim/lsp/rpc.lua:284 "rpc.send" { jsonrpc = "2.0", method = "textDocument/didChange", params = { contentChanges = { { text = "---\nimport { getEvent } from '../../utils/directusClient'\nimport EventsBody from '../../components/Events/EventsBody.astro'\nconst { id } = Astro.params\n\nif (!id) throw new Error('Missing ID parameter')\n\nconst event = await getEvent(id)\n\nexport const prerender = false\n---\n\n\n<div class=\"my-48 flex flex-col items-center justify-center space-y-6\">\n <EventsBody content={event.event_info} />\n</div>\n" } }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", version = 6 } }}
[DEBUG][2024-02-29 19:47:40] .../vim/lsp/rpc.lua:284 "rpc.send" { jsonrpc = "2.0", method = "textDocument/didChange", params = { contentChanges = { { range = { ["end"] = { character = 1, line = 12 }, start = { character = 0, line = 12 } }, rangeLength = 1, text = "" } }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", version = 6 } }}
[DEBUG][2024-02-29 19:47:40] .../vim/lsp/rpc.lua:284 "rpc.send" { jsonrpc = "2.0", method = "textDocument/didChange", params = { contentChanges = { { range = { ["end"] = { character = 0, line = 12 }, start = { character = 0, line = 12 } }, rangeLength = 0, text = "<" }, { range = { ["end"] = { character = 1, line = 12 }, start = { character = 1, line = 12 } }, rangeLength = 0, text = "p" }, { range = { ["end"] = { character = 2, line = 12 }, start = { character = 2, line = 12 } }, rangeLength = 0, text = ">" }, { range = { ["end"] = { character = 3, line = 12 }, start = { character = 0, line = 12 } }, rangeLength = 3, text = "p" }, { range = { ["end"] = { character = 1, line = 12 }, start = { character = 0, line = 12 } }, rangeLength = 1, text = "" }, { range = { ["end"] = { character = 0, line = 12 }, start = { character = 0, line = 12 } }, rangeLength = 0, text = "<p>" }, { range = { ["end"] = { character = 3, line = 12 }, start = { character = 3, line = 12 } }, rangeLength = 0, text = "" }, { range = { ["end"] = { character = 3, line = 12 }, start = { character = 3, line = 12 } }, rangeLength = 0, text = "</p>" } }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", version = 14 } }}
[DEBUG][2024-02-29 19:47:40] .../lua/vim/lsp.lua:1391 "LSP[astro]" "client.request" 2 "textDocument/documentHighlight" { position = { character = 3, line = 12 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" }} <function 1> 19
[DEBUG][2024-02-29 19:47:40] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 10, jsonrpc = "2.0", method = "textDocument/documentHighlight", params = { position = { character = 3, line = 12 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" } }}
[DEBUG][2024-02-29 19:47:40] .../lua/vim/lsp.lua:1391 "LSP[astro]" "client.request" 2 "textDocument/completion" { context = { triggerCharacter = ">", triggerKind = 2 }, position = { character = 3, line = 12 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" }} <function 1> 19
[DEBUG][2024-02-29 19:47:40] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 11, jsonrpc = "2.0", method = "textDocument/completion", params = { context = { triggerCharacter = ">", triggerKind = 2 }, position = { character = 3, line = 12 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" } }}
[DEBUG][2024-02-29 19:47:40] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 10, jsonrpc = "2.0", result = { { kind = 2, range = { ["end"] = { character = 2, line = 12 }, start = { character = 1, line = 12 } } }, { kind = 2, range = { ["end"] = { character = 6, line = 12 }, start = { character = 5, line = 12 } } } }}
[DEBUG][2024-02-29 19:47:40] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 6, jsonrpc = "2.0", method = "workspace/configuration", params = { items = { { section = "emmet" } } }}
[DEBUG][2024-02-29 19:47:40] .../vim/lsp/rpc.lua:403 "server_request: callback result" { result = { vim.NIL }, status = true}
[DEBUG][2024-02-29 19:47:40] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 6, jsonrpc = "2.0", result = { vim.NIL }}
[DEBUG][2024-02-29 19:47:40] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 11, jsonrpc = "2.0", result = { isIncomplete = false, items = {} }}
[DEBUG][2024-02-29 19:47:40] .../vim/lsp/rpc.lua:284 "rpc.send" { jsonrpc = "2.0", method = "textDocument/didChange", params = { contentChanges = { { text = "---\nimport { getEvent } from '../../utils/directusClient'\nimport EventsBody from '../../components/Events/EventsBody.astro'\nconst { id } = Astro.params\n\nif (!id) throw new Error('Missing ID parameter')\n\nconst event = await getEvent(id)\n\nexport const prerender = false\n---\n\n<p></p>\n<div class=\"my-48 flex flex-col items-center justify-center space-y-6\">\n <EventsBody content={event.event_info} />\n</div>\n" } }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", version = 14 } }}
[DEBUG][2024-02-29 19:47:40] .../lua/vim/lsp.lua:1391 "LSP[astro]" "client.request" 2 "textDocument/documentHighlight" { position = { character = 2, line = 12 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" }} <function 1> 19
[DEBUG][2024-02-29 19:47:40] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 12, jsonrpc = "2.0", method = "textDocument/documentHighlight", params = { position = { character = 2, line = 12 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" } }}
[DEBUG][2024-02-29 19:47:40] .../vim/lsp/rpc.lua:284 "rpc.send" { jsonrpc = "2.0", method = "$/cancelRequest", params = { id = 12 }}
[DEBUG][2024-02-29 19:47:40] .../lua/vim/lsp.lua:1391 "LSP[astro]" "client.request" 2 "textDocument/documentHighlight" { position = { character = 2, line = 12 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" }} <function 1> 19
[DEBUG][2024-02-29 19:47:40] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 13, jsonrpc = "2.0", method = "textDocument/documentHighlight", params = { position = { character = 2, line = 12 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" } }}
[DEBUG][2024-02-29 19:47:40] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 12, jsonrpc = "2.0"}
[DEBUG][2024-02-29 19:47:40] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 13, jsonrpc = "2.0", result = { { kind = 2, range = { ["end"] = { character = 2, line = 12 }, start = { character = 1, line = 12 } } }, { kind = 2, range = { ["end"] = { character = 6, line = 12 }, start = { character = 5, line = 12 } } }, { kind = 2, range = { ["end"] = { character = 2, line = 12 }, start = { character = 1, line = 12 } } }, { kind = 2, range = { ["end"] = { character = 6, line = 12 }, start = { character = 5, line = 12 } } } }}
[DEBUG][2024-02-29 19:47:40] .../vim/lsp/rpc.lua:387 "rpc.receive" { jsonrpc = "2.0", method = "textDocument/publishDiagnostics", params = { diagnostics = {}, uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", version = 14 }}
[DEBUG][2024-02-29 19:47:40] .../vim/lsp/rpc.lua:387 "rpc.receive" { jsonrpc = "2.0", method = "textDocument/publishDiagnostics", params = { diagnostics = {}, uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", version = 14 }}
[DEBUG][2024-02-29 19:47:40] .../lua/vim/lsp.lua:1391 "LSP[astro]" "client.request" 2 "textDocument/documentHighlight" { position = { character = 2, line = 12 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" }} <function 1> 19
[DEBUG][2024-02-29 19:47:40] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 14, jsonrpc = "2.0", method = "textDocument/documentHighlight", params = { position = { character = 2, line = 12 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" } }}
[DEBUG][2024-02-29 19:47:40] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 14, jsonrpc = "2.0", result = { { kind = 2, range = { ["end"] = { character = 2, line = 12 }, start = { character = 1, line = 12 } } }, { kind = 2, range = { ["end"] = { character = 6, line = 12 }, start = { character = 5, line = 12 } } }, { kind = 2, range = { ["end"] = { character = 2, line = 12 }, start = { character = 1, line = 12 } } }, { kind = 2, range = { ["end"] = { character = 6, line = 12 }, start = { character = 5, line = 12 } } } }}
[DEBUG][2024-02-29 19:47:40] .../vim/lsp/rpc.lua:387 "rpc.receive" { jsonrpc = "2.0", method = "textDocument/publishDiagnostics", params = { diagnostics = {}, uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" }}
[DEBUG][2024-02-29 19:47:41] .../lua/vim/lsp.lua:1391 "LSP[astro]" "client.request" 2 "textDocument/documentHighlight" { position = { character = 2, line = 12 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" }} <function 1> 19
[DEBUG][2024-02-29 19:47:41] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 15, jsonrpc = "2.0", method = "textDocument/documentHighlight", params = { position = { character = 2, line = 12 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" } }}
[DEBUG][2024-02-29 19:47:41] .../lua/vim/lsp.lua:1391 "LSP[astro]" "client.request" 2 "textDocument/formatting" { options = { insertSpaces = true, tabSize = 2 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" }} <function 1> 19
[DEBUG][2024-02-29 19:47:41] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 16, jsonrpc = "2.0", method = "textDocument/formatting", params = { options = { insertSpaces = true, tabSize = 2 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" } }}
[DEBUG][2024-02-29 19:47:41] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 15, jsonrpc = "2.0", result = { { kind = 2, range = { ["end"] = { character = 2, line = 12 }, start = { character = 1, line = 12 } } }, { kind = 2, range = { ["end"] = { character = 6, line = 12 }, start = { character = 5, line = 12 } } }, { kind = 2, range = { ["end"] = { character = 2, line = 12 }, start = { character = 1, line = 12 } } }, { kind = 2, range = { ["end"] = { character = 6, line = 12 }, start = { character = 5, line = 12 } } } }}
[DEBUG][2024-02-29 19:47:41] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 7, jsonrpc = "2.0", method = "workspace/configuration", params = { items = { { section = "volar.format.initialIndent" } } }}
[DEBUG][2024-02-29 19:47:41] .../vim/lsp/rpc.lua:403 "server_request: callback result" { result = { vim.NIL }, status = true}
[DEBUG][2024-02-29 19:47:41] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 7, jsonrpc = "2.0", result = { vim.NIL }}
[DEBUG][2024-02-29 19:47:41] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 8, jsonrpc = "2.0", method = "workspace/configuration", params = { items = { { scopeUri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5Bid%5D.astro", section = "prettier" } } }}
[DEBUG][2024-02-29 19:47:41] .../vim/lsp/rpc.lua:403 "server_request: callback result" { result = { vim.NIL }, status = true}
[DEBUG][2024-02-29 19:47:41] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 8, jsonrpc = "2.0", result = { vim.NIL }}
[DEBUG][2024-02-29 19:47:42] .../vim/lsp/rpc.lua:284 "rpc.send" { jsonrpc = "2.0", method = "$/cancelRequest", params = { id = 16 }}
[DEBUG][2024-02-29 19:47:42] .../vim/lsp/rpc.lua:284 "rpc.send" { jsonrpc = "2.0", method = "textDocument/didSave", params = { textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" } }}
[DEBUG][2024-02-29 19:47:42] .../vim/lsp/rpc.lua:284 "rpc.send" { jsonrpc = "2.0", method = "textDocument/didSave", params = { textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" } }}
[DEBUG][2024-02-29 19:47:42] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 16, jsonrpc = "2.0"}
[DEBUG][2024-02-29 19:47:45] .../lua/vim/lsp.lua:1391 "LSP[astro]" "client.request" 2 "textDocument/documentHighlight" { position = { character = 6, line = 12 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" }} <function 1> 19
[DEBUG][2024-02-29 19:47:45] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 17, jsonrpc = "2.0", method = "textDocument/documentHighlight", params = { position = { character = 6, line = 12 }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro" } }}
[DEBUG][2024-02-29 19:47:45] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 17, jsonrpc = "2.0", result = { { kind = 2, range = { ["end"] = { character = 2, line = 12 }, start = { character = 1, line = 12 } } }, { kind = 2, range = { ["end"] = { character = 6, line = 12 }, start = { character = 5, line = 12 } } }, { kind = 2, range = { ["end"] = { character = 2, line = 12 }, start = { character = 1, line = 12 } } }, { kind = 2, range = { ["end"] = { character = 6, line = 12 }, start = { character = 5, line = 12 } } } }}
Here is a bunch, just from multiple times of me saving (using version 2.6.3)
screenrecord.mp4 Here is a small video of the issue in action, this is purely for reference.
Running hyprland ?
screenrecord.mp4 Here is a small video of the issue in action, this is purely for reference.
Running hyprland ?
Off topic but yes.
unfortunately I am very new to programming in general and not good at debugging. The logs don't show anything useful for me( as in lsp.log is blank).
What I have found so far is that when inspecting the context object that's passed into volar stuff, the snapshot that ends up getting generated is a StringScriptSnapshot on dynamic routes.
In fact, any characters that would be url enocded anywhere in the file path will break it. so /[path]/test.astro will also not have any lsp.
My guess is that somewhere a URI.parse or URI.file is being used incorrectly or there is an assumption that a path either is or isn't encoded and that's causing a bad uri.
I really appreciate all the effort so we can struggle in agony in neovim instead of using vscode lol.
I don't know if the following can help but from my observation it seems that the problem only applies to diagnostics, completion and highlighting. The server is correctly running and code action and documentSymbol work fine, the diagnostics response is always an empty array for some reason and the response from completion request never comes back. And I doubt the problem is related to URI.
And I doubt the problem is related to URI.
It is definitely not the URI. As the URI is the exact same when I used v2.6.3.
While it might not be related to the URI shown in the logs, it might still be something related to path encoding. I investigated a little and couldn't quite find what just yet, though
[DEBUG][2024-02-29 18:53:52] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 58, jsonrpc = "2.0", result = { { newText = "---\nimport { getEvent } from '../../utils/directusClient'\nimport EventsBody from '../../components/Events/EventsBody.astro'\nconst { id } = Astro.params\n\nif (!id) throw new Error('Missing ID parameter')\n\nconst event = await getEvent(id)\n\nexport const prerender = false\n---\n\n<p></p>\n<div class=\"my-48 flex flex-col items-center justify-center space-y-6\">\n <EventsBody content={event.event_info} />\n</div>\n", range = { ["end"] = { character = 0, line = 15 }, start = { character = 0, line = 0 } } } }}
[DEBUG][2024-02-29 18:53:52] .../vim/lsp/rpc.lua:284 "rpc.send" { jsonrpc = "2.0", method = "textDocument/didChange", params = { contentChanges = { { text = "---\nimport { getEvent } from '../../utils/directusClient'\nimport EventsBody from '../../components/Events/EventsBody.astro'\nconst { id } = Astro.params\n\nif (!id) throw new Error('Missing ID parameter')\n\nconst event = await getEvent(id)\n\nexport const prerender = false\n---\n\n<p></p>\n<div class=\"my-48 flex flex-col items-center justify-center space-y-6\">\n <EventsBody content={event.event_info} />\n</div>\n</div>\n" } }, textDocument = { uri = "file:///mnt/data/Projects/bluemeow/website/src/pages/events/%5bid%5d.astro", version = 38 } }}
I noticed that the content these 2 logs provide are different, the last one has a added div
at the end, which is what I remember happened. But the first log message did not include it. I tried looking in the code, but it seems like there is some boilerplate I'd need to investigate on Volar's end.
EDIT (sorry for the messy \n
):
Here is how it looks in a better format
First log msg:
---\n
import { getEvent } from '../../utils/directusClient'\n
import EventsBody from '../../components/Events/EventsBody.astro'\n
const { id } = Astro.params\n\n
if (!id) throw new Error('Missing ID parameter')\n\n
const event = await getEvent(id)\n\n
export const prerender = false\n
---\n\n
<p></p>\n
<div class=\"my-48 flex flex-col items-center justify-center space-y-6\">
\n <EventsBody content={event.event_info} />\n
</div>\n
Second log msg:
---\n
import { getEvent } from '../../utils/directusClient'\n
import EventsBody from '../../components/Events/EventsBody.astro'\n
const { id } = Astro.params\n\n
if (!id) throw new Error('Missing ID parameter')\n\n
const event = await getEvent(id)\n\n
export const prerender = false\n
---\n\n
<p></p>\n
<div class=\"my-48 flex flex-col items-center justify-center space-y-6\">
\n <EventsBody content={event.event_info} />\n
</div>\n
</div>\n
Any update on this @stauersbol?
Any update on this @stauersbol?
Not anymore than what I gave, so you'd have to wait for @Princesseuh to have an update for you
Right on, @stauersbol.
@Princesseuh Let me know how I can help. Happy to provide logs, etc.
A little update!
I think I can find a way to debug the language server. Mason does all the things to setup the actual language server. I can change the local files and see how it behaves and possibly find the place where it fails.
I did some digging on the boilerplate that volar.js
uses to handle document changes textDocument/didChange
, I saw they had implemented a test-util for this, but they sadly don't ever use it.
EDIT:
I'll also try disabling any formatting (prettier in this case), and saving to see if that is one of the reasons for the appearance of multiple close tags
EDIT 2:
Looks like a possible solution was found in the comment below by Aaron.
@Princesseuh again, I'll mention that I really don't know what I'm doing but I believe I have a solution.
The issue seems to be in Volar. Is the next step bringing this up in volar?
There are some places in volar where we do a .get() on a key where the case was changed. Here you can see the encoding case has changed.
in @volar/language-server/lib/uri.js the fileNameToURI function I added a tolowercase in the return and we're now working in neovim. This was because in project/typescriptProject.js there is a context.documents.get() that was checking on a key that hadn't been lower cased yet for whatever reason.
function fileNameToUri(fileName) {
if (fileName.startsWith('/') && fileName.includes('@@')) {
const parts = fileName.slice(1).split('@@');
if (parts.length !== 3) {
throw new Error('Invalid file name');
}
return vscode_uri_1.URI.from({
scheme: parts[0],
authority: parts[1],
path: parts[2],
}).toString();
}
return vscode_uri_1.URI.file(fileName).toString().toLowerCase()
Here is where the key is checked. Because somewhere the encoding is lowercased this key is not found and no snapshot is returned. The no snapshot causes all sort of problems such as inability to save updated state, no completion etc.
So either we should just add the tolowercase in the filenametouri, or maybe figuring out why we are changing the case of the encoding.
Awesome work investigating this! I have brought it up internally in Volar and we'll attempt to get a fix out. I wonder why it works in VS Code then.
of course the more I test I realize that if you add the lowercase it disables lsp in other areas. : (
At least now we know that somewhere it's the changing of case in the encoding that's messing things up. I tried to figure out where but was having a hard time. I'm actually not sure why we lowercase at all in uriMap.js
Please try the last version!
Please try the last version!
Seems like it is still causing some issues on my end after updating.
https://github.com/withastro/language-tools/assets/9026132/219c5278-dafd-4282-a892-20cd2d861c2c
Video illustrates the latest update 2.9.0.
EDIT:
The observation from my side is that, the closing div
at the end duplicates everytime I save after importing something. But it still seems like there is something wrong with how it reads the snapshot and somehow loses track of the file state when you save and the snapshot it believes it has is some old state, that is somehow getting saved and doesn't ever change?
Arf that's annoying. This update fixed a similar issue for other editors and it of course still works as it always has in VS Code, so not sure.
We'll keep investigating. The fact that it's on save is weird, do you have a formatting on save or anything else going on?
Arf that's annoying. This update fixed a similar issue for other editors and it of course still works as it always has in VS Code, so not sure.
We'll keep investigating. The fact that it's on save is weird, do you have a formatting on save or anything else going on?
Yes, I do have prettier running, I can try and see if that is also causing some trouble. But it's funny that I get that function imported and then when I save it just removes it🤔
https://github.com/withastro/language-tools/assets/9026132/09fba3f7-b25e-419f-a14f-2a3f413bd3aa
Alright tried again and with formatting off and on, doesn't impact anything.
But as you can see in the video the file state is definitely not correct. The state will only ever update if I restart the LSP (there is alias commands for this, kind of like how CTRL+P does it in VSCode where you can reload window and restart some LSPs, here its just LspRestart
, but I don't run it).
The "No info" prompt is just when I press a keybind to see function signatures and types. It doesn't show up on those functions because the line they are at is not the same as when the old file state was, that is also why when you see the module file path to when I do that over the function name getArtGallery
.
The duplication of the closing tags seems to also be because of the state, but it is not present here for some reason.
https://github.com/withastro/language-tools/assets/9026132/180667c1-6886-4089-9d46-a743475e586c
Here is an example with me restarting the LSP with LspRestart
to get an updated state.
Sorry for the constant spam on this issue, but this looks like a state problem. The duplication stops as soon as I turned off the formatter. So it looks like the file state that is stored never gets updated, or whenever it sends the updated file state it refuses to update it internally(?).
Sadly I have no idea how volar works under the hood with this other than from the brief time I looked at it.
@stauersbol Can you reproduce the issue with minimal operations and share the LSP logs?
@stauersbol Can you reproduce the issue with minimal operations and share the LSP logs?
Yes I will give it a try.
https://gist.github.com/stauersbol/6db13542237c08563107b179f1f17497
Had to paste it to a gist as the logs hit the character support that github supports for comments. There was some more above this, but it was primarily start logs for tailwind and the astro lsp.
This above is a simple operation of adding a p
element and saving right after.
@stauersbol Can you reproduce the issue with minimal operations and share the LSP logs?
Hello @johnsoncodehk, I think it has to do with the conversion or normalization of case based on what system is detected. This is why it works in VS code but not other systems, at least mine, neovim on wsl.
in URI.file from vscode-uri the encoding is upper case while in our uriMap we lowercase.
in typescriptProject.js we fail to get the uri from the weakmap which is what I believe causes the issue.
getScriptSnapshot(fileName) {
askedFiles.pathSet(fileName, true);
//uri_1.fileNameToUri(fileName) outputs an upper cased encoding
//while server.documents will all be lowercased at some point.
//Only the encoding is lower cased.
const doc = server.documents.get((0, uri_1.fileNameToUri)(fileName));
if (doc) {
return doc.getSnapshot();
}
},
This is within the getScriptSnapshot()
@aaronjconway Is your file system case sensitive? You can add the following log to the code to check this.
getScriptSnapshot(fileName) {
+ console.warn(ts.sys.useCaseSensitiveFileNames);
askedFiles.pathSet(fileName, true);
const doc = server.documents.get(fileNameToUri(fileName));
if (doc) {
return doc.getSnapshot();
}
},
@aaronjconway Is your file system case sensitive? You can add the following log to the code to check this.
getScriptSnapshot(fileName) { + console.warn(ts.sys.useCaseSensitiveFileNames); askedFiles.pathSet(fileName, true); const doc = server.documents.get(fileNameToUri(fileName)); if (doc) { return doc.getSnapshot(); } },
I know this was not directed at me, but all Linux distributions are case sensitive. Even if it's in WSL it still runs Linux.
@johnsoncodehk it is case sensitive but it seems like we're only lowercasing the encoding. Everywhere I can find the uri's keep the filename case but lower the encoding case.
I can't find where we are lowering the encoding case.
in vscode-uri I just manually changed the encoding to the lower version and have full functionality.
I tried solving this problem via https://github.com/volarjs/volar.js/pull/181, please let me know if the problem is still there after updating.
Just released 2.10.0 of the language server with this update, let us know if that works!
Just released 2.10.0 of the language server with this update, let us know if that works!
I'll give it a try when I get home! Will update when I have tested.
Great news! It seems to be working now! I did a few changes in the files I've been using for testing and it seems to be working as expected as it did on v2.6.3
Awesome! I'll wait for a confirmation from @aaronjconway before closing, just in case.
@stauersbol @Princesseuh @johnsoncodehk thank you guys!
@Princesseuh @johnsoncodehk
Seems to be fully resolved for me!
Thanks guys.
Describe the Bug
Currently when using dynamic [anything].astro routes I am having issues in neovim. No issues on other .astro files.
I get minimal lsp support but html, css and most ts not working.
Some but not all diagnostics work.
Formatting is either non existent or sometimes breaks on save. If I delete a line and save, it adds the line back.
vscode has no issues.
Thank you!!
Steps to Reproduce
I have a minimal neovim config at https://github.com/aaronjconway/astro_config
Steps to reproduce