LLuMinate is a Neovim plugin that enriches the context of copied code by providing additional information about symbols, such as their definitions and hover information from LSP. This plugin is particularly useful for developers who want to quickly understand and share code snippets with more context to pass it to LLM Chat for example.
Add the following line to your Neovim configuration:
use {
'k2589/LLuMinate.nvim',
config = function()
require('lluminate').setup()
end
}
Add the following to your Neovim configuration:
{
'k2589/LLuMinate.nvim',
config = function()
require('lluminate').setup()
end
},
LLuMinator comes with default settings, but you can customize its behavior. Here's an example of how to configure the plugin:
require('lluminate').setup({
include_definition = false, -- Include symbol definitions in the enriched context
include_hover = true, -- Include hover information in the enriched context
include_diagnostics = true,
diagnostic_levels = {
"Error",
"Warning",
"Information",
"Hint"
},
diagnostic_scope = "selection" -- Can be "selection" (full selection), "line" (first line of selection), or "file" (full file)
})
normal_mode = '<leader>lm',
visual_mode = '<leader>lm'
:EnrichContext
Once installed and configured, LLuMinator will automatically enrich the context of code you copy. Here's how to use it:
someVar := somepackage.SomeFunc(someStructVar.A, someStructVar.B)
if someVar != nil {
log.Panic(someVar)
}
someVar := somepackage.SomeFunc(someStructVar.A, someStructVar.B)
if someVar != nil {
log.Panic(someVar)
}
Additional Context:
Hover of someVar:
var someVar error
Hover of somepackage:
package somepackage ("go-example/somePackage")
Hover of SomeFunc:
func somepackage.SomeFunc(foo int, bar int) error
somepackage.SomeFunc
on pkg.go.dev
Hover of someStructVar:
var someStructVar SomeStruct
Hover of A:
field A int
(main.SomeStruct).A
on pkg.go.dev
Hover of B:
field B int
(main.SomeStruct).B
on pkg.go.dev
Hover of nil:
var nil Type // Type must be a pointer, channel, func, interface, map, or slice type
nil is a predeclared identifier representing the zero value for a pointer, channel, func, interface, map, or slice type.
Hover of log:
package log
Hover of Panic:
func log.Panic(v ...any)
Panic is equivalent to [Print] followed by a call to panic().
You can customize LLuMinator's behavior by modifying the should_process_symbol
function in the plugin's source code. This allows you to add or remove keywords and types that should be skipped during processing.
If you encounter any issues:
If problems persist, please open an issue on the GitHub repository.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.