tools

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2025 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyTextEdits

func ApplyTextEdits(ctx context.Context, client *lsp.Client, filePath string, edits []TextEdit) (string, error)

func ExecuteCodeLens added in v0.0.2

func ExecuteCodeLens(ctx context.Context, client *lsp.Client, filePath string, index int) (string, error)

ExecuteCodeLens executes a specific code lens command from a file.

func ExtractTextFromLocation

func ExtractTextFromLocation(loc protocol.Location) (string, error)

func FindReferences

func FindReferences(ctx context.Context, client *lsp.Client, symbolName string) (string, error)

func FormatLinesWithRanges added in v0.0.6

func FormatLinesWithRanges(lines []string, ranges []LineRange) string

FormatLinesWithRanges formats file content using line ranges

func GetCodeLens added in v0.0.2

func GetCodeLens(ctx context.Context, client *lsp.Client, filePath string) (string, error)

GetCodeLens retrieves code lens hints for a given file location

func GetDiagnosticsForFile

func GetDiagnosticsForFile(ctx context.Context, client *lsp.Client, filePath string, contextLines int, showLineNumbers bool) (string, error)

GetDiagnosticsForFile retrieves diagnostics for a specific file from the language server

func GetFullDefinition

func GetFullDefinition(ctx context.Context, client *lsp.Client, startLocation protocol.Location) (string, protocol.Location, error)

Gets the full code block surrounding the start of the input location

func GetHoverInfo added in v0.0.5

func GetHoverInfo(ctx context.Context, client *lsp.Client, filePath string, line, column int) (string, error)

GetHoverInfo retrieves hover information (type, documentation) for a symbol at the specified position

func GetLineRangesToDisplay added in v0.0.6

func GetLineRangesToDisplay(ctx context.Context, client *lsp.Client, locations []protocol.Location, totalLines int, contextLines int) (map[int]bool, error)

GetLineRangesToDisplay determines which lines should be displayed for a set of locations

func ReadDefinition

func ReadDefinition(ctx context.Context, client *lsp.Client, symbolName string) (string, error)

func RenameSymbol added in v0.0.5

func RenameSymbol(ctx context.Context, client *lsp.Client, filePath string, line, column int, newName string) (string, error)

RenameSymbol renames a symbol (variable, function, class, etc.) at the specified position It uses the LSP rename functionality to handle all references across files

Types

type LineRange added in v0.0.6

type LineRange struct {
	Start int
	End   int
}

LineRange represents a continuous range of lines to display

func ConvertLinesToRanges added in v0.0.6

func ConvertLinesToRanges(linesToShow map[int]bool, totalLines int) []LineRange

ConvertLinesToRanges converts a set of lines to continuous ranges

type TextEdit

type TextEdit struct {
	StartLine int    `json:"startLine" jsonschema:"required,description=Start line to replace, inclusive"`
	EndLine   int    `json:"endLine" jsonschema:"required,description=End line to replace, inclusive"`
	NewText   string `json:"newText" jsonschema:"description=Replacement text. Replace with the new text. Leave blank to remove lines."`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL