workspace

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KindExtractVariable  = "refactor.extract.variable"
	KindExtractConstant  = "refactor.extract.constant"
	KindExtractElem      = "refactor.extract.elem"
	KindExtractToNewFile = "refactor.extract.toNewFile"
)

Variables

This section is empty.

Functions

func SyntaxReport added in v0.2.2

func SyntaxReport(source []byte) string

SyntaxReport parses source standalone and returns the same report as SyntaxErrorReport, for callers that do not hold a Doc.

Types

type ActionCreateFile added in v0.2.2

type ActionCreateFile struct {
	URI  string
	Text string
}

type ActionEdit added in v0.2.2

type ActionEdit struct {
	Range   common.Range
	NewText string
}

type CodeAction added in v0.2.2

type CodeAction struct {
	Title      string
	Kind       string
	URI        string
	Edits      []ActionEdit
	CreateFile *ActionCreateFile
}

type Completion

type Completion struct {
	Range common.Range
	Text  string
	Label string
	// contains filtered or unexported fields
}

func (Completion) Kind

func (c Completion) Kind() completion.Kind

type ConvMode

type ConvMode int
const (
	Strict ConvMode = iota
	Edge
	Approximate
)

type Doc

type Doc = *doc

func NewDoc

func NewDoc(file File) Doc

func (Doc) ApproximateTargetPos

func (d Doc) ApproximateTargetPos(enc common.Encoding, sourcePos common.Pos) (common.Pos, bool)

func (Doc) Assemble

func (d Doc) Assemble()

func (Doc) CheckTarget added in v0.0.41

func (d Doc) CheckTarget() (needsUpdate bool, err error)

func (Doc) Close added in v0.2.3

func (d Doc) Close()

func (Doc) Completions

func (d Doc) Completions(enc common.Encoding, pos common.Pos) (completions []Completion, complete bool)

func (Doc) Delete

func (d Doc) Delete()

func (Doc) Err

func (d Doc) Err() error

func (Doc) ExtractActions added in v0.2.2

func (d Doc) ExtractActions(enc common.Encoding, ran common.Range) []CodeAction

func (Doc) Format

func (d Doc) Format(enc common.Encoding) (Formatted, error)

func (Doc) GetDiag added in v0.1.20

func (d Doc) GetDiag() *ast.Node

func (Doc) GoxImportPos added in v0.1.13

func (d Doc) GoxImportPos(enc common.Encoding) (common.Pos, bool)

func (Doc) Hover

func (d Doc) Hover(enc common.Encoding, pos common.Pos) (message string, ran common.Range, ok bool)

func (Doc) Init

func (d Doc) Init()

func (Doc) Load

func (d Doc) Load() error

func (Doc) Name

func (d Doc) Name() string

func (Doc) Parse

func (d Doc) Parse() error

func (Doc) PrintTarget

func (d Doc) PrintTarget()

func (Doc) Save

func (d Doc) Save() error

func (Doc) SourceClose

func (d Doc) SourceClose()

func (Doc) SourceFile

func (d Doc) SourceFile() File

func (Doc) SourceIsOpened

func (d Doc) SourceIsOpened() bool

func (Doc) SourceOpen

func (d Doc) SourceOpen(version int32)

func (Doc) SourcePatch

func (d Doc) SourcePatch(enc common.Encoding, ran common.Range, content string) (bool, error)

func (Doc) SourcePos

func (d Doc) SourcePos(enc common.Encoding, targetPos common.Pos, mode ConvMode) (common.Pos, bool)

func (Doc) SourceRange

func (d Doc) SourceRange(enc common.Encoding, targetRange common.Range, mode ConvMode) (common.Range, bool)

func (Doc) SourceUpdate

func (d Doc) SourceUpdate(content string) (bool, error)

func (Doc) SpaceHints added in v0.2.3

func (d Doc) SpaceHints(enc common.Encoding) []SyntaxError

func (Doc) StoreDiag added in v0.1.20

func (d Doc) StoreDiag(a *ast.Node)

func (Doc) Symbols

func (d Doc) Symbols(enc common.Encoding) []Symbol

func (Doc) SyntaxErrorReport added in v0.2.2

func (d Doc) SyntaxErrorReport() string

SyntaxErrorReport formats the ERROR/MISSING nodes of the current tree as indented "line:col: message near \"...\"" lines (1-based), or "" when clean.

func (Doc) SyntaxErrors added in v0.2.2

func (d Doc) SyntaxErrors(enc common.Encoding) []SyntaxError

SyntaxErrors reports ERROR/MISSING nodes as LSP diagnostics, with ranges in the client encoding.

func (Doc) TargetClose

func (d Doc) TargetClose()

func (Doc) TargetContent

func (d Doc) TargetContent() string

func (Doc) TargetFile

func (d Doc) TargetFile() File

func (Doc) TargetIsOpened

func (d Doc) TargetIsOpened() bool

func (Doc) TargetOpen

func (d Doc) TargetOpen(version int32)

func (Doc) TargetPos

func (d Doc) TargetPos(enc common.Encoding, sourcePos common.Pos, mode ConvMode) (common.Pos, bool)

func (Doc) TargetRange

func (d Doc) TargetRange(enc common.Encoding, sourceRange common.Range, mode ConvMode) (common.Range, bool)

func (Doc) TargetWrite

func (d Doc) TargetWrite() error

type File

type File struct {
	// contains filtered or unexported fields
}

func NewFile

func NewFile(path string) (File, bool)

func NewFileFromURI

func NewFileFromURI(uri string) (File, bool)

func (File) Dir

func (f File) Dir() string

func (File) Exists

func (f File) Exists() bool

func (File) IsValid

func (f File) IsValid() bool

func (File) Kind

func (f File) Kind() FileKind

func (File) Name

func (f File) Name() string

func (File) Path

func (f File) Path() string

func (File) Remove

func (f File) Remove() error

func (File) Reverse

func (f File) Reverse() File

func (File) URI

func (f File) URI() string

func (File) ValidateTarget added in v0.0.41

func (f File) ValidateTarget(b []byte) (needsUpdate bool, err error)

type FileKind

type FileKind string
const (
	KindSource  FileKind = ".gox"
	KindTarget  FileKind = ".x.go"
	KindUnknown FileKind = ""
)

func (FileKind) Belongs

func (f FileKind) Belongs(path string) bool

func (FileKind) Revert

func (f FileKind) Revert() FileKind

func (FileKind) String

func (f FileKind) String() string

type Formatted

type Formatted struct {
	Text  string
	Range common.Range
}

type Manager

type Manager = *manager

func NewManager

func NewManager() Manager

type Symbol

type Symbol struct {
	Kind    symbol.Kind
	Name    string
	Range   common.Range
	Symbols []Symbol
}

type SyntaxError added in v0.2.2

type SyntaxError struct {
	Range   common.Range
	Message string
}

Jump to

Keyboard shortcuts

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