tools: Index | Files | Directories

package lsp

import ""

Package lsp implements LSP for gopls.


Package Files

call_hierarchy.go code_action.go code_lens.go command.go completion.go debounce.go definition.go diagnostics.go folding_range.go format.go general.go highlight.go hover.go implementation.go link.go progress.go references.go rename.go semantic.go server.go server_gen.go signature_help.go symbols.go text_synchronization.go workspace.go workspace_symbol.go


const (
    // FromDidOpen is a file modification caused by opening a file.
    FromDidOpen = ModificationSource(iota)

    // FromDidChange is a file modification caused by changing a file.

    // FromDidChangeWatchedFiles is a file modification caused by a change to a
    // watched file.

    // FromDidSave is a file modification caused by a file save.

    // FromDidClose is a file modification caused by closing a file.

    // FromRegenerateCgo refers to file modifications caused by regenerating
    // the cgo sources for the workspace.

    // FromInitialWorkspaceLoad refers to the loading of all packages in the
    // workspace when the view is first created.
const WorkspaceLoadFailure = "Error loading workspace"

func DiagnosticWorkTitle Uses

func DiagnosticWorkTitle(cause ModificationSource) string

DiagnosticWorkTitle returns the title of the diagnostic work resulting from a file change originating from the given cause.

func SemMods Uses

func SemMods(n int) []string

SemMods returns the []string equivalent of the mods, for gopls semtok.

func SemType Uses

func SemType(n int) string

SemType returns a string equivalent of the type, for gopls semtok

func SemanticModifiers Uses

func SemanticModifiers() []string

SemanticModifiers to use in case there is no client.

func SemanticTypes Uses

func SemanticTypes() []string

SemanticTypes to use in case there is no client, as in the command line, or tests

type ModificationSource Uses

type ModificationSource int

ModificationSource identifies the originating cause of a file modification.

func (ModificationSource) String Uses

func (m ModificationSource) String() string

type Server Uses

type Server struct {
    // contains filtered or unexported fields

Server implements the protocol.Server interface.

func NewServer Uses

func NewServer(session source.Session, client protocol.Client) *Server

NewServer creates an LSP server and binds it to handle incoming client messages on on the supplied stream.

func (*Server) CodeAction Uses

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

func (*Server) CodeLens Uses

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

func (*Server) ColorPresentation Uses

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

func (*Server) Completion Uses

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

func (*Server) Declaration Uses

func (s *Server) Declaration(context.Context, *protocol.DeclarationParams) (protocol.Declaration, error)

func (*Server) Definition Uses

func (s *Server) Definition(ctx context.Context, params *protocol.DefinitionParams) (protocol.Definition, error)

func (*Server) DidChange Uses

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

func (*Server) DidChangeConfiguration Uses

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

func (*Server) DidChangeWatchedFiles Uses

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

func (*Server) DidChangeWorkspaceFolders Uses

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

func (*Server) DidClose Uses

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

func (*Server) DidOpen Uses

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

func (*Server) DidSave Uses

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

func (*Server) DocumentColor Uses

func (s *Server) DocumentColor(context.Context, *protocol.DocumentColorParams) ([]protocol.ColorInformation, error)

func (*Server) DocumentHighlight Uses

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

func (*Server) DocumentSymbol Uses

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

func (*Server) ExecuteCommand Uses

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

func (*Server) Exit Uses

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

func (*Server) FoldingRange Uses

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

func (*Server) Formatting Uses

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

func (*Server) Hover Uses

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

func (*Server) Implementation Uses

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

func (*Server) IncomingCalls Uses

func (s *Server) IncomingCalls(ctx context.Context, params *protocol.CallHierarchyIncomingCallsParams) ([]protocol.CallHierarchyIncomingCall, error)

func (*Server) Initialize Uses

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

func (*Server) Initialized Uses

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

func (*Server) LogTrace Uses

func (s *Server) LogTrace(context.Context, *protocol.LogTraceParams) error

func (*Server) Moniker Uses

func (s *Server) Moniker(context.Context, *protocol.MonikerParams) ([]protocol.Moniker, error)

func (*Server) NonstandardRequest Uses

func (s *Server) NonstandardRequest(ctx context.Context, method string, params interface{}) (interface{}, error)

func (*Server) OnTypeFormatting Uses

func (s *Server) OnTypeFormatting(context.Context, *protocol.DocumentOnTypeFormattingParams) ([]protocol.TextEdit, error)

func (*Server) OutgoingCalls Uses

func (s *Server) OutgoingCalls(ctx context.Context, params *protocol.CallHierarchyOutgoingCallsParams) ([]protocol.CallHierarchyOutgoingCall, error)

func (*Server) PrepareCallHierarchy Uses

func (s *Server) PrepareCallHierarchy(ctx context.Context, params *protocol.CallHierarchyPrepareParams) ([]protocol.CallHierarchyItem, error)

func (*Server) PrepareRename Uses

func (s *Server) PrepareRename(ctx context.Context, params *protocol.PrepareRenameParams) (*protocol.Range, error)

func (*Server) RangeFormatting Uses

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

func (*Server) References Uses

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

func (*Server) Rename Uses

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

func (*Server) Resolve Uses

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

func (*Server) ResolveCodeAction Uses

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

func (*Server) ResolveCodeLens Uses

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

func (*Server) SelectionRange Uses

func (s *Server) SelectionRange(context.Context, *protocol.SelectionRangeParams) ([]protocol.SelectionRange, error)

func (*Server) SemanticTokensFull Uses

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

func (*Server) SemanticTokensFullDelta Uses

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

func (*Server) SemanticTokensRange Uses

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

func (*Server) SemanticTokensRefresh Uses

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

func (*Server) SetTrace Uses

func (s *Server) SetTrace(context.Context, *protocol.SetTraceParams) error

func (*Server) Shutdown Uses

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

func (*Server) SignatureHelp Uses

func (s *Server) SignatureHelp(ctx context.Context, params *protocol.SignatureHelpParams) (*protocol.SignatureHelp, error)

func (*Server) Symbol Uses

func (s *Server) Symbol(ctx context.Context, params *protocol.WorkspaceSymbolParams) ([]protocol.SymbolInformation, error)

func (*Server) TypeDefinition Uses

func (s *Server) TypeDefinition(ctx context.Context, params *protocol.TypeDefinitionParams) (protocol.Definition, error)

func (*Server) WillSave Uses

func (s *Server) WillSave(context.Context, *protocol.WillSaveTextDocumentParams) error

func (*Server) WillSaveWaitUntil Uses

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

func (*Server) WorkDoneProgressCancel Uses

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


analysis/fillreturnsPackage fillreturns defines an Analyzer that will attempt to automatically fill in a return statement that has missing values with zero value elements.
analysis/fillstructPackage fillstruct defines an Analyzer that automatically fills in a struct declaration with zero value elements for each field.
analysis/nonewvarsPackage nonewvars defines an Analyzer that applies suggested fixes to errors of the type "no new variables on left side of :=".
analysis/noresultvaluesPackage noresultvalues defines an Analyzer that applies suggested fixes to errors of the type "no result values expected".
analysis/simplifycompositelitPackage simplifycompositelit defines an Analyzer that simplifies composite literals.
analysis/simplifyrangePackage simplifyrange defines an Analyzer that simplifies range statements.
analysis/simplifyslicePackage simplifyslice defines an Analyzer that simplifies slice statements.
analysis/undeclarednamePackage undeclaredname defines an Analyzer that applies suggested fixes to errors of the type "undeclared name: %s".
analysis/unusedparamsPackage unusedparams defines an analyzer that checks for unused parameters of functions.
browserPackage browser provides utilities for interacting with users' browsers.
cachePackage cache implements the caching layer for gopls.
cmdPackage cmd handles the gopls command line.
cmd/testPackage cmdtest contains the test suite for the command line behavior of gopls.
debugPackage debug exports debug information for gopls.
debug/logPackage log provides helper methods for exporting log events to the internal/event package.
debug/tagPackage tag provides the labels used for telemetry throughout gopls.
diffPackage diff supports a pluggable diff algorithm.
diff/difftestPackage difftest supplies a set of tests that will operate on any implementation of a diff algorithm as exposed by ""
diff/myersPackage myers implements the Myers diff algorithm.
fakePackage fake provides fake implementations of a text editor, LSP client plugin, and Sandbox environment for use in tests.
fuzzyPackage fuzzy implements a fuzzy matching algorithm.
helperInvoke with //go:generate helper/helper -t Server -d protocol/tsserver.go -u lsp -o server_gen.go invoke in internal/lsp
lsprpcPackage lsprpc implements a jsonrpc2.StreamServer that may be used to serve the LSP on a jsonrpc2 channel.
modPackage mod provides core features related to go.mod file handling for use by Go editors and tools.
protocolPackage protocol contains the structs that map directly to the wire format of the "Language Server Protocol".
snippetPackage snippet implements the specification for the LSP snippet format.
sourcePackage source provides core features for use by Go editors and tools.
source/completionPackage completion provides core functionality for code completion in Go editors and tools.
testsPackage tests exports functionality to be used across a variety of gopls tests.

Package lsp imports 39 packages (graph) and is imported by 6 packages. Updated 2021-01-17. Refresh now. Tools for package owners.