Documentation
¶
Index ¶
- Constants
- func RunDriver(rootDir string, patterns []string) error
- type Diagnostic
- type DocumentSymbol
- type DriverError
- type DriverPackage
- type DriverRequest
- type DriverResponse
- type HandlerFunc
- type Hover
- type InitializeParams
- type InitializeResult
- type LSPLocation
- type MarkupContent
- type NotifyFunc
- type Position
- type PublishDiagnosticsParams
- type Range
- type RenameParams
- type Server
- type ServerCapabilities
- type ServerInfo
- type Service
- type SymbolInformation
- type TextDocumentIdentifier
- type TextDocumentItem
- type TextEdit
- type WorkspaceEdit
Constants ¶
View Source
const ( NeedName = 1 << 0 NeedFiles = 1 << 1 NeedCompiledGoFiles = 1 << 2 NeedImports = 1 << 3 NeedDeps = 1 << 4 NeedTypesSizes = 1 << 9 NeedModule = 1 << 13 )
gopackagesdriver LoadMode flags
View Source
const ( SKFile = 1 SKModule = 2 SKNamespace = 3 SKPackage = 4 SKClass = 5 SKMethod = 6 SKProperty = 7 SKField = 8 SKConstructor = 9 SKEnum = 10 SKInterface = 11 SKFunction = 12 SKVariable = 13 SKConstant = 14 SKString = 15 SKNumber = 16 SKBoolean = 17 SKArray = 18 SKStruct = 23 )
LSP Symbol kinds
View Source
const ( SyncNone = 0 SyncFull = 1 SyncIncremental = 2 )
TextDocumentSync kinds
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Diagnostic ¶
type DocumentSymbol ¶
type DocumentSymbol struct {
Name string `json:"name"`
Kind int `json:"kind"`
Range Range `json:"range"`
SelectionRange Range `json:"selectionRange"`
Children []DocumentSymbol `json:"children,omitempty"`
}
type DriverError ¶
type DriverPackage ¶
type DriverPackage struct {
ID string `json:"ID"`
Name string `json:"Name"`
PkgPath string `json:"PkgPath"`
GoFiles []string `json:"GoFiles,omitempty"`
CompiledGoFiles []string `json:"CompiledGoFiles,omitempty"`
Imports map[string]string `json:"Imports,omitempty"`
Errors []DriverError `json:"Errors,omitempty"`
}
type DriverRequest ¶
type DriverResponse ¶
type DriverResponse struct {
NotHandled bool `json:"NotHandled,omitempty"`
Compiler string `json:"Compiler,omitempty"`
Arch string `json:"Arch,omitempty"`
Roots []string `json:"Roots,omitempty"`
Packages []*DriverPackage `json:"Packages,omitempty"`
}
func HandleDriverRequest ¶
func HandleDriverRequest(rootDir string, req DriverRequest, patterns []string) (*DriverResponse, error)
HandleDriverRequest processes a gopackagesdriver request.
type HandlerFunc ¶
type HandlerFunc func(params json.RawMessage) (any, error)
HandlerFunc processes a JSON-RPC request and returns a result or error.
type Hover ¶
type Hover struct {
Contents MarkupContent `json:"contents"`
Range *Range `json:"range,omitempty"`
}
Hover response
type InitializeParams ¶
LSP types -- minimal set for initialize
type InitializeResult ¶
type InitializeResult struct {
Capabilities ServerCapabilities `json:"capabilities"`
ServerInfo *ServerInfo `json:"serverInfo,omitempty"`
}
type LSPLocation ¶
type MarkupContent ¶
type NotifyFunc ¶
type NotifyFunc func(params json.RawMessage)
NotifyFunc processes a JSON-RPC notification (no response expected).
type PublishDiagnosticsParams ¶
type PublishDiagnosticsParams struct {
URI string `json:"uri"`
Diagnostics []Diagnostic `json:"diagnostics"`
}
type RenameParams ¶
type RenameParams struct {
TextDocument TextDocumentIdentifier `json:"textDocument"`
Position Position `json:"position"`
NewName string `json:"newName"`
}
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements the JSON-RPC 2.0 transport for LSP.
func (*Server) Handle ¶
func (s *Server) Handle(method string, fn HandlerFunc)
func (*Server) OnNotify ¶
func (s *Server) OnNotify(method string, fn NotifyFunc)
type ServerCapabilities ¶
type ServerCapabilities struct {
TextDocumentSync int `json:"textDocumentSync,omitempty"`
DocumentSymbolProvider bool `json:"documentSymbolProvider,omitempty"`
WorkspaceSymbolProvider bool `json:"workspaceSymbolProvider,omitempty"`
DefinitionProvider bool `json:"definitionProvider,omitempty"`
ReferencesProvider bool `json:"referencesProvider,omitempty"`
HoverProvider bool `json:"hoverProvider,omitempty"`
CompletionProvider any `json:"completionProvider,omitempty"`
RenameProvider bool `json:"renameProvider,omitempty"`
DiagnosticProvider any `json:"diagnosticProvider,omitempty"`
}
type ServerInfo ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service holds workspace state and handles LSP requests.
func NewService ¶
func (*Service) StartSocket ¶
StartSocket starts the Unix socket server for CLI client queries. Call after handleInitialize sets rootPath.
type SymbolInformation ¶
type SymbolInformation struct {
Name string `json:"name"`
Kind int `json:"kind"`
Location LSPLocation `json:"location"`
}
type TextDocumentIdentifier ¶
type TextDocumentIdentifier struct {
URI string `json:"uri"`
}
Text document types
type TextDocumentItem ¶
type WorkspaceEdit ¶
Click to show internal directories.
Click to hide internal directories.