lsp

package
v1.3.80 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hover

func Hover(ctx context.Context, workspace, path string, pos Position) (string, error)

func IsInstallable added in v1.3.76

func IsInstallable(languageID, workspace string) bool

IsInstallable returns true if the language has at least one install option whose command is a real install (not just an error message).

func ServerOverrides added in v1.3.76

func ServerOverrides() map[string]config.LSPServerConfig

ServerOverrides returns the currently configured server overrides.

func SetServerOverrides added in v1.3.76

func SetServerOverrides(overrides map[string]config.LSPServerConfig)

SetServerOverrides configures custom LSP server binary paths and arguments. Pass the config.LSPServers map (or nil to clear overrides).

Types

type CallHierarchyCall added in v1.1.45

type CallHierarchyCall struct {
	From       CallHierarchyItem
	To         CallHierarchyItem // only populated for outgoing calls
	FromRanges []Range
}

CallHierarchyCall represents a caller or callee in the call hierarchy.

func IncomingCalls added in v1.1.45

func IncomingCalls(ctx context.Context, workspace string, item CallHierarchyItem) ([]CallHierarchyCall, error)

IncomingCalls returns callers of the given call hierarchy item. Uses item.Path to re-acquire the LSP session for the file's language.

func OutgoingCalls added in v1.1.45

func OutgoingCalls(ctx context.Context, workspace string, item CallHierarchyItem) ([]CallHierarchyCall, error)

OutgoingCalls returns callees of the given call hierarchy item.

type CallHierarchyItem added in v1.1.45

type CallHierarchyItem struct {
	Name   string
	Kind   int
	Detail string
	Path   string
	Range  Range
	// contains filtered or unexported fields
}

CallHierarchyItem represents a call hierarchy item returned by the LSP server.

func PrepareCallHierarchy added in v1.1.45

func PrepareCallHierarchy(ctx context.Context, workspace, path string, pos Position) ([]CallHierarchyItem, error)

PrepareCallHierarchy prepares call hierarchy items for the symbol at pos.

type CodeAction

type CodeAction struct {
	Title   string
	Kind    string
	Command string
	Edits   []FileEdit
}

func CodeActions

func CodeActions(ctx context.Context, workspace, path string, rng Range) ([]CodeAction, error)

type Diagnostic

type Diagnostic struct {
	Severity int
	Message  string
	Range    Range
	Source   string
}

func Diagnostics

func Diagnostics(ctx context.Context, workspace, path string) ([]Diagnostic, error)

type FileEdit

type FileEdit struct {
	Path  string
	Edits []TextEdit
}

func RenameEdits

func RenameEdits(ctx context.Context, workspace, path string, pos Position, newName string) ([]FileEdit, error)

type InstallOption added in v1.1.26

type InstallOption struct {
	ID          string
	Label       string
	Binary      string
	Command     string
	Recommended bool
	Scope       InstallScope
}

func GetInstallOptions added in v1.3.76

func GetInstallOptions(languageID, workspace string) []InstallOption

GetInstallOptions returns the available install options for a language ID. Returns nil if the language is not recognized or has no install path.

type InstallScope added in v1.3.76

type InstallScope string

InstallScope indicates the installation scope.

const (
	ScopeUser    InstallScope = "user"    // Installed to user's home directory
	ScopeGlobal  InstallScope = "global"  // System-wide installation
	ScopeProject InstallScope = "project" // Installed inside the project directory
)

type LanguageStatus

type LanguageStatus struct {
	ID             string
	DisplayName    string
	Available      bool
	Binary         string
	InstallHint    string
	InstallOptions []InstallOption
	Evidence       []string
}

type Location

type Location struct {
	Path  string
	Range Range
}

func Definition

func Definition(ctx context.Context, workspace, path string, pos Position) ([]Location, error)

func Implementation added in v1.1.45

func Implementation(ctx context.Context, workspace, path string, pos Position) ([]Location, error)

Implementation finds implementations of the symbol at pos using textDocument/implementation.

func References

func References(ctx context.Context, workspace, path string, pos Position) ([]Location, error)

type Position

type Position struct {
	Line      int
	Character int
}

type Range

type Range struct {
	Start Position
	End   Position
}

type ResolvedServer

type ResolvedServer struct {
	LanguageID  string
	DisplayName string
	Binary      string
	Args        []string
	InstallHint string
}

func ResolveServerForFile

func ResolveServerForFile(workspace, path string) (ResolvedServer, bool)

func ResolveServerForWorkspace

func ResolveServerForWorkspace(workspace string) (ResolvedServer, bool)

type Symbol

type Symbol struct {
	Name string
	Kind int
	Range
}

func DocumentSymbols

func DocumentSymbols(ctx context.Context, workspace, path string) ([]Symbol, error)

type TextEdit

type TextEdit struct {
	Range   Range
	NewText string
}

type WorkspaceStatus

type WorkspaceStatus struct {
	Workspace string
	Languages []LanguageStatus
}

func DetectWorkspaceStatus

func DetectWorkspaceStatus(workspace string) WorkspaceStatus

type WorkspaceSymbol

type WorkspaceSymbol struct {
	Name string
	Kind int
	Path string
	Range
}

func WorkspaceSymbols

func WorkspaceSymbols(ctx context.Context, workspace, query string) ([]WorkspaceSymbol, error)

Jump to

Keyboard shortcuts

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