Skip to content

Latest commit

 

History

History
196 lines (130 loc) · 4.61 KB

README.md

File metadata and controls

196 lines (130 loc) · 4.61 KB

LLuMinate

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.

Features

  • Automatically enrich copied code with additional context
  • Provide definitions and hover information for symbols
  • Configurable options to include/exclude specific information types
  • Intelligent filtering of common keywords and types to reduce clutter
  • Works seamlessly with Neovim's built-in LSP

asciicast

Installation

Add the following line to your Neovim configuration:

use {
  'k2589/LLuMinate.nvim',
  config = function()
    require('lluminate').setup()
  end
}

Using lazy.nvim

Add the following to your Neovim configuration:

{
  'k2589/LLuMinate.nvim',
  config = function()
    require('lluminate').setup()
  end
},

Configuration

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)
})

Default keymaps

    normal_mode = '<leader>lm',
    visual_mode = '<leader>lm'

Command

:EnrichContext

Usage

Once installed and configured, LLuMinator will automatically enrich the context of code you copy. Here's how to use it:

  1. Select the code you want to copy in visual mode.
  2. Use hotkey or command to yank selected (or last selected in normal mode) code
  3. LLuMinator will automatically process the copied code and add enriched context.
  4. Paste the enriched code wherever you need it (for example to your loved LLM Chat, I use Cloude btw)

Example

Original code:

	someVar := somepackage.SomeFunc(someStructVar.A, someStructVar.B)
	if someVar != nil {
		log.Panic(someVar)
	}

Enriched context:

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")

somepackage on pkg.go.dev

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.

nil on pkg.go.dev

Hover of log:

package log

log on pkg.go.dev

Hover of Panic:

func log.Panic(v ...any)

Panic is equivalent to [Print] followed by a call to panic().

log.Panic on pkg.go.dev

Customization

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.

Troubleshooting

If you encounter any issues:

  1. Ensure your Neovim version is up to date.
  2. Check that you have the necessary LSP servers installed and configured.
  3. Verify that the plugin is properly installed and loaded.

If problems persist, please open an issue on the GitHub repository.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.