lsp

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildServerHandler

func BuildServerHandler(conn jsonrpc2.Conn, e *env.Env) jsonrpc2.Handler

func FormatHoverContent

func FormatHoverContent(header, body string) string

func GoToGnoFileName

func GoToGnoFileName(fname string) string

GoToGnoFileName return gno file name from generated go file If not a generated go file, return unchanged fname

func ListGnoFiles

func ListGnoFiles(path string) ([]string, error)

func ListGnoPackages

func ListGnoPackages(paths []string) ([]string, error)

func RunServer

func RunServer(ctx context.Context, env *env.Env) error

Types

type Cache

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

func NewCache

func NewCache() *Cache

type CompletionStore

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

func InitCompletionStore

func InitCompletionStore(dirs []string) *CompletionStore

type ErrorInfo

type ErrorInfo struct {
	FileName string
	Line     int
	Column   int
	Span     []int
	Msg      string
	Tool     string
}

type Field

type Field struct {
	Position token.Position
	Name     string
	Kind     string
}

type FileInfo

type FileInfo struct {
	Name string
	Body string
}

type Function

type Function struct {
	Position  token.Position
	FileURI   uri.URI
	Name      string
	Arguments []*Field
	Doc       string
	Signature string
	Kind      string
}

func (*Function) IsExported

func (f *Function) IsExported() bool

type GnoFile

type GnoFile struct {
	URI protocol.DocumentURI
	Src []byte
}

contains gno file.

func (*GnoFile) ParseGno

func (f *GnoFile) ParseGno(ctx context.Context) (*ParsedGnoFile, error)

func (*GnoFile) PositionToOffset

func (f *GnoFile) PositionToOffset(pos protocol.Position) int

func (*GnoFile) TokenAt

func (f *GnoFile) TokenAt(pos protocol.Position) (*HoveredToken, error)

type HoveredToken

type HoveredToken struct {
	Text  string
	Start int
	End   int
}

type Method

type Method struct {
	Position  token.Position
	FileURI   uri.URI
	Name      string
	Arguments []*Field
	Doc       string
	Signature string
	Kind      string
}

func (*Method) IsExported

func (f *Method) IsExported() bool

type Package

type Package struct {
	Name       string
	ImportPath string
	Symbols    []*Symbol

	Functions  []*Function
	Methods    cmap.ConcurrentMap[string, []*Method]
	Structures []*Structure

	TypeCheckResult *TypeCheckResult
}

func PackageFromDir

func PackageFromDir(path string, onlyExports bool) (*Package, error)

type PackageGetter

type PackageGetter interface {
	GetPackageInfo(path string) *PackageInfo
}

type PackageInfo

type PackageInfo struct {
	Dir, ImportPath string
	Files           []*FileInfo
}

func GetPackageInfo

func GetPackageInfo(path string) (*PackageInfo, error)

GetPackageInfo accepts path(abs) or importpath and returns PackageInfo if found. Note: it doesn't work for relative path

func (*PackageInfo) TypeCheck

func (pi *PackageInfo) TypeCheck(tc *TypeCheck) *TypeCheckResult

type ParsedGnoFile

type ParsedGnoFile struct {
	URI  protocol.DocumentURI
	File *ast.File
	Fset *token.FileSet

	Src []byte
}

contains parsed gno file.

type ParsedGnoMod

type ParsedGnoMod struct {
	URI  string
	File *modfile.File
}

contains parsed gno.mod file.

type Selection

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

A Selection represents the cursor position and surrounding identifier.

type Snapshot

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

func NewSnapshot

func NewSnapshot() *Snapshot

func (*Snapshot) Get

func (s *Snapshot) Get(filePath string) (*GnoFile, bool)

type Structure

type Structure struct {
	Position token.Position
	FileURI  uri.URI
	Name     string
	Fields   []*Field
	Doc      string
	String   string
}

type Symbol

type Symbol struct {
	Position  token.Position
	FileURI   uri.URI
	Name      string
	Doc       string
	Signature string
	Kind      string // should be enum
}

func (Symbol) String

func (s Symbol) String() string

type TypeCheck

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

func NewTypeCheck

func NewTypeCheck() (*TypeCheck, *error)

func (*TypeCheck) Import

func (tc *TypeCheck) Import(path string) (*types.Package, error)

func (*TypeCheck) ImportFrom

func (tc *TypeCheck) ImportFrom(path, _ string, _ types.ImportMode) (*types.Package, error)

ImportFrom returns the imported package for the given import path

type TypeCheckResult

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

func (*TypeCheckResult) Errors

func (tcr *TypeCheckResult) Errors() []ErrorInfo

Jump to

Keyboard shortcuts

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