Documentation ¶
Index ¶
- func NewPosition(line, column int) *position
- func NewRange(p1, p2 PositionIf) *codeRange
- type MemEditor
- func (ve *MemEditor) CodeLength() int
- func (ve *MemEditor) CompareRangeWithString(start, end int, compareTo string) (bool, error)
- func (ve *MemEditor) ExpandWordTextOffset(startOffset, endOffset int) (int, int)
- func (ve *MemEditor) ExpandWordTextRange(i RangeIf) RangeIf
- func (ve *MemEditor) FindRegexpRange(patternStr string, callback func(RangeIf) error) error
- func (ve *MemEditor) FindStringRange(feature string, callback func(RangeIf) error) error
- func (ve *MemEditor) FindStringRangeIndexFirst(startIndex int, feature string, callback func(RangeIf)) (end int, ok bool)
- func (ve *MemEditor) GetContextAroundRange(startPos, endPos PositionIf, n int, prefix ...func(i int) string) (string, error)
- func (ve *MemEditor) GetContextAroundRangeEx(startPos, endPos PositionIf, n int, prefix func(i int) string, ...) (string, error)
- func (ve *MemEditor) GetCurrentLine() (string, error)
- func (ve *MemEditor) GetEndOffsetByLine(x int) (int, error)
- func (ve *MemEditor) GetFilename() string
- func (ve *MemEditor) GetFormatedUrl() string
- func (ve *MemEditor) GetFullRange() RangeIf
- func (ve *MemEditor) GetLine(x int) (string, error)
- func (ve *MemEditor) GetMinAndMaxOffset(pos ...PositionIf) (int, int)
- func (ve *MemEditor) GetOffsetByPosition(p PositionIf) int
- func (ve *MemEditor) GetOffsetByPositionRaw(line, col int) int
- func (ve *MemEditor) GetOffsetByPositionWithError(line, col int) (int, error)
- func (ve *MemEditor) GetPositionByLine(line, column int) PositionIf
- func (ve *MemEditor) GetPositionByOffset(offset int) PositionIf
- func (ve *MemEditor) GetPositionByOffsetWithError(offset int) (PositionIf, error)
- func (ve *MemEditor) GetPureSourceHash() string
- func (ve *MemEditor) GetRangeByPosition(start, end PositionIf) RangeIf
- func (ve *MemEditor) GetRangeOffset(start, end int) RangeIf
- func (ve *MemEditor) GetSourceCode() string
- func (ve *MemEditor) GetStartOffsetByLine(x int) (int, error)
- func (e *MemEditor) GetTextContextWithPrompt(p RangeIf, n int, msg ...string) string
- func (ve *MemEditor) GetTextFromOffset(offset1, offset2 int) string
- func (ve *MemEditor) GetTextFromPosition(p1, p2 PositionIf) string
- func (ve *MemEditor) GetTextFromPositionInt(startLine, startCol, endLine, endCol int) string
- func (ve *MemEditor) GetTextFromRange(i RangeIf) string
- func (ve *MemEditor) GetTextFromRangeContext(i RangeIf, lineNum int) string
- func (ve *MemEditor) GetTextFromRangeWithError(r RangeIf) (string, error)
- func (ve *MemEditor) GetWordTextFromOffset(start, end int) string
- func (ve *MemEditor) GetWordTextFromRange(i RangeIf) string
- func (ve *MemEditor) IsOffsetValid(offset int) bool
- func (ve *MemEditor) IsValidPosition(line, col int) bool
- func (ve *MemEditor) MoveCursor(position int) error
- func (ve *MemEditor) PushSourceCodeContext(i any)
- func (ve *MemEditor) ResetSourceCodeHash()
- func (ve *MemEditor) Select(start, end int) (string, error)
- func (ve *MemEditor) SetUrl(url string)
- func (ve *MemEditor) SourceCodeMd5() string
- func (ve *MemEditor) SourceCodeSha1() string
- func (ve *MemEditor) SourceCodeSha256() string
- func (ve *MemEditor) UpdateTextByRange(r RangeIf, newText string) error
- type PositionIf
- type RangeIf
- type SafeString
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPosition ¶
func NewPosition(line, column int) *position
func NewRange ¶
func NewRange(p1, p2 PositionIf) *codeRange
Types ¶
type MemEditor ¶
type MemEditor struct {
// contains filtered or unexported fields
}
func NewMemEditor ¶
func (*MemEditor) CodeLength ¶
func (*MemEditor) CompareRangeWithString ¶
比较指定范围的文本是否与给定字符串相同
func (*MemEditor) ExpandWordTextOffset ¶
func (*MemEditor) ExpandWordTextRange ¶
func (*MemEditor) FindRegexpRange ¶
func (*MemEditor) FindStringRange ¶
func (*MemEditor) FindStringRangeIndexFirst ¶
func (*MemEditor) GetContextAroundRange ¶
func (*MemEditor) GetContextAroundRangeEx ¶
func (*MemEditor) GetCurrentLine ¶
GetCurrentLine 返回当前光标所在行的内容
func (*MemEditor) GetFilename ¶
func (*MemEditor) GetFormatedUrl ¶
func (*MemEditor) GetFullRange ¶
func (*MemEditor) GetMinAndMaxOffset ¶
func (ve *MemEditor) GetMinAndMaxOffset(pos ...PositionIf) (int, int)
func (*MemEditor) GetOffsetByPosition ¶
func (ve *MemEditor) GetOffsetByPosition(p PositionIf) int
func (*MemEditor) GetOffsetByPositionRaw ¶
func (*MemEditor) GetOffsetByPositionWithError ¶
func (*MemEditor) GetPositionByLine ¶
func (ve *MemEditor) GetPositionByLine(line, column int) PositionIf
func (*MemEditor) GetPositionByOffset ¶
func (ve *MemEditor) GetPositionByOffset(offset int) PositionIf
func (*MemEditor) GetPositionByOffsetWithError ¶
func (ve *MemEditor) GetPositionByOffsetWithError(offset int) (PositionIf, error)
func (*MemEditor) GetPureSourceHash ¶
func (*MemEditor) GetRangeByPosition ¶
func (ve *MemEditor) GetRangeByPosition(start, end PositionIf) RangeIf
func (*MemEditor) GetRangeOffset ¶
func (*MemEditor) GetSourceCode ¶
func (*MemEditor) GetStartOffsetByLine ¶
func (*MemEditor) GetTextContextWithPrompt ¶
func (*MemEditor) GetTextFromOffset ¶
func (*MemEditor) GetTextFromPosition ¶
func (ve *MemEditor) GetTextFromPosition(p1, p2 PositionIf) string
func (*MemEditor) GetTextFromPositionInt ¶
func (*MemEditor) GetTextFromRange ¶
func (*MemEditor) GetTextFromRangeContext ¶
func (*MemEditor) GetTextFromRangeWithError ¶
GetTextFromRangeWithError 根据Range获取文本,优先使用Offset,其次使用Line和Column
func (*MemEditor) GetWordTextFromOffset ¶
func (*MemEditor) GetWordTextFromRange ¶
func (*MemEditor) IsOffsetValid ¶
func (*MemEditor) IsValidPosition ¶
func (*MemEditor) MoveCursor ¶
MoveCursor 移动模拟光标位置
func (*MemEditor) PushSourceCodeContext ¶
func (*MemEditor) ResetSourceCodeHash ¶
func (ve *MemEditor) ResetSourceCodeHash()
func (*MemEditor) SourceCodeMd5 ¶
func (*MemEditor) SourceCodeSha1 ¶
func (*MemEditor) SourceCodeSha256 ¶
type PositionIf ¶
type RangeIf ¶
type RangeIf interface { // position GetStart() PositionIf GetStartOffset() int GetEnd() PositionIf GetEndOffset() int // editor GetEditor() *MemEditor // text GetText() string GetWordText() string GetTextContext(int) string GetTextContextWithPrompt(n int, msg ...string) string Len() int // extern Add(end RangeIf) // to string String() string }
type SafeString ¶
type SafeString struct {
// contains filtered or unexported fields
}
func NewSafeString ¶
func NewSafeString(i any) *SafeString
func (*SafeString) Len ¶
func (s *SafeString) Len() int
func (*SafeString) Slice1 ¶
func (s *SafeString) Slice1(idx int) rune
func (*SafeString) Slice2 ¶
func (s *SafeString) Slice2(start, end int) string
func (*SafeString) SliceBeforeStart ¶
func (s *SafeString) SliceBeforeStart(end int) string
func (*SafeString) SliceToEnd ¶
func (s *SafeString) SliceToEnd(start int) string
func (*SafeString) String ¶
func (s *SafeString) String() string
Click to show internal directories.
Click to hide internal directories.