Documentation ¶
Index ¶
- type BaseFixing
- func (f *BaseFixing) Content() []byte
- func (f *BaseFixing) Finally() error
- func (f *BaseFixing) LineEnding() string
- func (f *BaseFixing) Lines() []string
- func (f *BaseFixing) Replace(t TextEdit)
- func (f *BaseFixing) ReplaceAll(proc func(lines []string) []string)
- func (f *BaseFixing) ReplaceContent(proc func(content []byte) []byte)
- func (f *BaseFixing) ReplaceText(line int, old, new string)
- func (f *BaseFixing) SearchAndReplace(startPos meta.Position, lex func(lex *lexer.Lexer) TextEdit) error
- type Fixer
- type Fixing
- type NopFixing
- func (f NopFixing) Finally() error
- func (f NopFixing) Lines() []string
- func (f NopFixing) ReplaceAll(proc func(lines []string) []string)
- func (f NopFixing) ReplaceContent(proc func(content []byte) []byte)
- func (f NopFixing) ReplaceText(line int, old, new string)
- func (f NopFixing) SearchAndReplace(startPos meta.Position, lex func(lexer *lexer.Lexer) TextEdit) error
- type TextEdit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseFixing ¶
type BaseFixing struct {
// contains filtered or unexported fields
}
BaseFixing implements Fixing.
func NewBaseFixing ¶ added in v0.40.0
func NewBaseFixing(protoFileName string) (*BaseFixing, error)
NewBaseFixing creates a BaseFixing.
func (*BaseFixing) Content ¶ added in v0.40.0
func (f *BaseFixing) Content() []byte
Content returns f.content.
func (*BaseFixing) Finally ¶
func (f *BaseFixing) Finally() error
Finally writes the fixed content to the file.
func (*BaseFixing) LineEnding ¶ added in v0.40.0
func (f *BaseFixing) LineEnding() string
LineEnding is a detected line ending.
func (*BaseFixing) Lines ¶ added in v0.36.0
func (f *BaseFixing) Lines() []string
Lines returns the line format of f.content.
func (*BaseFixing) Replace ¶ added in v0.40.0
func (f *BaseFixing) Replace(t TextEdit)
Replace records a textedit to replace the old with the next later.
func (*BaseFixing) ReplaceAll ¶ added in v0.36.0
func (f *BaseFixing) ReplaceAll(proc func(lines []string) []string)
ReplaceAll replaces the lines.
func (*BaseFixing) ReplaceContent ¶ added in v0.37.0
func (f *BaseFixing) ReplaceContent(proc func(content []byte) []byte)
ReplaceContent replaces entire content.
func (*BaseFixing) ReplaceText ¶
func (f *BaseFixing) ReplaceText(line int, old, new string)
ReplaceText replaces the text at the line.
func (*BaseFixing) SearchAndReplace ¶ added in v0.36.0
func (f *BaseFixing) SearchAndReplace(startPos meta.Position, lex func(lex *lexer.Lexer) TextEdit) error
SearchAndReplace locates text edits and replaces with them.
type Fixer ¶
type Fixer interface { // NOTE: This method is insufficient to process unexpected multi-line contents. ReplaceText(line int, old, new string) ReplaceAll(proc func(lines []string) []string) SearchAndReplace(startPos meta.Position, lex func(lex *lexer.Lexer) TextEdit) error ReplaceContent(proc func(content []byte) []byte) Lines() []string }
Fixer provides the ways to operate the proto content.
type NopFixing ¶
type NopFixing struct{}
NopFixing does nothing.
func (NopFixing) ReplaceAll ¶ added in v0.36.0
ReplaceAll noop
func (NopFixing) ReplaceContent ¶ added in v0.37.0
ReplaceContent noop.
func (NopFixing) ReplaceText ¶
ReplaceText noop
Click to show internal directories.
Click to hide internal directories.