-
Notifications
You must be signed in to change notification settings - Fork 0
Fix the lsp #8
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
Fix the lsp #8
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,4 @@ | ||||||||||||||||||||||
| return { | ||||||||||||||||||||||
| { "mason-org/mason.nvim", version = "^1.0.0" }, | ||||||||||||||||||||||
| { "mason-org/mason-lspconfig.nvim", version = "^1.0.0" }, | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
Comment on lines
+1
to
+4
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Document the purpose of this workaround. This file introduces a workaround but lacks documentation explaining:
Consider adding a comment block at the top of the file explaining the context. +-- TODO: This is a temporary workaround for [describe issue here]
+-- Can be removed when [describe condition here]
return {
{ "mason-org/mason.nvim", version = "^1.0.0" },
{ "mason-org/mason-lspconfig.nvim", version = "^1.0.0" },
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Verify the change from ctx.file to ctx.match.
The svelte server configuration now uses
ctx.matchinstead ofctx.file. Ensure this is the correct field for the file URI in the autocmd callback context.🏁 Script executed:
Length of output: 233
🌐 Web query:
💡 Result:
When working with Neovim's Lua API for creating autocommands, the callback function receives a context table with several important fields. The
ctx.fileandctx.matchproperties provide valuable information about the event that triggered the autocommand.Autocommand Callback Context
In Neovim's
nvim_create_autocmdAPI, the callback function receives a context table (often referred to asargsin examples) containing several properties:ctx.file represents the file name of the buffer in which the autocommand event was triggered[6]. This corresponds to what you would access with
<afile>in Vimscript autocommands. It provides the full path to the file that triggered the event.ctx.match contains the string that matched the pattern specified in your autocommand[6]. This corresponds to
<amatch>in Vimscript. The value ofctx.matchdepends on the specific event type:Example Usage
Here's how you might use these properties in practice:
The callback receives other useful properties as well:
ctx.buf: the buffer number where the event was triggered[6]ctx.data: a table with event-specific data that's passed for some events[6]This context information allows you to create highly customized autocommands that respond intelligently to different conditions and file types in your Neovim configuration.
Citations:
autocmdinstructions wbthomason/packer.nvim#1082Use
ctx.filefor the file URIThe
ctx.matchfield maps to<amatch>(the autocommand pattern), not the actual filename. To send the correct URI in your Svelte LSP notification, switch back toctx.file(<afile>).lua/ronb/plugins/lsp/lspconfig.luaLines: 98–100
Change:
end
🤖 Prompt for AI Agents