lsp

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2025 License: AGPL-3.0 Imports: 23 Imported by: 0

README

LSP 测试

凹语言的 LSP 只支持根工作区有 wa.mod 的场景,目前还在开发的早期阶段。

Sublime Text 语法高亮

基于 Go语言配置 修改得到凹语言高亮配置文件 sublime/wa.sublime-syntax

选择 Preferences -> Browse Packages 菜单打开包文件所在目录,将 sublime/wa.sublime-syntax 文件复制到 User 子目录下。重启动 Sublime Text,打开*.wa后缀名的凹语言程序,查看高亮是否工作正常。

Sublime Text LSP 支持

  1. 安装 Sublime Text, 打开命令面板
  2. 安装 Package Control 包管理插件
  3. 通过包管理安装 LSP 包: Package Control: Install Package, 选择 LSP
  4. 通过包管理查看 LSP 包已经成功安装: Package Control: List Packages, 确认 LSP 在列表中
  5. 命令面板选择 LSP: Enable Language Server Globally 全局范围打开 LSP 插件
  6. 菜单: Preferences -> Package Settings -> LSP -> Settings, 添加配置(参考后面的例子)
  7. 菜单: Tools -> LSP -> Toggle Log Panel 打开 LSP 的日志面板
  8. 打开凹语言程序, 在 LSP 的日志面板可以看到服务启动的日志
  9. 右键上下文菜单: LSP -> Format File 格式化文件
  10. 其他 LSP 功能还在开发中...

Sublime Text 的 凹语言 LSP 配置:

{
  // General settings
  "show_diagnostics_panel_on_save": 0,

  // Language server configurations
  "clients": {
    "phpactor": {
      // enable this configuration
      "enabled": true,
      // the startup command -- what you would type in a terminal
      "command": ["wa", "lsp"],
      // the selector that selects which type of buffers this language server attaches to
      "selector": "source.wa"
    }
  }
}

VS Code 支持

TODO

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LSPServer

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

func NewLSPServer

func NewLSPServer(opt *Option) *LSPServer

func (*LSPServer) CodeAction added in v0.13.0

func (p *LSPServer) CodeAction(ctx context.Context, params *protocol.CodeActionParams) ([]protocol.CodeAction, error)

func (*LSPServer) CodeLens added in v0.13.0

func (p *LSPServer) CodeLens(ctx context.Context, params *protocol.CodeLensParams) ([]protocol.CodeLens, error)

func (*LSPServer) ColorPresentation added in v0.13.0

func (*LSPServer) Completion added in v0.13.0

func (*LSPServer) Declaration added in v0.13.0

func (*LSPServer) Definition added in v0.13.0

func (p *LSPServer) Definition(ctx context.Context, params *protocol.DefinitionParams) ([]protocol.Location, error)

func (*LSPServer) Diagnostic added in v0.13.0

func (s *LSPServer) Diagnostic(context.Context, *string) (*string, error)

func (*LSPServer) DiagnosticWorkspace added in v0.13.0

func (*LSPServer) DidChange added in v0.13.0

func (*LSPServer) DidChangeConfiguration added in v0.13.0

func (s *LSPServer) DidChangeConfiguration(ctx context.Context, params *protocol.DidChangeConfigurationParams) error

func (*LSPServer) DidChangeNotebookDocument added in v0.13.0

func (s *LSPServer) DidChangeNotebookDocument(context.Context, *protocol.DidChangeNotebookDocumentParams) error

func (*LSPServer) DidChangeWatchedFiles added in v0.13.0

func (s *LSPServer) DidChangeWatchedFiles(ctx context.Context, params *protocol.DidChangeWatchedFilesParams) error

func (*LSPServer) DidChangeWorkspaceFolders added in v0.13.0

func (s *LSPServer) DidChangeWorkspaceFolders(ctx context.Context, params *protocol.DidChangeWorkspaceFoldersParams) error

func (*LSPServer) DidClose added in v0.13.0

func (*LSPServer) DidCloseNotebookDocument added in v0.13.0

func (s *LSPServer) DidCloseNotebookDocument(context.Context, *protocol.DidCloseNotebookDocumentParams) error

func (*LSPServer) DidCreateFiles added in v0.13.0

func (*LSPServer) DidDeleteFiles added in v0.13.0

func (*LSPServer) DidOpen added in v0.13.0

func (*LSPServer) DidOpenNotebookDocument added in v0.13.0

func (s *LSPServer) DidOpenNotebookDocument(context.Context, *protocol.DidOpenNotebookDocumentParams) error

func (*LSPServer) DidRenameFiles added in v0.13.0

func (*LSPServer) DidSave added in v0.13.0

func (*LSPServer) DidSaveNotebookDocument added in v0.13.0

func (s *LSPServer) DidSaveNotebookDocument(context.Context, *protocol.DidSaveNotebookDocumentParams) error

func (*LSPServer) DocumentColor added in v0.13.0

func (*LSPServer) DocumentHighlight added in v0.13.0

func (p *LSPServer) DocumentHighlight(ctx context.Context, params *protocol.DocumentHighlightParams) ([]protocol.DocumentHighlight, error)
func (s *LSPServer) DocumentLink(ctx context.Context, params *protocol.DocumentLinkParams) (links []protocol.DocumentLink, err error)

func (*LSPServer) DocumentSymbol added in v0.13.0

func (s *LSPServer) DocumentSymbol(ctx context.Context, params *protocol.DocumentSymbolParams) ([]interface{}, error)

func (*LSPServer) ExecuteCommand added in v0.13.0

func (s *LSPServer) ExecuteCommand(context.Context, *protocol.ExecuteCommandParams) (interface{}, error)

func (*LSPServer) Exit added in v0.13.0

func (s *LSPServer) Exit(ctx context.Context) error

func (*LSPServer) FoldingRange added in v0.13.0

func (*LSPServer) Formatting added in v0.13.0

func (*LSPServer) Hover added in v0.13.0

func (p *LSPServer) Hover(ctx context.Context, params *protocol.HoverParams) (*protocol.Hover, error)

func (*LSPServer) Implementation added in v0.13.0

func (*LSPServer) IncomingCalls added in v0.13.0

func (*LSPServer) Initialize added in v0.13.0

func (*LSPServer) Initialized added in v0.13.0

func (s *LSPServer) Initialized(ctx context.Context, params *protocol.InitializedParams) error

func (*LSPServer) InlayHint added in v0.13.0

func (*LSPServer) InlineValue added in v0.13.0

func (*LSPServer) LinkedEditingRange added in v0.13.0

func (*LSPServer) Moniker added in v0.13.0

func (*LSPServer) OnTypeFormatting added in v0.13.0

func (*LSPServer) OutgoingCalls added in v0.13.0

func (*LSPServer) PrepareCallHierarchy added in v0.13.0

func (*LSPServer) PrepareRename added in v0.13.0

func (*LSPServer) PrepareTypeHierarchy added in v0.13.0

func (*LSPServer) Progress added in v0.13.0

func (*LSPServer) RangeFormatting added in v0.13.0

func (*LSPServer) RangesFormatting added in v0.13.0

func (*LSPServer) References added in v0.13.0

func (p *LSPServer) References(ctx context.Context, params *protocol.ReferenceParams) ([]protocol.Location, error)

func (*LSPServer) Rename added in v0.13.0

func (*LSPServer) Resolve added in v0.13.0

func (*LSPServer) ResolveCodeAction added in v0.13.0

func (s *LSPServer) ResolveCodeAction(context.Context, *protocol.CodeAction) (*protocol.CodeAction, error)

func (*LSPServer) ResolveCodeLens added in v0.13.0

func (s *LSPServer) ResolveCodeLens(context.Context, *protocol.CodeLens) (*protocol.CodeLens, error)

func (*LSPServer) ResolveCompletionItem added in v0.13.0

func (s *LSPServer) ResolveCompletionItem(context.Context, *protocol.CompletionItem) (*protocol.CompletionItem, error)
func (s *LSPServer) ResolveDocumentLink(context.Context, *protocol.DocumentLink) (*protocol.DocumentLink, error)

func (*LSPServer) ResolveWorkspaceSymbol added in v0.13.0

func (*LSPServer) Run added in v0.7.0

func (p *LSPServer) Run() error

func (*LSPServer) SelectionRange added in v0.13.0

func (*LSPServer) SemanticTokensFull added in v0.13.0

func (*LSPServer) SemanticTokensFullDelta added in v0.13.0

func (s *LSPServer) SemanticTokensFullDelta(context.Context, *protocol.SemanticTokensDeltaParams) (interface{}, error)

func (*LSPServer) SemanticTokensRange added in v0.13.0

func (*LSPServer) SetTrace added in v0.13.0

func (*LSPServer) Shutdown added in v0.13.0

func (s *LSPServer) Shutdown(context.Context) error

func (*LSPServer) SignatureHelp added in v0.13.0

func (*LSPServer) Subtypes added in v0.13.0

func (*LSPServer) Supertypes added in v0.13.0

func (*LSPServer) Symbol added in v0.13.0

func (*LSPServer) TypeDefinition added in v0.13.0

func (*LSPServer) WillCreateFiles added in v0.13.0

func (*LSPServer) WillDeleteFiles added in v0.13.0

func (*LSPServer) WillRenameFiles added in v0.13.0

func (*LSPServer) WillSave added in v0.13.0

func (*LSPServer) WillSaveWaitUntil added in v0.13.0

func (*LSPServer) WorkDoneProgressCancel added in v0.13.0

func (s *LSPServer) WorkDoneProgressCancel(context.Context, *protocol.WorkDoneProgressCancelParams) error

type Option added in v0.7.0

type Option struct {
	LogFile     string
	SyncFileDir string // 文件快照目录
	WaOS        string // build 的目标系统
	WaRoot      string // 本地的 waroot 目录
}

type SyncFile added in v0.13.0

type SyncFile struct {
	RootDir string
}

func (*SyncFile) SaveFile added in v0.13.0

func (p *SyncFile) SaveFile(path string, text string)

type WaModule added in v0.13.0

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

一个模块类似一个工作区

func (*WaModule) LoadProgram added in v0.13.0

func (p *WaModule) LoadProgram() error

Directories

Path Synopsis
Package diff computes differences between text files or strings.
Package diff computes differences between text files or strings.
lcs
package lcs contains code to find longest-common-subsequences (and diffs)
package lcs contains code to find longest-common-subsequences (and diffs)
Package event provides a set of packages that cover the main concepts of telemetry in an implementation agnostic way.
Package event provides a set of packages that cover the main concepts of telemetry in an implementation agnostic way.
core
Package core provides support for event based telemetry.
Package core provides support for event based telemetry.
tag
Package tag provides the labels used for telemetry throughout gopls.
Package tag provides the labels used for telemetry throughout gopls.
The filecache package provides a file-based shared durable blob cache.
The filecache package provides a file-based shared durable blob cache.
Package jsonrpc2 is a minimal implementation of the JSON RPC 2 spec.
Package jsonrpc2 is a minimal implementation of the JSON RPC 2 spec.
Package protocol contains the structs that map directly to the request and response messages of the Language Server Protocol.
Package protocol contains the structs that map directly to the request and response messages of the Language Server Protocol.
Package span contains support for representing with positions and ranges in text files.
Package span contains support for representing with positions and ranges in text files.
util
lru
The lru package implements a fixed-size in-memory LRU cache.
The lru package implements a fixed-size in-memory LRU cache.
safetoken
Package safetoken provides wrappers around methods in go/token, that return errors rather than panicking.
Package safetoken provides wrappers around methods in go/token, that return errors rather than panicking.
Package xcontext is a package to offer the extra functionality we need from contexts that is not available from the standard context package.
Package xcontext is a package to offer the extra functionality we need from contexts that is not available from the standard context package.

Jump to

Keyboard shortcuts

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