server

package
v0.0.0-...-395a15b Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: BSD-3-Clause Imports: 65 Imported by: 0

Documentation

Overview

Package server defines gopls' implementation of the LSP server interface, protocol.Server. Call New to create an instance.

Index

Constants

View Source
const (
	CommandCanceled  = "canceled"
	CommandFailed    = "failed"
	CommandCompleted = "completed"
)

These strings are reported as the final WorkDoneProgressEnd message for each workspace/executeCommand request.

View Source
const (
	TelemetryPromptWorkTitle    = "Checking telemetry prompt"     // progress notification title, for awaiting in tests
	GoplsConfigDirEnvvar        = "GOPLS_CONFIG_DIR"              // overridden for testing
	FakeTelemetryModefileEnvvar = "GOPLS_FAKE_TELEMETRY_MODEFILE" // overridden for testing
	FakeSamplesPerMille         = "GOPLS_FAKE_SAMPLES_PER_MILLE"  // overridden for testing
	TelemetryYes                = "Yes, I'd like to help."
	TelemetryNo                 = "No, thanks."
)

The following constants are used for testing telemetry integration.

View Source
const (
	GoTelemetryGoplsClientStartTimeEnvvar = "GOTELEMETRY_GOPLS_CLIENT_START_TIME" // telemetry start time recored in client
	GoTelemetryGoplsClientTokenEnvvar     = "GOTELEMETRY_GOPLS_CLIENT_TOKEN"      // sampling token
)

The following environment variables may be set by the client. Exported for testing telemetry integration.

View Source
const (
	// FromDidOpen is from a didOpen notification.
	FromDidOpen = ModificationSource(iota)

	// FromDidChange is from a didChange notification.
	FromDidChange

	// FromDidChangeWatchedFiles is from didChangeWatchedFiles notification.
	FromDidChangeWatchedFiles

	// FromDidSave is from a didSave notification.
	FromDidSave

	// FromDidClose is from a didClose notification.
	FromDidClose

	// FromDidChangeConfiguration is from a didChangeConfiguration notification.
	FromDidChangeConfiguration

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

	// FromInitialWorkspaceLoad refers to the loading of all packages in the
	// workspace when the view is first created.
	FromInitialWorkspaceLoad

	// FromCheckUpgrades refers to state changes resulting from the CheckUpgrades
	// command, which queries module upgrades.
	FromCheckUpgrades

	// FromResetGoModDiagnostics refers to state changes resulting from the
	// ResetGoModDiagnostics command.
	FromResetGoModDiagnostics

	// FromToggleGCDetails refers to state changes resulting from toggling
	// gc_details on or off for a package.
	FromToggleGCDetails
)
View Source
const GoVulncheckCommandTitle = "govulncheck"
View Source
const WorkspaceLoadFailure = "Error loading workspace"

Variables

View Source
var (

	// exported so tests can verify that counters are incremented
	CompletionCounters = []*counter.Counter{
		complEmpty,
		complShort,
		complLong,
		changeFull,
		complUnused,
		complUsed,
	}
)

Proposed counters for evaluating gopls code completion.

Functions

func DiagnosticWorkTitle

func DiagnosticWorkTitle(cause ModificationSource) string

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

func New

func New(session *cache.Session, client protocol.ClientCloser, options *settings.Options) protocol.Server

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

Types

type ModificationSource

type ModificationSource int

ModificationSource identifies the origin of a change.

func (ModificationSource) String

func (m ModificationSource) String() string

Jump to

Keyboard shortcuts

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