lsp

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 34 Imported by: 0

Documentation

Overview

modified based on https://github.com/microsoft/typescript-go/blob/cedc0cbe6c188f9bfe6a51af00c79be48c9ab74d/internal/lsp/server.go#L1

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LintResponse

type LintResponse struct {
	Diagnostics []lsproto.Diagnostic `json:"diagnostics"`
	ErrorCount  int                  `json:"errorCount"`
	FileCount   int                  `json:"fileCount"`
	RuleCount   int                  `json:"ruleCount"`
}

LintResponse represents a lint response from Go to JS

type Reader

type Reader interface {
	Read() (*lsproto.Message, error)
}

func ToReader

func ToReader(r io.Reader) Reader

type Server

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

func NewServer

func NewServer(opts *ServerOptions) *Server

func (*Server) Client

func (s *Server) Client() project.Client

Client implements project.ServiceHost.

func (*Server) DefaultLibraryPath

func (s *Server) DefaultLibraryPath() string

DefaultLibraryPath implements project.ServiceHost.

func (*Server) FS

func (s *Server) FS() vfs.FS

FS implements project.ServiceHost.

func (*Server) GetCurrentDirectory

func (s *Server) GetCurrentDirectory() string

GetCurrentDirectory implements project.ServiceHost.

func (*Server) IsActive added in v0.5.2

func (s *Server) IsActive() bool

IsActive implements project.Client.

func (*Server) Log

func (s *Server) Log(msg ...any)

func (*Server) ProgressFinish added in v0.5.2

func (s *Server) ProgressFinish(message *diagnostics.Message, args ...any)

ProgressFinish implements project.Client.

func (*Server) ProgressStart added in v0.5.2

func (s *Server) ProgressStart(message *diagnostics.Message, args ...any)

ProgressStart implements project.Client.

func (*Server) PublishDiagnostics added in v0.2.1

func (s *Server) PublishDiagnostics(ctx context.Context, params *lsproto.PublishDiagnosticsParams) error

PublishDiagnostics implements project.Client.

func (*Server) RefreshCodeLens added in v0.2.1

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

RefreshCodeLens implements project.Client.

func (*Server) RefreshDiagnostics

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

RefreshDiagnostics implements project.Client. Called from Session's background goroutine when project state changes (e.g. tsconfig reload). We signal the main dispatch loop via refreshCh so that relinting happens on the main goroutine (session is not goroutine-safe).

func (*Server) RefreshInlayHints added in v0.2.1

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

RefreshInlayHints implements project.Client.

func (*Server) Run

func (s *Server) Run() error

func (*Server) SendTelemetry added in v0.5.2

func (s *Server) SendTelemetry(ctx context.Context, telemetry lsproto.TelemetryEvent) error

SendTelemetry implements project.Client.

func (*Server) SetCompilerOptionsForInferredProjects

func (s *Server) SetCompilerOptionsForInferredProjects(options *core.CompilerOptions)

!!! temporary; remove when we have `handleDidChangeConfiguration`/implicit project config support

func (*Server) Trace

func (s *Server) Trace(msg string)

Trace implements project.ServiceHost.

func (*Server) TypingsLocation

func (s *Server) TypingsLocation() string

TypingsLocation implements project.ServiceHost.

func (*Server) UnwatchFiles

func (s *Server) UnwatchFiles(ctx context.Context, id project.WatcherID) error

UnwatchFiles implements project.Client.

func (*Server) WatchFiles

func (s *Server) WatchFiles(ctx context.Context, id project.WatcherID, watchers []*lsproto.FileSystemWatcher) error

WatchFiles implements project.Client.

type ServerOptions

type ServerOptions struct {
	In  Reader
	Out Writer
	Err io.Writer

	Cwd                string
	FS                 vfs.FS
	DefaultLibraryPath string
	TypingsLocation    string

	ParseCache *project.ParseCache
}

type Writer

type Writer interface {
	Write(msg *lsproto.Message) error
}

func ToWriter

func ToWriter(w io.Writer) Writer

Jump to

Keyboard shortcuts

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