code_editor

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAliasedImport

func AddAliasedImport(code, alias, path string) string

AddAliasedImport adds a new aliased package import (e.g., alias "path/to/pkg").

func AddImport

func AddImport(code, path string) string

AddImport adds a new package import to Go source code using AST parsing. Falls back to regex-based approach if AST parsing fails.

func AddImportIfNotExist

func AddImportIfNotExist(code, path string) string

AddImportIfNotExist adds an import only if it doesn't already exist in the code.

func EditFile

func EditFile(filePath string, f func(content string) string) error

func GetFileContent

func GetFileContent(filePath string) (string, error)

func InsertAttribute

func InsertAttribute(code, methodName, newAttribute string) string

InsertAttribute inserts a new attribute into an already-called method. It handles both single-line and multi-line calls, deduplicating existing attributes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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