loaderx

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	WaOS   string
	WaRoot string
	// contains filtered or unexported fields
}

type DocumentURI

type DocumentURI = protocol.DocumentURI

type File

type File struct {
	Version int32       // 版本号
	FileUri DocumentURI // 资源路径
	PkgPath string      // 属于的包路径

	Data    []byte      // file content
	Mode    fs.FileMode // FileInfo.Mode
	ModTime time.Time   // FileInfo.ModTime
	Sys     interface{} // FileInfo.Sys

	Parsed       bool
	ParsedResult *ast.Node
	ParsedErr    error

	Saved bool
}

文件 可包含当前未保存的编辑内容, 有版本号信息 文件发生变化时重建对应的包和被依赖的包 需要定期检查文件是否被外部修改

type Package

type Package struct {
	Version   int32    // 版本号
	UriPath   URI      // 目录的路径
	PkgPath   string   // 属于的包路径
	FileNames []string // 文件名列表

	Pkg   *types.Package // 类型检查后的包
	Info  *types.Info    // 具名对象信息
	Files []*ast.File    // 语法树
}

包信息

type PkgpathURI

type PkgpathURI string // import "pkgpath"

type URI

type URI = protocol.URI

type Universe

type Universe struct {
	Version         int32  // 版本号
	WaOS            string // 系统
	WaRoot          string // 模块根目录
	WorkspaceFolder []URI  // 工作区目录

	Fset  *token.FileSet          //
	Files map[DocumentURI]*File   // 工作区文件信息(可能包含被修改的 Std 文件)
	Pkgs  map[PkgpathURI]*Package // 全部包信息(包含 Std)
	// contains filtered or unexported fields
}

模块 每个Wa代码只能属于一个模块 该模块只能依赖 Std, 不会再对其他代码产生依赖

func NewUniverse

func NewUniverse(cfg Config) *Universe

func (*Universe) DidChange

func (*Universe) DidChangeConfiguration

func (p *Universe) DidChangeConfiguration(ctx context.Context, params *protocol.DidChangeConfigurationParams) error

配置发生变化

func (*Universe) DidChangeWatchedFiles

func (p *Universe) DidChangeWatchedFiles(ctx context.Context, params *protocol.DidChangeWatchedFilesParams) error

监视的文件列表发生变化

func (*Universe) DidChangeWorkspaceFolders

func (p *Universe) DidChangeWorkspaceFolders(ctx context.Context, params *protocol.DidChangeWorkspaceFoldersParams) error

工作区发生变化

func (*Universe) DidClose

func (*Universe) DidCreateFiles

func (p *Universe) DidCreateFiles(ctx context.Context, params *protocol.CreateFilesParams) error

创建文件

func (*Universe) DidDeleteFiles

func (p *Universe) DidDeleteFiles(ctx context.Context, params *protocol.DeleteFilesParams) error

删除文件

func (*Universe) DidOpen

func (*Universe) DidRenameFiles

func (p *Universe) DidRenameFiles(ctx context.Context, params *protocol.RenameFilesParams) error

重新命名文件

func (*Universe) DidSave

func (*Universe) VFS

func (p *Universe) VFS() fs.FS

Jump to

Keyboard shortcuts

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