lsp

package
v0.0.0-...-46a75af Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: Apache-2.0 Imports: 93 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PragmaNoFormat   = "nofmt"
	PragmaNoGenerate = "nogen"
	PragmaDebug      = "debug"

	PragmaDebugWnoerror = "Wnoerror"
	WnoerrorAll         = "all"
)

Variables

View Source
var DebugCheckOverlappingTokens = (debugCheckOverlappingTokens == "true")
View Source
var ErrNoDescriptorFound = fmt.Errorf("failed to find descriptor")
View Source
var ErrNoModule = errors.New("no go module found")

Functions

func DecodeRawFileDescriptor

func DecodeRawFileDescriptor(data []byte) (*descriptorpb.FileDescriptorProto, error)

func DefaultEnclosingRangeVisitor

func DefaultEnclosingRangeVisitor(tracker *paths.AncestorTracker, paths *[]protopath.Values) func(ast.Node) bool

func FastLookupGoModule

func FastLookupGoModule(f io.Reader) (string, error)

func FindRefactorActions

func FindRefactorActions(ctx context.Context, request *protocol.CodeActionParams, linkRes linker.Result, mapper *protocol.Mapper, want map[protocol.CodeActionKind]bool) []protocol.CodeAction

func FindSuffixMatchedPath

func FindSuffixMatchedPath(target, source string) (string, bool)

func GoIdent

func GoIdent(desc protoreflect.Descriptor) string

func IsWellKnownPath

func IsWellKnownPath(path string) bool

func NewSelectRangeCommand

func NewSelectRangeCommand(params SelectRangeParams) *protocol.Command

func RefactorUndeclaredName

func RefactorUndeclaredName(ctx context.Context, cache *Cache, uri protocol.DocumentURI, name string, kind protocol.CodeActionKind) []protocol.CodeAction

Types

type Analyzer

type Analyzer func(ctx context.Context, request *protocol.CodeActionParams, linkRes linker.Result, mapper *protocol.Mapper, results chan<- protocol.CodeAction)

type Cache

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

Cache is responsible for keeping track of all the known proto source files and definitions.

func NewCache

func NewCache(workspace protocol.WorkspaceFolder, opts ...CacheOption) *Cache

func (*Cache) Compile

func (c *Cache) Compile(protos []string, after ...func())

func (*Cache) ComputeCodeLens

func (c *Cache) ComputeCodeLens(uri protocol.DocumentURI) ([]protocol.CodeLens, error)
func (c *Cache) ComputeDocumentLinks(doc protocol.TextDocumentIdentifier) ([]protocol.DocumentLink, error)

func (*Cache) ComputeHover

func (c *Cache) ComputeHover(params protocol.TextDocumentPositionParams) (*protocol.Hover, error)

func (*Cache) ComputeInlayHints

func (c *Cache) ComputeInlayHints(doc protocol.TextDocumentIdentifier, rng protocol.Range) ([]protocol.InlayHint, error)

func (*Cache) ComputeSemanticTokens

func (c *Cache) ComputeSemanticTokens(doc protocol.TextDocumentIdentifier) ([]uint32, error)

func (*Cache) ComputeSemanticTokensRange

func (c *Cache) ComputeSemanticTokensRange(doc protocol.TextDocumentIdentifier, rng protocol.Range) ([]uint32, error)

func (*Cache) DidModifyFiles

func (c *Cache) DidModifyFiles(ctx context.Context, modifications []file.Modification)

func (*Cache) DocumentSymbolsForFile

func (c *Cache) DocumentSymbolsForFile(uri protocol.DocumentURI) ([]protocol.DocumentSymbol, error)

func (*Cache) FindAllDescriptorsByPrefix

func (c *Cache) FindAllDescriptorsByPrefix(ctx context.Context, prefix string, filter ...func(protoreflect.Descriptor) bool) WorkspaceDescriptors

func (*Cache) FindAllDescriptorsByQualifiedPrefix

func (c *Cache) FindAllDescriptorsByQualifiedPrefix(ctx context.Context, prefix string, filter ...func(protoreflect.Descriptor) bool) WorkspaceDescriptors

Like FindAllDescriptorsByPrefix, but assumes a fully qualified prefix with package name.

func (*Cache) FindDefinitionForTypeDescriptor

func (c *Cache) FindDefinitionForTypeDescriptor(desc protoreflect.Descriptor) (protocol.Location, error)

func (*Cache) FindDescriptorByName

func (c *Cache) FindDescriptorByName(name protoreflect.FullName) (protoreflect.Descriptor, error)

FindDescriptorByName implements linker.Resolver.

func (*Cache) FindExtensionByName

func (c *Cache) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)

FindExtensionByName implements linker.Resolver.

func (*Cache) FindExtensionByNumber

func (c *Cache) FindExtensionByNumber(message protoreflect.FullName, field protowire.Number) (protoreflect.ExtensionType, error)

FindExtensionByNumber implements linker.Resolver.

func (*Cache) FindExtensionsByMessage

func (c *Cache) FindExtensionsByMessage(message protoreflect.FullName) []protoreflect.ExtensionDescriptor

FindExtensionByNumber implements linker.Resolver.

func (*Cache) FindFileByURI

func (c *Cache) FindFileByURI(uri protocol.DocumentURI) (protoreflect.FileDescriptor, error)

func (*Cache) FindGeneratedDefinition

func (c *Cache) FindGeneratedDefinition(ctx context.Context, params protocol.TextDocumentPositionParams) ([]protocol.Location, error)

func (*Cache) FindImportPathsByPrefix

func (c *Cache) FindImportPathsByPrefix(ctx context.Context, prefix string) map[protocol.DocumentURI]string

func (*Cache) FindMessageByName

func (c *Cache) FindMessageByName(name protoreflect.FullName) (protoreflect.MessageType, error)

FindMessageByName implements linker.Resolver.

func (*Cache) FindMessageByURL

func (c *Cache) FindMessageByURL(url string) (protoreflect.MessageType, error)

FindMessageByURL implements linker.Resolver.

func (*Cache) FindPackageNameRefs

func (c *Cache) FindPackageNameRefs(name protoreflect.FullName, prefixMatch bool) []protocol.Location

func (*Cache) FindParseResultByPath

func (c *Cache) FindParseResultByPath(path string) (parser.Result, error)

func (*Cache) FindParseResultByURI

func (c *Cache) FindParseResultByURI(uri protocol.DocumentURI) (parser.Result, error)

func (*Cache) FindPragmasByPath

func (c *Cache) FindPragmasByPath(path protocompile.ResolvedPath) (Pragmas, bool)

func (*Cache) FindReferenceLocationsForTypeDescriptor

func (c *Cache) FindReferenceLocationsForTypeDescriptor(desc protoreflect.Descriptor) ([]protocol.Location, error)

func (*Cache) FindReferences

func (*Cache) FindReferencesForTypeDescriptor

func (c *Cache) FindReferencesForTypeDescriptor(desc protoreflect.Descriptor) ([]ast.NodeReference, error)

func (*Cache) FindResultByPath

func (c *Cache) FindResultByPath(path string) (linker.Result, error)

func (*Cache) FindResultByURI

func (c *Cache) FindResultByURI(uri protocol.DocumentURI) (linker.Result, error)

func (*Cache) FindResultOrPartialResultByPath

func (c *Cache) FindResultOrPartialResultByPath(path string) (linker.Result, error)

func (*Cache) FindResultOrPartialResultByURI

func (c *Cache) FindResultOrPartialResultByURI(uri protocol.DocumentURI) (linker.Result, error)

func (*Cache) FindTypeDescriptorAtLocation

func (c *Cache) FindTypeDescriptorAtLocation(params protocol.TextDocumentPositionParams) (protoreflect.Descriptor, protocol.Range, error)

func (*Cache) FormatDocument

func (c *Cache) FormatDocument(doc protocol.TextDocumentIdentifier, options protocol.FormattingOptions, maybeRange ...protocol.Range) ([]protocol.TextEdit, error)

func (*Cache) GetCodeActions

func (c *Cache) GetCodeActions(ctx context.Context, params *protocol.CodeActionParams) ([]protocol.CodeAction, error)

func (*Cache) GetCompletions

func (c *Cache) GetCompletions(params *protocol.CompletionParams) (result *protocol.CompletionList, err error)

func (*Cache) GetMapper

func (r *Cache) GetMapper(uri protocol.DocumentURI) (*protocol.Mapper, error)

func (*Cache) GetSyntheticFileContents

func (c *Cache) GetSyntheticFileContents(ctx context.Context, uri protocol.DocumentURI) (string, error)

func (*Cache) LatestDocumentContentsWellFormed

func (c *Cache) LatestDocumentContentsWellFormed(uri protocol.DocumentURI, strict bool) (bool, error)

Checks if the most recently parsed version of the given document has any syntax errors, as reported by the diagnostic handler.

func (*Cache) LoadFiles

func (c *Cache) LoadFiles(files []string)

func (*Cache) QueryWorkspaceSymbols

func (c *Cache) QueryWorkspaceSymbols(ctx context.Context, query string) []protocol.SymbolInformation

func (*Cache) RangeAllDescriptors

func (c *Cache) RangeAllDescriptors(ctx context.Context, fn func(protoreflect.Descriptor) bool) error

RangeAllDescriptors calls fn for each descriptor in the cache, possibly in a separate goroutine for each file.

func (*Cache) Rename

func (c *Cache) Rename(params *protocol.RenameParams) (*protocol.WorkspaceEdit, error)

func (*Cache) StreamWorkspaceDiagnostics

func (c *Cache) StreamWorkspaceDiagnostics(ctx context.Context, ch chan<- protocol.WorkspaceFullDocumentDiagnosticReport)

func (*Cache) TracksURI

func (c *Cache) TracksURI(uri protocol.DocumentURI) bool

func (*Cache) TryFindPackageReferences

func (c *Cache) TryFindPackageReferences(params protocol.TextDocumentPositionParams) []protocol.Location

func (*Cache) WaitDocumentVersion

func (c *Cache) WaitDocumentVersion(ctx context.Context, uri protocol.DocumentURI, version int32) error

func (*Cache) XGetAllDiagnostics

func (c *Cache) XGetAllDiagnostics() (map[protocol.DocumentURI][]protocol.Diagnostic, error)

Intended for use with external tools only, not part of LSP implementation.

func (*Cache) XGetAllMessages

func (c *Cache) XGetAllMessages() []protoreflect.MessageDescriptor

func (*Cache) XGetLinkerResults

func (c *Cache) XGetLinkerResults() []linker.Result

Intended for use with external tools only, not part of LSP implementation.

func (*Cache) XGetMapper

func (c *Cache) XGetMapper(uri protocol.DocumentURI) (*protocol.Mapper, error)

func (*Cache) XGetResolver

func (c *Cache) XGetResolver() linker.Resolver

func (*Cache) XGetURIPathMappings

func (c *Cache) XGetURIPathMappings() PathMappings

func (*Cache) XListWorkspaceLocalURIs

func (c *Cache) XListWorkspaceLocalURIs() []protocol.DocumentURI

type CacheOption

type CacheOption func(*CacheOptions)

type CacheOptions

type CacheOptions struct{}

type CodeAction

type CodeAction struct {
	Title       string                  `json:"title"`
	Path        string                  `json:"path,omitempty"`
	Kind        protocol.CodeActionKind `json:"kind,omitempty"`
	IsPreferred bool                    `json:"isPreferred,omitempty"`
	Edits       []protocol.TextEdit     `json:"edit,omitempty"`
	Command     *protocol.Command       `json:"command,omitempty"`
}

type Compiler

type Compiler struct {
	*protocompile.Compiler
	// contains filtered or unexported fields
}

type DiagnosticData

type DiagnosticData struct {
	CodeActions []CodeAction      `json:"codeActions"`
	Metadata    map[string]string `json:"metadata"`
}

type DiagnosticEvent

type DiagnosticEvent int

type DiagnosticHandler

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

func NewDiagnosticHandler

func NewDiagnosticHandler() *DiagnosticHandler

func (*DiagnosticHandler) ClearDiagnosticsForPath

func (dr *DiagnosticHandler) ClearDiagnosticsForPath(path string)

func (*DiagnosticHandler) Flush

func (dr *DiagnosticHandler) Flush()

func (*DiagnosticHandler) FullDiagnosticSnapshot

func (dr *DiagnosticHandler) FullDiagnosticSnapshot() map[string][]*ProtoDiagnostic

func (*DiagnosticHandler) GetDiagnosticsForPath

func (dr *DiagnosticHandler) GetDiagnosticsForPath(path string, prevResultId ...string) ([]*ProtoDiagnostic, string, bool)

func (*DiagnosticHandler) HandleError

func (dr *DiagnosticHandler) HandleError(err reporter.ErrorWithPos) error

func (*DiagnosticHandler) HandleWarning

func (dr *DiagnosticHandler) HandleWarning(err reporter.ErrorWithPos)

func (*DiagnosticHandler) Stream

func (dr *DiagnosticHandler) Stream(ctx context.Context, callback ListenerFunc)

type DiagnosticList

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

func (*DiagnosticList) Add

func (dl *DiagnosticList) Add(d *ProtoDiagnostic)

func (*DiagnosticList) Clear

func (dl *DiagnosticList) Clear() []*ProtoDiagnostic

func (*DiagnosticList) DeleteRelated

func (dl *DiagnosticList) DeleteRelated(related RelatedInformation)

func (*DiagnosticList) Flush

func (dl *DiagnosticList) Flush() ([]*ProtoDiagnostic, string, bool)

func (*DiagnosticList) Get

func (dl *DiagnosticList) Get(prevResultId ...string) (diagnostics []*ProtoDiagnostic, resultId string, unchanged bool)

type DocumentASTRequest

type DocumentASTRequest struct {
	// The URI of the file to retrieve the AST for.
	URI     string `json:"uri"`
	Version int32  `json:"version"`
}

type GenerateCodeRequest

type GenerateCodeRequest struct {
	// The URIs of the files to generate code for. All URIs in this list must
	// belong to the same workspace; the server will look at the first URI in
	// the list to determine which workspace to use.
	URIs []protocol.DocumentURI `json:"uris"`
}

type GenerateWorkspaceRequest

type GenerateWorkspaceRequest struct {
	Workspace protocol.WorkspaceFolder `json:"workspace"`
}

type GeneratedDefinitionParams

type GeneratedDefinitionParams struct {
	protocol.TextDocumentPositionParams
}

type GoLanguageDriver

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

func NewGoLanguageDriver

func NewGoLanguageDriver(workdir string) *GoLanguageDriver

func (*GoLanguageDriver) FindGeneratedFiles

func (*GoLanguageDriver) HasGoModule

func (s *GoLanguageDriver) HasGoModule() bool

func (*GoLanguageDriver) ImplicitGoPackagePath

func (s *GoLanguageDriver) ImplicitGoPackagePath(filename string) (string, error)

func (*GoLanguageDriver) ImportFromGoModule

func (s *GoLanguageDriver) ImportFromGoModule(importName string) (GoModuleImportResults, error)

func (*GoLanguageDriver) RefreshModules

func (s *GoLanguageDriver) RefreshModules()

func (*GoLanguageDriver) SynthesizeFromGoSource

func (s *GoLanguageDriver) SynthesizeFromGoSource(importName string, res GoModuleImportResults) (desc *descriptorpb.FileDescriptorProto, _err error)

type GoModuleImportResults

type GoModuleImportResults struct {
	Module       *gocommand.ModuleJSON
	DirInModule  string
	SourceExists bool
	SourcePath   string
	KnownAltPath string
}

type ImportSource

type ImportSource int
const (
	SourceWellKnown ImportSource = iota + 1
	SourceRelativePath
	SourceLocalGoModule
	SourceGoModuleCache
	SourceSynthetic
)

type ListenerFunc

type ListenerFunc = func(path string, resultId string, diagnostics []*ProtoDiagnostic)

type ParsedGoFile

type ParsedGoFile struct {
	*goast.File
	Fset     *token.FileSet
	Filename string
}

func (ParsedGoFile) Position

func (f ParsedGoFile) Position(pos token.Pos) protocol.Position

type PathMappings

type PathMappings struct {
	FileURIsByPath                  map[string]protocol.DocumentURI
	FilePathsByURI                  map[protocol.DocumentURI]string
	SyntheticFileOriginalNamesByURI map[protocol.DocumentURI]string
}

type Pragmas

type Pragmas interface {
	Lookup(key string) (value string, ok bool)
}

type PreambleInfo

type PreambleInfo struct {
	GeneratedBy string
	Versions    map[string]string
	Source      string
}

func ParseGeneratedPreamble

func ParseGeneratedPreamble(f *goast.File) (PreambleInfo, bool)

type ProtoDiagnostic

type ProtoDiagnostic struct {
	Path               string
	Version            int32
	Range              ast.SourceSpan
	Severity           protocol.DiagnosticSeverity
	Error              error
	Tags               []protocol.DiagnosticTag
	RelatedInformation []RelatedInformation
	CodeActions        []CodeAction
	Metadata           map[string]string

	// If this is a warning being treated as an error, WerrorCategory will be set to
	// a category that can be named in a debug pragma to disable it.
	WerrorCategory string
}

type RefreshModulesRequest

type RefreshModulesRequest struct {
	Workspace protocol.WorkspaceFolder `json:"workspace"`
}

type ReindexWorkspacesRequest

type ReindexWorkspacesRequest struct{}

type RelatedInformation

type RelatedInformation struct {
	Range   ast.SourceSpan
	Message string
}

type Resolver

type Resolver struct {
	*cache.OverlayFS
	// contains filtered or unexported fields
}

func NewResolver

func NewResolver(folder protocol.WorkspaceFolder) *Resolver

func (*Resolver) CheckIncompleteDescriptors

func (r *Resolver) CheckIncompleteDescriptors(results linker.Files) []string

CheckIncompleteDescriptors fills in placeholder sources for synthetic files that did not have fully linked descriptors at the time of creation, and returns a list of paths that need to be compiled again.

func (*Resolver) FindFileByPath

Path resolution order: 1. Check for well-known import paths like google/* 2. Check if the path is a file on disk 3. Check if the path is a go module containing proto sources 3.5. Check if the path is a go module path containing generated code, but no proto sources 4. Check if the path is found in the global message cache

func (*Resolver) FindGeneratedFiles

func (r *Resolver) FindGeneratedFiles(uri protocol.DocumentURI, fd protoreflect.FileDescriptor) ([]ParsedGoFile, error)

func (*Resolver) IsRealWorkspaceLocalFile

func (r *Resolver) IsRealWorkspaceLocalFile(uri protocol.DocumentURI) bool

func (*Resolver) LookupGoModule

func (r *Resolver) LookupGoModule(filename string, f io.Reader) (string, error)

func (*Resolver) OpenFileFromDisk

func (r *Resolver) OpenFileFromDisk(ctx context.Context, uri protocol.DocumentURI) (file.Handle, error)

func (*Resolver) PathToURI

func (r *Resolver) PathToURI(path string) (protocol.DocumentURI, error)

func (*Resolver) PreloadWellKnownPaths

func (r *Resolver) PreloadWellKnownPaths()

func (*Resolver) SyntheticFileContents

func (r *Resolver) SyntheticFileContents(uri protocol.DocumentURI) (string, error)

func (*Resolver) SyntheticFiles

func (r *Resolver) SyntheticFiles() []protocol.DocumentURI

func (*Resolver) URIToPath

func (r *Resolver) URIToPath(uri protocol.DocumentURI) (string, error)

func (*Resolver) UpdateURIPathMappings

func (r *Resolver) UpdateURIPathMappings(modifications []file.Modification)

type SelectRangeParams

type SelectRangeParams struct {
	// A range in the current document that should be selected. Setting the
	// start and end position to the same location has the effect of
	// moving the cursor to that location.
	SelectRange protocol.Range `json:"selectRange"`
	// A range in the current document that will be revealed by the editor.
	RevealRange protocol.Range `json:"revealRange"`
	// Whether to highlight the revealed range.
	HighlightRevealedRange bool `json:"highlightRevealedRange"`
}

type Server

type Server struct {
	ServerOptions
	// contains filtered or unexported fields
}

func NewServer

func NewServer(client protocol.ClientCloser, opts ...ServerOption) *Server

func (*Server) CacheForURI

func (s *Server) CacheForURI(uri protocol.DocumentURI) (*Cache, error)

func (*Server) CacheForWorkspace

func (s *Server) CacheForWorkspace(workspace protocol.WorkspaceFolder) (*Cache, error)

func (*Server) CodeAction

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

CodeAction implements protocol.Server.

func (*Server) CodeLens

func (s *Server) CodeLens(ctx context.Context, params *protocol.CodeLensParams) (result []protocol.CodeLens, err error)

CodeLens implements protocol.Server.

func (*Server) CodeLensRefresh

func (s *Server) CodeLensRefresh(ctx context.Context) (err error)

CodeLensRefresh implements protocol.Server.

func (*Server) CodeLensResolve

func (s *Server) CodeLensResolve(ctx context.Context, params *protocol.CodeLens) (result *protocol.CodeLens, err error)

CodeLensResolve implements protocol.Server.

func (*Server) ColorPresentation

func (s *Server) ColorPresentation(ctx context.Context, params *protocol.ColorPresentationParams) (result []protocol.ColorPresentation, err error)

ColorPresentation implements protocol.Server.

func (*Server) Completion

func (s *Server) Completion(ctx context.Context, params *protocol.CompletionParams) (result *protocol.CompletionList, err error)

Completion implements protocol.Server.

func (*Server) CompletionResolve

func (s *Server) CompletionResolve(ctx context.Context, params *protocol.CompletionItem) (result *protocol.CompletionItem, err error)

CompletionResolve implements protocol.Server.

func (*Server) Declaration

Declaration implements protocol.Server.

func (*Server) Definition

func (s *Server) Definition(ctx context.Context, params *protocol.DefinitionParams) (result []protocol.Location, err error)

Definition implements protocol.Server.

func (*Server) Diagnostic

Diagnostic implements protocol.Server.

func (*Server) DiagnosticRefresh

func (*Server) DiagnosticRefresh(context.Context) error

DiagnosticRefresh implements protocol.Server.

func (*Server) DiagnosticWorkspace

DiagnosticWorkspace implements protocol.Server.

func (*Server) DidChange

func (s *Server) DidChange(ctx context.Context, params *protocol.DidChangeTextDocumentParams) (err error)

DidChange implements protocol.Server.

func (*Server) DidChangeConfiguration

func (*Server) DidChangeConfiguration(context.Context, *protocol.DidChangeConfigurationParams) error

DidChangeConfiguration implements protocol.Server.

func (*Server) DidChangeNotebookDocument

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

DidChangeNotebookDocument implements protocol.Server.

func (*Server) DidChangeWatchedFiles

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

DidChangeWatchedFiles implements protocol.Server.

func (*Server) DidChangeWorkspaceFolders

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

DidChangeWorkspaceFolders implements protocol.Server.

func (*Server) DidClose

func (s *Server) DidClose(ctx context.Context, params *protocol.DidCloseTextDocumentParams) (err error)

DidClose implements protocol.Server.

func (*Server) DidCloseNotebookDocument

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

DidCloseNotebookDocument implements protocol.Server.

func (*Server) DidCreateFiles

func (s *Server) DidCreateFiles(ctx context.Context, params *protocol.CreateFilesParams) (err error)

DidCreateFiles implements protocol.Server.

func (*Server) DidDeleteFiles

func (s *Server) DidDeleteFiles(ctx context.Context, params *protocol.DeleteFilesParams) (err error)

DidDeleteFiles implements protocol.Server.

func (*Server) DidOpen

func (s *Server) DidOpen(ctx context.Context, params *protocol.DidOpenTextDocumentParams) (err error)

DidOpen implements protocol.Server.

func (*Server) DidOpenNotebookDocument

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

DidOpenNotebookDocument implements protocol.Server.

func (*Server) DidRenameFiles

func (s *Server) DidRenameFiles(ctx context.Context, params *protocol.RenameFilesParams) (err error)

DidRenameFiles implements protocol.Server.

func (*Server) DidSave

func (s *Server) DidSave(ctx context.Context, params *protocol.DidSaveTextDocumentParams) (err error)

DidSave implements protocol.Server.

func (*Server) DidSaveNotebookDocument

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

DidSaveNotebookDocument implements protocol.Server.

func (*Server) DocumentColor

DocumentColor implements protocol.Server.

func (*Server) DocumentHighlight

DocumentHighlight implements protocol.Server.

func (s *Server) DocumentLink(ctx context.Context, params *protocol.DocumentLinkParams) ([]protocol.DocumentLink, error)

DocumentLink implements protocol.Server.

func (*Server) DocumentSymbol

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

DocumentSymbol implements protocol.Server.

func (*Server) ExecuteCommand

func (s *Server) ExecuteCommand(ctx context.Context, params *protocol.ExecuteCommandParams) (any, error)

ExecuteCommand implements protocol.Server.

func (*Server) Exit

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

Exit implements protocol.Server.

func (*Server) FoldingRange

FoldingRange implements protocol.Server.

func (*Server) Formatting

func (s *Server) Formatting(ctx context.Context, params *protocol.DocumentFormattingParams) ([]protocol.TextEdit, error)

Formatting implements protocol.Server.

func (*Server) Hover

func (s *Server) Hover(ctx context.Context, params *protocol.HoverParams) (result *protocol.Hover, err error)

Hover implements protocol.Server.

func (*Server) Implementation

func (s *Server) Implementation(ctx context.Context, params *protocol.ImplementationParams) ([]protocol.Location, error)

Implementation implements protocol.Server.

func (*Server) IncomingCalls

IncomingCalls implements protocol.Server.

func (*Server) Initialize

func (s *Server) Initialize(ctx context.Context, params *protocol.ParamInitialize) (result *protocol.InitializeResult, err error)

Initialize implements protocol.Server.

func (*Server) Initialized

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

Initialized implements protocol.Server.

func (*Server) InlayHint

func (s *Server) InlayHint(ctx context.Context, params *protocol.InlayHintParams) ([]protocol.InlayHint, error)

InlayHint implements protocol.Server.

func (*Server) InlayHintRefresh

func (*Server) InlayHintRefresh(context.Context) error

InlayHintRefresh implements protocol.Server.

func (*Server) InlineCompletion

InlineCompletion implements protocol.Server.

func (*Server) InlineValue

InlineValue implements protocol.Server.

func (*Server) InlineValueRefresh

func (*Server) InlineValueRefresh(context.Context) error

InlineValueRefresh implements protocol.Server.

func (*Server) LinkedEditingRange

LinkedEditingRange implements protocol.Server.

func (*Server) Moniker

Moniker implements protocol.Server.

func (*Server) OnTypeFormatting

OnTypeFormatting implements protocol.Server.

func (*Server) OutgoingCalls

OutgoingCalls implements protocol.Server.

func (*Server) PrepareCallHierarchy

PrepareCallHierarchy implements protocol.Server.

func (*Server) PrepareRename

PrepareRename implements protocol.Server.

func (*Server) PrepareTypeHierarchy

PrepareTypeHierarchy implements protocol.Server.

func (*Server) Progress

Progress implements protocol.Server.

func (*Server) RangeFormatting

func (s *Server) RangeFormatting(ctx context.Context, params *protocol.DocumentRangeFormattingParams) ([]protocol.TextEdit, error)

RangeFormatting implements protocol.Server.

func (*Server) RangesFormatting

RangesFormatting implements protocol.Server.

func (*Server) References

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

References implements protocol.Server.

func (*Server) Rename

func (s *Server) Rename(ctx context.Context, params *protocol.RenameParams) (*protocol.WorkspaceEdit, error)

Rename implements protocol.Server.

func (*Server) Resolve

Resolve implements protocol.Server.

func (*Server) ResolveCodeAction

func (s *Server) ResolveCodeAction(ctx context.Context, codeAction *protocol.CodeAction) (*protocol.CodeAction, error)

ResolveCodeAction implements protocol.Server.

func (*Server) ResolveCodeLens

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

ResolveCodeLens implements protocol.Server.

func (*Server) ResolveCompletionItem

func (*Server) ResolveCompletionItem(context.Context, *protocol.CompletionItem) (*protocol.CompletionItem, error)

ResolveCompletionItem implements protocol.Server.

func (*Server) ResolveDocumentLink(context.Context, *protocol.DocumentLink) (*protocol.DocumentLink, error)

ResolveDocumentLink implements protocol.Server.

func (*Server) ResolveWorkspaceSymbol

ResolveWorkspaceSymbol implements protocol.Server.

func (*Server) SelectionRange

SelectionRange implements protocol.Server.

func (*Server) SemanticTokensFull

func (s *Server) SemanticTokensFull(ctx context.Context, params *protocol.SemanticTokensParams) (result *protocol.SemanticTokens, err error)

SemanticTokensFull implements protocol.Server.

func (*Server) SemanticTokensFullDelta

func (s *Server) SemanticTokensFullDelta(ctx context.Context, params *protocol.SemanticTokensDeltaParams) (result interface{}, err error)

SemanticTokensFullDelta implements protocol.Server.

func (*Server) SemanticTokensRange

func (s *Server) SemanticTokensRange(ctx context.Context, params *protocol.SemanticTokensRangeParams) (result *protocol.SemanticTokens, err error)

SemanticTokensRange implements protocol.Server.

func (*Server) SemanticTokensRefresh

func (s *Server) SemanticTokensRefresh(ctx context.Context) (err error)

SemanticTokensRefresh implements protocol.Server.

func (*Server) SetTrace

SetTrace implements protocol.Server.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown implements protocol.Server.

func (*Server) SignatureHelp

SignatureHelp implements protocol.Server.

func (*Server) Subtypes

Subtypes implements protocol.Server.

func (*Server) Supertypes

Supertypes implements protocol.Server.

func (*Server) Symbol

Symbol implements protocol.Server.

func (*Server) TypeDefinition

TypeDefinition implements protocol.Server.

func (*Server) WillCreateFiles

WillCreateFiles implements protocol.Server.

func (*Server) WillDeleteFiles

WillDeleteFiles implements protocol.Server.

func (*Server) WillRenameFiles

WillRenameFiles implements protocol.Server.

func (*Server) WillSave

WillSave implements protocol.Server.

func (*Server) WillSaveWaitUntil

func (s *Server) WillSaveWaitUntil(ctx context.Context, params *protocol.WillSaveTextDocumentParams) ([]protocol.TextEdit, error)

WillSaveWaitUntil implements protocol.Server.

func (*Server) WorkDoneProgressCancel

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

WorkDoneProgressCancel implements protocol.Server.

type ServerOption

type ServerOption func(*ServerOptions)

func WithUnknownCommandHandler

func WithUnknownCommandHandler(handler UnknownCommandHandler, cmds ...string) ServerOption

type ServerOptions

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

type SyntheticFileContentsRequest

type SyntheticFileContentsRequest struct {
	// The URI of the file to update.
	URI string `json:"uri"`
}

type UnknownCommand

type UnknownCommand struct {
	Command   string
	Arguments []json.RawMessage
	Cache     *Cache
}

type UnknownCommandHandler

type UnknownCommandHandler interface {
	Execute(ctx context.Context, uc UnknownCommand) (any, error)
}

type WorkspaceDescriptors

type WorkspaceDescriptors interface {
	Len() int
	All() []protoreflect.Descriptor
	Range(func(path string, descriptors []protoreflect.Descriptor))
}

Jump to

Keyboard shortcuts

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