api

package
v0.0.0-...-257e874 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 55 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMaxResponseBytesPerPage = 300_000_000

DefaultMaxResponseBytesPerPage leaves room for base64 expansion beneath V8's maximum string length while rounding down to an even decimal value.

Variables

View Source
var (
	ErrInvalidRequest = errors.New("api: invalid request")
	ErrClientError    = errors.New("api: client error")
)

Functions

This section is empty.

Types

type BatchRequest

type BatchRequest struct {
	Method Method     `json:"method"`
	Params json.Value `json:"params,omitempty"`
}

type BatchRequestsParams

type BatchRequestsParams struct {
	Requests                []BatchRequest `json:"requests"`
	ContinuationToken       string         `json:"continuationToken,omitempty"`
	MaxResponseBytesPerPage int            `json:"maxResponseBytesPerPage,omitempty"`
}

type BatchRequestsResponse

type BatchRequestsResponse struct {
	Responses         []BatchResponse `json:"responses" nonnil:"true"`
	ContinuationToken string          `json:"continuationToken,omitempty"`
	// contains filtered or unexported fields
}

func (*BatchRequestsResponse) MarshalJSONTo

func (r *BatchRequestsResponse) MarshalJSONTo(enc *json.Encoder) error

type BatchResponse

type BatchResponse struct {
	Method Method `json:"method"`
	Result any    `json:"result"`
	Error  string `json:"error,omitempty"`
}

type BuildOrchestrator

type BuildOrchestrator struct {
	Build           func(project string) tsc.ExitStatus
	BuildReferences func(project string) tsc.ExitStatus
	CleanReferences func(project string) tsc.ExitStatus
}

type BuildOrchestratorID

type BuildOrchestratorID uint64

func NewBuildOrchestratorID

func NewBuildOrchestratorID() BuildOrchestratorID

type BuildParams

type BuildParams struct {
	BuildOrchestratorID BuildOrchestratorID `json:"buildOrchestratorID"`
	Project             string              `json:"project,omitempty"`
}

type BuildResponse

type BuildResponse struct {
	Status      tsc.ExitStatus        `json:"status"`
	Diagnostics []*DiagnosticResponse `json:"diagnostics,omitempty"`
	Statistics  tsc.Statistics        `json:"statistics"`
}

type CheckerNodeParams

type CheckerNodeParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  project.ID `json:"project"`
	Location NodeHandle `json:"location"`
}

CheckerNodeParams are parameters for checker methods that operate on a node location.

type CheckerSignatureParams

type CheckerSignatureParams struct {
	Snapshot  SnapshotID  `json:"snapshot"`
	Project   project.ID  `json:"project"`
	Signature SignatureID `json:"signature"`
}

CheckerSignatureParams are parameters for checker methods that operate on a signature.

type CheckerSymbolParams

type CheckerSymbolParams struct {
	Snapshot SnapshotID      `json:"snapshot"`
	Project  project.ID      `json:"project"`
	Symbol   SymbolReference `json:"symbol"`
}

CheckerSymbolParams are parameters for checker methods that operate on a symbol.

type CheckerTypeParams

type CheckerTypeParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  project.ID `json:"project"`
	Type     TypeID     `json:"type"`
}

CheckerTypeParams are parameters for checker methods that operate on a type.

type CleanBuildParams

type CleanBuildParams struct {
	BuildOrchestratorID BuildOrchestratorID `json:"buildOrchestratorID"`
	Project             string              `json:"project,omitempty"`
}

type CleanBuildResponse

type CleanBuildResponse struct {
	Status       tsc.ExitStatus          `json:"status"`
	Diagnostics  []*DiagnosticResponse   `json:"diagnostics,omitempty"`
	Statistics   tsc.Statistics          `json:"statistics"`
	FilesDeleted []tspath.RootedFilePath `json:"filesDeleted,omitempty"`
}

type CompactSymbolReference

type CompactSymbolReference struct {
	Id   SymbolID `json:"id"`
	File string   `json:"file,omitempty"`
}

CompactSymbolReference is embedded in other responses. It identifies a cached symbol without repeating its owning file's full descriptor: File is the owning source file's node ID, or empty for a symbol owned by the response's snapshot. When the client has not cached the symbol, it fetches a full SymbolResponse through the corresponding property method.

type CompletionEntryLabelDetailsResponse

type CompletionEntryLabelDetailsResponse struct {
	Detail      *string `json:"detail,omitempty"`
	Description *string `json:"description,omitempty"`
}

CompletionEntryLabelDetailsResponse holds additional label display text for a completion entry.

type CompletionEntryResponse

type CompletionEntryResponse struct {
	Name         string                               `json:"name"`
	Kind         uint32                               `json:"kind,omitempty"`
	SortText     *string                              `json:"sortText,omitempty"`
	InsertText   *string                              `json:"insertText,omitempty"`
	FilterText   *string                              `json:"filterText,omitempty"`
	Detail       *string                              `json:"detail,omitempty"`
	LabelDetails *CompletionEntryLabelDetailsResponse `json:"labelDetails,omitempty"`
	Symbol       *SymbolResponse                      `json:"symbol,omitempty"`
}

CompletionEntryResponse represents a single completion item.

type CompletionInfoResponse

type CompletionInfoResponse struct {
	IsIncomplete bool                       `json:"isIncomplete"`
	Entries      []*CompletionEntryResponse `json:"entries" nonnil:"true"`
}

CompletionInfoResponse wraps a list of completion entries.

type ConfigFileResponse

type ConfigFileResponse struct {
	FileNames         []tspath.RootedFilePath  `json:"fileNames" nonnil:"true"`
	Options           *core.CompilerOptions    `json:"options" nonnil:"true"`
	BuildOptions      *core.BuildOptions       `json:"buildOptions,omitempty"`
	ProjectReferences []*core.ProjectReference `json:"projectReferences,omitempty"`
	TypeAcquisition   *core.TypeAcquisition    `json:"typeAcquisition,omitempty"`
	CompileOnSave     *bool                    `json:"compileOnSave,omitempty"`
	Raw               any                      `json:"raw,omitempty"`
	Errors            []*DiagnosticResponse    `json:"errors" nonnil:"true"`
}

func NewConfigFileResponse

func NewConfigFileResponse(parsedCommandLine *tsoptions.ParsedCommandLine) *ConfigFileResponse

type ConstantValueResponse

type ConstantValueResponse struct {
	IsNumber bool `json:"isNumber"`
	Value    any  `json:"value"`
}

type CreateBuildOrchestratorParams

type CreateBuildOrchestratorParams struct {
	RootNames []string                   `json:"rootNames"`
	Cwd       tspath.RootedDirectoryPath `json:"cwd,omitempty"`
	// Only a subset of these options are exposed  the API
	*core.BuildOptions    `json:"buildOptions,omitempty"`
	*core.CompilerOptions `json:"compilerOptions,omitempty"`
}

type CreateBuildOrchestratorResponse

type CreateBuildOrchestratorResponse struct {
	BuildOrchestratorID BuildOrchestratorID `json:"buildOrchestratorID"`
}

type CreateModuleResolverParams

type CreateModuleResolverParams struct {
	CompilerOptions           core.CompilerOptions  `json:"compilerOptions"`
	ModuleResolutions         *ModuleResolutionSpec `json:"moduleResolutions,omitempty"`
	ResolveModuleNameCallback string                `json:"resolveModuleNameCallback,omitempty"`
}

type CreateProgramOptions

type CreateProgramOptions struct {
	ProjectReferences            []*core.ProjectReference `json:"projectReferences,omitempty"`
	ConfigFileParsingDiagnostics []*DiagnosticResponse    `json:"configFileParsingDiagnostics,omitempty"`
	ModuleResolver               ModuleResolverID         `json:"moduleResolver,omitempty"`
}

type CreateSnapshotParams

type CreateSnapshotParams struct {
	SnapshotRequestChangesParams
	// UserPreferences configures language service behavior in the new snapshot.
	UserPreferences *lsutil.UserPreferences `json:"userPreferences,omitempty"`
	// PrepareAutoImports identifies the file whose auto-import indexes should be ready in the new snapshot.
	PrepareAutoImports *DocumentIdentifier `json:"prepareAutoImports,omitempty"`
	// FileNotifications describes host file system changes to invalidate while creating the snapshot.
	FileNotifications *FileNotifications `json:"fileNotifications,omitempty"`
	// FileSystem supplies file contents and directory listings for the new snapshot.
	// A full filesystem is canonical and total. A filesystem layer is checked
	// before falling back to the base snapshot or host filesystem.
	FileSystem *requestfilesystem.RequestFileSystem `json:"fileSystem,omitempty"`
}

CreateSnapshotParams are the parameters for creating a new independent snapshot.

type CreateSnapshotProgramParams

type CreateSnapshotProgramParams struct {
	RootFiles            []DocumentIdentifier          `json:"rootFiles"`
	CompilerOptions      core.CompilerOptions          `json:"-"`
	CompilerOptionsInput *tsoptions.RawCompilerOptions `json:"compilerOptions" nonnil:"true"`
	Options              *CreateProgramOptions         `json:"options,omitempty"`
}

type CreateSnapshotResponse

type CreateSnapshotResponse struct {
	// Snapshot is the handle for the newly created snapshot.
	Snapshot SnapshotID `json:"snapshot"`
	// Projects contains all projects when no response base was supplied, or only
	// projects added or replaced relative to that base.
	Projects []*ProjectResponse `json:"projects" nonnil:"true"`
	// Changes describes source file differences from the response base.
	Changes *SnapshotChanges `json:"changes,omitempty"`
	// Operation describes results correlated with the request that produced the snapshot.
	Operation *SnapshotOperationResponse `json:"operation" nonnil:"true"`
}

CreateSnapshotResponse is returned by createSnapshot.

type CreateSourceFileFromFileParams

type CreateSourceFileFromFileParams struct {
	FileName string                  `json:"fileName"`
	Options  CreateSourceFileOptions `json:"options"`
}

type CreateSourceFileOptions

type CreateSourceFileOptions struct {
	ScriptKind core.ScriptKind `json:"scriptKind,omitempty"`
}

type CreateSourceFileParams

type CreateSourceFileParams struct {
	FileName   string                  `json:"fileName"`
	SourceText string                  `json:"sourceText"`
	Options    CreateSourceFileOptions `json:"options"`
}

type DiagnosticPositionResponse

type DiagnosticPositionResponse struct {
	Line      int              `json:"line"`
	Character core.UTF16Offset `json:"character"`
}

type DiagnosticResponse

type DiagnosticResponse struct {
	// The file name of the file this diagnostic belongs to, if any.
	FileName tspath.RootedFilePath `json:"fileName,omitempty"`
	// Pos is the start position of the diagnostic in the source file.
	Pos int `json:"pos"`
	// End is the end position of the diagnostic in the source file.
	End int `json:"end"`
	// StartPosition is the zero-based line and UTF-16 character position of Pos.
	StartPosition *DiagnosticPositionResponse `json:"startPosition,omitempty"`
	// EndPosition is the zero-based line and UTF-16 character position of End.
	EndPosition *DiagnosticPositionResponse `json:"endPosition,omitempty"`
	// SourceLines contains the source lines needed to render this diagnostic with context.
	SourceLines []*DiagnosticSourceLineResponse `json:"sourceLines,omitempty"`
	// Code is the diagnostic error code.
	Code int32 `json:"code"`
	// Category is the diagnostic category (error, warning, suggestion, message).
	Category diagnostics.Category `json:"category"`
	// Source is a custom diagnostic-code prefix. An empty value uses the default "TS".
	Source string `json:"source,omitempty"`
	// Text is the localized diagnostic message text.
	Text string `json:"text"`
	// ReportsUnnecessary indicates this diagnostic highlights unnecessary code.
	ReportsUnnecessary bool `json:"reportsUnnecessary,omitzero"`
	// ReportsDeprecated indicates this diagnostic highlights deprecated code.
	ReportsDeprecated bool `json:"reportsDeprecated,omitzero"`
	// MessageChain contains chained diagnostic messages, if any.
	MessageChain []*DiagnosticResponse `json:"messageChain,omitempty"`
	// RelatedInformation contains related diagnostic information, if any.
	RelatedInformation []*DiagnosticResponse `json:"relatedInformation,omitempty"`
}

DiagnosticResponse is the API response for a single diagnostic.

func NewDiagnosticResponse

func NewDiagnosticResponse(d *ast.Diagnostic) *DiagnosticResponse

NewDiagnosticResponse converts an ast.Diagnostic to a DiagnosticResponse.

func NewDiagnosticResponses

func NewDiagnosticResponses(diags []*ast.Diagnostic) []*DiagnosticResponse

NewDiagnosticResponses converts a slice of ast.Diagnostics to DiagnosticResponses.

func (*DiagnosticResponse) ToDiagnostic

func (d *DiagnosticResponse) ToDiagnostic() *ast.Diagnostic

type DiagnosticSourceLineResponse

type DiagnosticSourceLineResponse struct {
	Line int    `json:"line"`
	Text string `json:"text"`
}

type DisposeBuildOrchestratorParams

type DisposeBuildOrchestratorParams struct {
	BuildOrchestratorID BuildOrchestratorID `json:"buildOrchestratorID"`
}

type DocumentIdentifier

type DocumentIdentifier struct {
	FileName string              `json:"fileName,omitempty"`
	URI      lsproto.DocumentUri `json:"uri,omitempty"`
}

DocumentIdentifier identifies a document by either a file name (plain string) or a URI object. On the wire it is string | { uri: string }.

@example

Using a file name:

project.program.getSourceFile("/path/to/file.ts");

Using a URI:

project.program.getSourceFile({ uri: "file:///path/to/file.ts" });

func (DocumentIdentifier) String

func (d DocumentIdentifier) String() string

func (DocumentIdentifier) ToFileName

func (DocumentIdentifier) ToURI

ToURI returns the document URI for this identifier. An explicitly provided URI is returned as-is; a file name is first normalized to an absolute path against cwd before being converted to a URI.

func (*DocumentIdentifier) UnmarshalJSONFrom

func (d *DocumentIdentifier) UnmarshalJSONFrom(dec *json.Decoder) error

type EmitOutputFile

type EmitOutputFile struct {
	FileName       tspath.RootedFilePath  `json:"fileName"`
	Text           string                 `json:"text"`
	SourceFileName *tspath.RootedFilePath `json:"sourceFileName,omitempty"`
}

type EmitOutputResponse

type EmitOutputResponse struct {
	EmitSkipped bool                  `json:"emitSkipped"`
	Diagnostics []*DiagnosticResponse `json:"diagnostics" nonnil:"true"`
	OutputFiles []*EmitOutputFile     `json:"outputFiles" nonnil:"true"`
}

type EmitParams

type EmitParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  project.ID `json:"project"`
	EmitOnly *uint32    `json:"emitOnly,omitempty"`
}

type EmitResponse

type EmitResponse struct {
	EmitSkipped  bool                    `json:"emitSkipped"`
	Diagnostics  []*DiagnosticResponse   `json:"diagnostics" nonnil:"true"`
	EmittedFiles []tspath.RootedFilePath `json:"emittedFiles" nonnil:"true"`
	// EmittedFilesContents contains contents parallel to EmittedFiles when the
	// source snapshot uses a full filesystem. It is empty for write-through emits.
	EmittedFilesContents []string `json:"emittedFilesContents" nonnil:"true"`
}

type EnsurePrograms

type EnsurePrograms struct {
	All      bool
	Projects []project.ID
}

func (*EnsurePrograms) UnmarshalJSONFrom

func (e *EnsurePrograms) UnmarshalJSONFrom(dec *json.Decoder) error

type FileNotifications

type FileNotifications struct {
	InvalidateAll bool                 `json:"invalidateAll,omitempty"`
	Changed       []DocumentIdentifier `json:"changed,omitempty"`
	Created       []DocumentIdentifier `json:"created,omitempty"`
	Deleted       []DocumentIdentifier `json:"deleted,omitempty"`
}

FileNotifications describes changes to files that have occurred on the host file system, used to notify the session to reload cached files and reevaluate tsconfig.json `include` globs. Either InvalidateAll is true (discard all caches) or Changed/Created/Deleted list individual documents.

type FormatNodeForInsertionParams

type FormatNodeForInsertionParams struct {
	Snapshot SnapshotID         `json:"snapshot"`
	Project  project.ID         `json:"project"`
	File     DocumentIdentifier `json:"file"`     // target file where the node will be inserted
	Position uint32             `json:"position"` // UTF-16 code-unit offset of the insertion position in the target file
	Data     string             `json:"data"`     // base64-encoded binary AST data for the synthesized node
}

FormatNodeForInsertionParams are the parameters for the formatNodeForInsertion method.

type GetBaseTypeOfLiteralTypeParams

type GetBaseTypeOfLiteralTypeParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  project.ID `json:"project"`
	Type     TypeID     `json:"type"`
}

GetBaseTypeOfLiteralTypeParams returns the base type of a literal type.

type GetCachedSourceFileParams

type GetCachedSourceFileParams struct {
	File SourceFileDescriptor `json:"file"`
}

GetCachedSourceFileParams address an ordinary cached source file by its complete identity, independent of any snapshot or lease.

type GetCompletionsAtPositionParams

type GetCompletionsAtPositionParams struct {
	Snapshot         SnapshotID         `json:"snapshot"`
	Project          project.ID         `json:"project"`
	File             DocumentIdentifier `json:"file"`
	Position         uint32             `json:"position"`
	TriggerCharacter *string            `json:"triggerCharacter,omitempty"`
	IncludeSymbol    bool               `json:"includeSymbol,omitempty"`
}

GetCompletionsAtPositionParams are the parameters for the getCompletionsAtPosition method.

type GetContextualTypeForArgumentParams

type GetContextualTypeForArgumentParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  project.ID `json:"project"`
	Location NodeHandle `json:"location"`
	Index    int32      `json:"index"`
}

type GetContextualTypeParams

type GetContextualTypeParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  project.ID `json:"project"`
	Location NodeHandle `json:"location"`
}

GetContextualTypeParams returns the contextual type for a node.

type GetCurrentLanguageServerSnapshotParams

type GetCurrentLanguageServerSnapshotParams struct {
	BaseSnapshot SnapshotID                     `json:"baseSnapshot,omitempty"`
	Changes      *LanguageServerSnapshotChanges `json:"changes,omitempty"`
}

type GetDefaultProjectForFileParams

type GetDefaultProjectForFileParams struct {
	Snapshot SnapshotID         `json:"snapshot"`
	File     DocumentIdentifier `json:"file"`
}

type GetDiagnosticsParams

type GetDiagnosticsParams struct {
	Snapshot SnapshotID           `json:"snapshot"`
	Project  project.ID           `json:"project"`
	Files    []DocumentIdentifier `json:"files,omitempty"`
}

GetDiagnosticsParams are parameters for per-file diagnostic methods.

type GetImportAdderEditsParams

type GetImportAdderEditsParams struct {
	Snapshot SnapshotID          `json:"snapshot"`
	Project  project.ID          `json:"project"`
	File     DocumentIdentifier  `json:"file"`
	Actions  []ImportAdderAction `json:"actions"`
}

type GetIndexInfoOfTypeParams

type GetIndexInfoOfTypeParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  project.ID `json:"project"`
	Type     TypeID     `json:"type"`
	Kind     int32      `json:"kind"`
}

type GetIntrinsicTypeParams

type GetIntrinsicTypeParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  project.ID `json:"project"`
}

GetIntrinsicTypeParams is used for intrinsic type getters (anyType, stringType, etc.).

type GetMemberInModuleExportsParams

type GetMemberInModuleExportsParams struct {
	Snapshot SnapshotID      `json:"snapshot"`
	Project  project.ID      `json:"project"`
	Symbol   SymbolReference `json:"symbol"`
	Name     string          `json:"name"`
}

GetMemberInModuleExportsParams are parameters for getMemberInModuleExports.

type GetModeForResolutionAtIndexParams

type GetModeForResolutionAtIndexParams struct {
	Snapshot SnapshotID         `json:"snapshot"`
	Project  project.ID         `json:"project"`
	File     DocumentIdentifier `json:"file"`
	Index    int                `json:"index"`
}

type GetModeForUsageLocationParams

type GetModeForUsageLocationParams struct {
	Snapshot SnapshotID         `json:"snapshot"`
	Project  project.ID         `json:"project"`
	File     DocumentIdentifier `json:"file"`
	Usage    NodeHandle         `json:"usage"`
}

type GetNonNullableTypeParams

type GetNonNullableTypeParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  project.ID `json:"project"`
	Type     TypeID     `json:"type"`
}

GetNonNullableTypeParams are the parameters for the getNonNullableType method.

type GetParameterTypeParams

type GetParameterTypeParams struct {
	Snapshot  SnapshotID  `json:"snapshot"`
	Project   project.ID  `json:"project"`
	Signature SignatureID `json:"signature"`
	Index     int32       `json:"index"`
}

GetParameterTypeParams are the parameters for the getParameterType method.

type GetProjectDiagnosticsParams

type GetProjectDiagnosticsParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  project.ID `json:"project"`
}

GetProjectDiagnosticsParams are parameters for project-wide diagnostic methods.

type GetPropertyOfTypeParams

type GetPropertyOfTypeParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  project.ID `json:"project"`
	Type     TypeID     `json:"type"`
	Name     string     `json:"name"`
}

GetPropertyOfTypeParams are parameters for getPropertyOfType (a named property of a type).

type GetReferencedSymbolsForNodeParams

type GetReferencedSymbolsForNodeParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  project.ID `json:"project"`
	Node     NodeHandle `json:"node"`
	Position int        `json:"position"`
}

GetReferencedSymbolsForNodeParams are the parameters for the getReferencedSymbolsForNode method.

type GetReferencesToSymbolInFileParams

type GetReferencesToSymbolInFileParams struct {
	Snapshot SnapshotID         `json:"snapshot"`
	Project  project.ID         `json:"project"`
	File     DocumentIdentifier `json:"file"`
	Symbol   SymbolReference    `json:"symbol"`
}

GetReferencesToSymbolInFileParams are the parameters for the getReferencesToSymbolInFile method.

type GetResolvedModuleFromModuleSpecifierParams

type GetResolvedModuleFromModuleSpecifierParams struct {
	Snapshot        SnapshotID          `json:"snapshot"`
	Project         project.ID          `json:"project"`
	ModuleSpecifier NodeHandle          `json:"moduleSpecifier"`
	SourceFile      *DocumentIdentifier `json:"sourceFile,omitempty"`
}

type GetResolvedModuleParams

type GetResolvedModuleParams struct {
	Snapshot   SnapshotID          `json:"snapshot"`
	Project    project.ID          `json:"project"`
	File       DocumentIdentifier  `json:"file"`
	ModuleName string              `json:"moduleName"`
	Mode       core.ResolutionMode `json:"mode"`
}

type GetResolvedSignatureParams

type GetResolvedSignatureParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  project.ID `json:"project"`
	Location NodeHandle `json:"location"`
}

type GetResolvedTypeReferenceDirectiveFromReferenceParams

type GetResolvedTypeReferenceDirectiveFromReferenceParams struct {
	Snapshot          SnapshotID          `json:"snapshot"`
	Project           project.ID          `json:"project"`
	SourceFile        DocumentIdentifier  `json:"sourceFile"`
	TypeDirectiveName string              `json:"typeDirectiveName"`
	ResolutionMode    core.ResolutionMode `json:"resolutionMode"`
}

type GetResolvedTypeReferenceDirectiveParams

type GetResolvedTypeReferenceDirectiveParams struct {
	Snapshot          SnapshotID          `json:"snapshot"`
	Project           project.ID          `json:"project"`
	File              DocumentIdentifier  `json:"file"`
	TypeDirectiveName string              `json:"typeDirectiveName"`
	Mode              core.ResolutionMode `json:"mode"`
}

type GetSignaturePropertyParams

type GetSignaturePropertyParams struct {
	Snapshot  SnapshotID  `json:"snapshot"`
	Project   project.ID  `json:"project"`
	Signature SignatureID `json:"objectId"`
}

GetSignaturePropertyParams is used for all signature sub-property endpoints.

type GetSignatureUsagesParams

type GetSignatureUsagesParams struct {
	Snapshot      SnapshotID `json:"snapshot"`
	Project       project.ID `json:"project"`
	SignatureDecl NodeHandle `json:"signatureDecl"`
}

GetSignatureUsagesParams are the parameters for the getSignatureUsages method.

type GetSignaturesOfTypeParams

type GetSignaturesOfTypeParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  project.ID `json:"project"`
	Type     TypeID     `json:"type"`
	Kind     int32      `json:"kind"`
}

type GetSourceFileNamesParams

type GetSourceFileNamesParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  project.ID `json:"project"`
}

type GetSourceFileParams

type GetSourceFileParams struct {
	Snapshot SnapshotID         `json:"snapshot"`
	Project  project.ID         `json:"project"`
	File     DocumentIdentifier `json:"file"`
}

type GetSymbolAtLocationParams

type GetSymbolAtLocationParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  project.ID `json:"project"`
	Location NodeHandle `json:"location"`
}

type GetSymbolAtPositionParams

type GetSymbolAtPositionParams struct {
	Snapshot SnapshotID         `json:"snapshot"`
	Project  project.ID         `json:"project"`
	File     DocumentIdentifier `json:"file"`
	Position uint32             `json:"position"`
}

type GetSymbolOfDeclarationParams

type GetSymbolOfDeclarationParams struct {
	File  SourceFileDescriptor `json:"file"`
	Index uint32               `json:"index"`
}

type GetSymbolOfSourceFileParams

type GetSymbolOfSourceFileParams struct {
	Snapshot SnapshotID         `json:"snapshot"`
	Project  project.ID         `json:"project"`
	File     DocumentIdentifier `json:"file"`
}

type GetSymbolPropertyParams

type GetSymbolPropertyParams struct {
	Symbol SymbolReference `json:"symbol"`
}

GetSymbolPropertyParams is used for all symbol sub-property endpoints.

type GetSymbolsAtLocationsParams

type GetSymbolsAtLocationsParams struct {
	Snapshot  SnapshotID   `json:"snapshot"`
	Project   project.ID   `json:"project"`
	Locations []NodeHandle `json:"locations"`
}

type GetSymbolsAtPositionsParams

type GetSymbolsAtPositionsParams struct {
	Snapshot  SnapshotID         `json:"snapshot"`
	Project   project.ID         `json:"project"`
	File      DocumentIdentifier `json:"file"`
	Positions []uint32           `json:"positions"`
}

type GetSymbolsInScopeParams

type GetSymbolsInScopeParams struct {
	Snapshot SnapshotID          `json:"snapshot"`
	Project  project.ID          `json:"project"`
	Location NodeHandle          `json:"location,omitempty"` // Optional: node handle for location context
	File     *DocumentIdentifier `json:"file,omitempty"`     // Optional: file for location context (alternative to Location)
	Position *uint32             `json:"position,omitempty"` // Optional: position in file for location context (with File)
	Meaning  uint32              `json:"meaning"`            // SymbolFlags for what kind of symbols to find
}

GetSymbolsInScopeParams are parameters for getSymbolsInScope, which returns all symbols visible at a given location.

type GetSymbolsOfSourceFilesParams

type GetSymbolsOfSourceFilesParams struct {
	Snapshot SnapshotID           `json:"snapshot"`
	Project  project.ID           `json:"project"`
	Files    []DocumentIdentifier `json:"files"`
}

type GetTypeAtLocationParams

type GetTypeAtLocationParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  project.ID `json:"project"`
	Location NodeHandle `json:"location"`
}

type GetTypeAtLocationsParams

type GetTypeAtLocationsParams struct {
	Snapshot  SnapshotID   `json:"snapshot"`
	Project   project.ID   `json:"project"`
	Locations []NodeHandle `json:"locations"`
}

type GetTypeAtPositionParams

type GetTypeAtPositionParams struct {
	Snapshot SnapshotID         `json:"snapshot"`
	Project  project.ID         `json:"project"`
	File     DocumentIdentifier `json:"file"`
	Position uint32             `json:"position"`
}

type GetTypeFromTypeNodeParams

type GetTypeFromTypeNodeParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  project.ID `json:"project"`
	Location NodeHandle `json:"location"`
}

GetTypeFromTypeNodeParams are the parameters for the getTypeFromTypeNode method.

type GetTypeOfSymbolAtLocationParams

type GetTypeOfSymbolAtLocationParams struct {
	Snapshot SnapshotID      `json:"snapshot"`
	Project  project.ID      `json:"project"`
	Symbol   SymbolReference `json:"symbol"`
	Location NodeHandle      `json:"location"`
}

GetTypeOfSymbolAtLocationParams returns the narrowed type of a symbol at a specific location.

type GetTypeOfSymbolParams

type GetTypeOfSymbolParams struct {
	Snapshot SnapshotID      `json:"snapshot"`
	Project  project.ID      `json:"project"`
	Symbol   SymbolReference `json:"symbol"`
}

type GetTypePropertyParams

type GetTypePropertyParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  project.ID `json:"project"`
	Type     TypeID     `json:"objectId"`
}

GetTypePropertyParams is used for all type sub-property endpoints.

type GetTypesAtPositionsParams

type GetTypesAtPositionsParams struct {
	Snapshot  SnapshotID         `json:"snapshot"`
	Project   project.ID         `json:"project"`
	File      DocumentIdentifier `json:"file"`
	Positions []uint32           `json:"positions"`
}

type GetTypesOfSymbolsParams

type GetTypesOfSymbolsParams struct {
	Snapshot SnapshotID        `json:"snapshot"`
	Project  project.ID        `json:"project"`
	Symbols  []SymbolReference `json:"symbols"`
}

type GetWidenedTypeParams

type GetWidenedTypeParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  project.ID `json:"project"`
	Type     TypeID     `json:"type"`
}

GetWidenedTypeParams are the parameters for the getWidenedType method.

type ImportAdderAction

type ImportAdderAction struct {
	Kind                   ImportAdderActionKind `json:"kind"`
	Symbol                 *SymbolReference      `json:"symbol,omitempty"`
	IsValidTypeOnlyUseSite *bool                 `json:"isValidTypeOnlyUseSite,omitempty"`
}

type ImportAdderActionKind

type ImportAdderActionKind string
const (
	ImportAdderActionKindImportSymbol ImportAdderActionKind = "importSymbol"
)

type IndexInfoResponse

type IndexInfoResponse struct {
	KeyType     TypeResponse `json:"keyType"`
	ValueType   TypeResponse `json:"valueType"`
	IsReadonly  bool         `json:"isReadonly,omitempty"`
	Declaration NodeHandle   `json:"declaration,omitempty"`
}

IndexInfoResponse represents a single index signature.

type InitializeResponse

type InitializeResponse struct {
	// CaseSensitivity determines how the host file system compares paths.
	CaseSensitivity tspath.CaseSensitivity `json:"caseSensitivity"`
	// CurrentDirectory is the server's current working directory.
	CurrentDirectory tspath.RootedDirectoryPath `json:"currentDirectory"`
}

InitializeResponse is returned by the initialize method.

type IsArrayLikeTypeParams

type IsArrayLikeTypeParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  project.ID `json:"project"`
	Type     TypeID     `json:"type"`
}

IsArrayLikeTypeParams checks whether a type is array-like.

type IsTypeAssignableToParams

type IsTypeAssignableToParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  project.ID `json:"project"`
	Source   TypeID     `json:"source"`
	Target   TypeID     `json:"target"`
}

IsTypeAssignableToParams checks assignability between two types.

type JSDocTagInfo

type JSDocTagInfo struct {
	Name string `json:"name"`
	Text string `json:"text,omitempty"`
}

JSDocTagInfo is a single JSDoc tag, mirroring Strada's JSDocTagInfo but with the tag text rendered as a plain string rather than SymbolDisplayPart[].

type LanguageServerSnapshotChanges

type LanguageServerSnapshotChanges struct {
	SnapshotRequestChangesParams
}

LanguageServerSnapshotChanges describes API-driven changes to adopt into the language server's canonical state.

type MessagePackProtocol

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

MessagePackProtocol implements the Protocol interface using a custom msgpack-based tuple format: [MessageType, method, payload].

func NewMessagePackProtocol

func NewMessagePackProtocol(rw io.ReadWriter) *MessagePackProtocol

NewMessagePackProtocol creates a new msgpack protocol handler.

func (*MessagePackProtocol) ReadMessage

func (p *MessagePackProtocol) ReadMessage() (*ipc.Message, error)

ReadMessage implements Protocol.

func (*MessagePackProtocol) WriteError

func (p *MessagePackProtocol) WriteError(id *jsonrpc.ID, respErr *jsonrpc.ResponseError) error

WriteError implements Protocol.

func (*MessagePackProtocol) WriteNotification

func (p *MessagePackProtocol) WriteNotification(method string, params any) error

WriteNotification implements Protocol.

func (*MessagePackProtocol) WriteRequest

func (p *MessagePackProtocol) WriteRequest(id *jsonrpc.ID, method string, params any) error

WriteRequest implements Protocol.

func (*MessagePackProtocol) WriteResponse

func (p *MessagePackProtocol) WriteResponse(id *jsonrpc.ID, result any) error

WriteResponse implements Protocol.

type MessageType

type MessageType uint8

MessageType represents the type of message in the msgpack protocol.

const (
	MessageTypeUnknown MessageType = iota
	MessageTypeRequest
	MessageTypeCallResponse
	MessageTypeCallError
	MessageTypeResponse
	MessageTypeError
	MessageTypeCall
)

func (MessageType) IsValid

func (m MessageType) IsValid() bool

func (MessageType) String

func (i MessageType) String() string

type Method

type Method string
const (
	MethodRelease                Method = "release"
	MethodReleaseSourceFile      Method = "releaseSourceFile"
	MethodRetainSourceFile       Method = "retainSourceFile"
	MethodGetCachedSourceFile    Method = "getCachedSourceFile"
	MethodGetSymbolOfDeclaration Method = "getSymbolOfDeclaration"

	MethodBatchRequests                                  Method = "batchRequests"
	MethodInitialize                                     Method = "initialize"
	MethodCreateSnapshot                                 Method = "createSnapshot"
	MethodUpdateSnapshot                                 Method = "updateSnapshot"
	MethodGetCurrentLanguageServerSnapshot               Method = "getCurrentLanguageServerSnapshot"
	MethodCreateBuildOrchestrator                        Method = "createBuildOrchestrator"
	MethodDisposeBuildOrchestrator                       Method = "disposeBuildOrchestrator"
	MethodBuild                                          Method = "build"
	MethodBuildReferences                                Method = "buildReferences"
	MethodCleanBuild                                     Method = "cleanBuild"
	MethodCleanReferences                                Method = "cleanReferences"
	MethodCreateModuleResolver                           Method = "createModuleResolver"
	MethodReleaseModuleResolver                          Method = "releaseModuleResolver"
	MethodResolveModuleName                              Method = "resolveModuleName"
	MethodParseCommandLine                               Method = "parseCommandLine"
	MethodReadConfigFile                                 Method = "readConfigFile"
	MethodParseJsonConfigFile                            Method = "parseJsonConfigFileContent"
	MethodParseConfigFile                                Method = "parseConfigFile"
	MethodCreateSourceFile                               Method = "createSourceFile"
	MethodCreateSourceFileFromFile                       Method = "createSourceFileFromFile"
	MethodTranspileModule                                Method = "transpileModule"
	MethodTranspileModuleFromFile                        Method = "transpileModuleFromFile"
	MethodTranspileDeclaration                           Method = "transpileDeclaration"
	MethodTranspileDeclarationFromFile                   Method = "transpileDeclarationFromFile"
	MethodGetDefaultProjectForFile                       Method = "getDefaultProjectForFile"
	MethodGetSymbolAtPosition                            Method = "getSymbolAtPosition"
	MethodGetSymbolsAtPositions                          Method = "getSymbolsAtPositions"
	MethodGetSymbolAtLocation                            Method = "getSymbolAtLocation"
	MethodGetSymbolsAtLocations                          Method = "getSymbolsAtLocations"
	MethodGetSymbolOfSourceFile                          Method = "getSymbolOfSourceFile"
	MethodGetSymbolsOfSourceFiles                        Method = "getSymbolsOfSourceFiles"
	MethodGetTypeOfSymbol                                Method = "getTypeOfSymbol"
	MethodGetTypesOfSymbols                              Method = "getTypesOfSymbols"
	MethodGetDeclaredTypeOfSymbol                        Method = "getDeclaredTypeOfSymbol"
	MethodGetNonMissingTypeOfSymbol                      Method = "getNonMissingTypeOfSymbol"
	MethodGetSourceFile                                  Method = "getSourceFile"
	MethodGetSourceFileNames                             Method = "getSourceFileNames"
	MethodGetSourceFileMetadata                          Method = "getSourceFileMetadata"
	MethodGetModeForUsageLocation                        Method = "getModeForUsageLocation"
	MethodGetModeForResolutionAtIndex                    Method = "getModeForResolutionAtIndex"
	MethodGetResolvedModule                              Method = "getResolvedModule"
	MethodGetResolvedModuleFromModuleSpecifier           Method = "getResolvedModuleFromModuleSpecifier"
	MethodGetResolvedTypeReferenceDirective              Method = "getResolvedTypeReferenceDirective"
	MethodGetResolvedTypeReferenceDirectiveFromReference Method = "getResolvedTypeReferenceDirectiveFromTypeReferenceDirective"
	MethodGetConfigFileNames                             Method = "getConfigFileNames"
	MethodGetConfigSourceFile                            Method = "getConfigSourceFile"
	MethodResolveName                                    Method = "resolveName"
	MethodGetSymbolsInScope                              Method = "getSymbolsInScope"
	MethodGetSignaturesOfType                            Method = "getSignaturesOfType"
	MethodGetResolvedSignature                           Method = "getResolvedSignature"
	MethodGetTypeAtLocation                              Method = "getTypeAtLocation"
	MethodGetTypeAtLocations                             Method = "getTypeAtLocations"
	MethodGetTypeAtPosition                              Method = "getTypeAtPosition"
	MethodGetTypesAtPositions                            Method = "getTypesAtPositions"

	// Symbol sub-property methods
	MethodGetParentOfSymbol       Method = "getParentOfSymbol"
	MethodGetMembersOfSymbol      Method = "getMembersOfSymbol"
	MethodGetExportsOfSymbol      Method = "getExportsOfSymbol"
	MethodGetExportSymbolOfSymbol Method = "getExportSymbolOfSymbol"

	// Type sub-property methods
	MethodGetSymbolOfType               Method = "getSymbolOfType"
	MethodGetTargetOfType               Method = "getTargetOfType"
	MethodGetFreshTypeOfType            Method = "getFreshTypeOfType"
	MethodGetRegularTypeOfType          Method = "getRegularTypeOfType"
	MethodGetTypesOfType                Method = "getTypesOfType"
	MethodGetTypeParametersOfType       Method = "getTypeParametersOfType"
	MethodGetOuterTypeParametersOfType  Method = "getOuterTypeParametersOfType"
	MethodGetLocalTypeParametersOfType  Method = "getLocalTypeParametersOfType"
	MethodGetThisTypeOfType             Method = "getThisTypeOfType"
	MethodGetAliasTypeArgumentsOfType   Method = "getAliasTypeArgumentsOfType"
	MethodGetAliasSymbolOfType          Method = "getAliasSymbolOfType"
	MethodGetObjectTypeOfType           Method = "getObjectTypeOfType"
	MethodGetIndexTypeOfType            Method = "getIndexTypeOfType"
	MethodGetCheckTypeOfType            Method = "getCheckTypeOfType"
	MethodGetExtendsTypeOfType          Method = "getExtendsTypeOfType"
	MethodGetBaseTypeOfType             Method = "getBaseTypeOfType"
	MethodGetConstraintOfType           Method = "getConstraintOfType"
	MethodGetTypeParameterOfMappedType  Method = "getTypeParameterOfMappedType"
	MethodGetConstraintTypeOfMappedType Method = "getConstraintTypeOfMappedType"
	MethodGetNameTypeOfMappedType       Method = "getNameTypeOfMappedType"
	MethodGetTemplateTypeOfMappedType   Method = "getTemplateTypeOfMappedType"

	// Signature sub-property methods
	MethodGetTypeParametersOfSignature Method = "getTypeParametersOfSignature"
	MethodGetParametersOfSignature     Method = "getParametersOfSignature"
	MethodGetThisParameterOfSignature  Method = "getThisParameterOfSignature"
	MethodGetTargetOfSignature         Method = "getTargetOfSignature"

	// Checker methods
	MethodGetContextualType                 Method = "getContextualType"
	MethodGetContextualTypeForArgument      Method = "getContextualTypeForArgument"
	MethodGetAwaitedType                    Method = "getAwaitedType"
	MethodGetBaseTypeOfLiteralType          Method = "getBaseTypeOfLiteralType"
	MethodGetNonNullableType                Method = "getNonNullableType"
	MethodGetTypeFromTypeNode               Method = "getTypeFromTypeNode"
	MethodGetWidenedType                    Method = "getWidenedType"
	MethodGetParameterType                  Method = "getParameterType"
	MethodGetTypeParameterAtPosition        Method = "getTypeParameterAtPosition"
	MethodIsArrayLikeType                   Method = "isArrayLikeType"
	MethodIsTypeAssignableTo                Method = "isTypeAssignableTo"
	MethodGetShorthandAssignmentValueSymbol Method = "getShorthandAssignmentValueSymbol"
	MethodGetTypeOfSymbolAtLocation         Method = "getTypeOfSymbolAtLocation"
	MethodTypeToTypeNode                    Method = "typeToTypeNode"
	MethodSignatureToSignatureDeclaration   Method = "signatureToSignatureDeclaration"
	MethodTypeToString                      Method = "typeToString"
	MethodIsContextSensitive                Method = "isContextSensitive"
	MethodGetReturnTypeOfSignature          Method = "getReturnTypeOfSignature"
	MethodGetRestTypeOfSignature            Method = "getRestTypeOfSignature"
	MethodGetTypePredicateOfSignature       Method = "getTypePredicateOfSignature"
	MethodGetBaseTypes                      Method = "getBaseTypes"
	MethodGetPropertiesOfType               Method = "getPropertiesOfType"
	MethodGetApparentPropertiesOfType       Method = "getApparentPropertiesOfType"
	MethodGetApparentType                   Method = "getApparentType"
	MethodGetReducedType                    Method = "getReducedType"
	MethodGetPropertyOfType                 Method = "getPropertyOfType"
	MethodGetTypeOfPropertyOfType           Method = "getTypeOfPropertyOfType"
	MethodGetIndexInfoOfType                Method = "getIndexInfoOfType"
	MethodGetIndexInfosOfType               Method = "getIndexInfosOfType"
	MethodGetConstraintOfTypeParameter      Method = "getConstraintOfTypeParameter"
	MethodGetDefaultFromTypeParameter       Method = "getDefaultFromTypeParameter"
	MethodGetBaseConstraintOfType           Method = "getBaseConstraintOfType"
	MethodGetTypeArguments                  Method = "getTypeArguments"
	MethodGetImportAdderEdits               Method = "getImportAdderEdits"
	MethodGetTrueTypeOfConditionalType      Method = "getTrueTypeOfConditionalType"
	MethodGetFalseTypeOfConditionalType     Method = "getFalseTypeOfConditionalType"
	MethodGetConstantValue                  Method = "getConstantValue"
	MethodGetSignatureFromDeclaration       Method = "getSignatureFromDeclaration"
	MethodGetExportSpecifierLocalTarget     Method = "getExportSpecifierLocalTargetSymbol"
	MethodGetAliasedSymbol                  Method = "getAliasedSymbol"
	MethodGetImmediateAliasedSymbol         Method = "getImmediateAliasedSymbol"
	MethodGetTargetSymbol                   Method = "getTargetSymbol"
	MethodGetMergedSymbol                   Method = "getMergedSymbol"
	MethodGetSymbolOfNode                   Method = "getSymbolOfNode"
	MethodGetSymbolOfDeclarationForChecker  Method = "getSymbolOfDeclarationForChecker"
	MethodGetParentOfSymbolForChecker       Method = "getParentOfSymbolForChecker"
	MethodGetExportSymbolOfSymbolForChecker Method = "getExportSymbolOfSymbolForChecker"
	MethodGetFullyQualifiedName             Method = "getFullyQualifiedName"
	MethodGetExportsOfModule                Method = "getExportsOfModule"
	MethodGetMemberInModuleExports          Method = "getMemberInModuleExports"
	MethodGetJSDocTags                      Method = "getJsDocTags"
	MethodGetDocumentationComment           Method = "getDocumentationComment"
	MethodIsArrayType                       Method = "isArrayType"
	MethodIsReadonlySymbol                  Method = "isReadonlySymbol"

	// Reference methods
	MethodGetReferencesToSymbolInFile Method = "getReferencesToSymbolInFile"
	MethodGetReferencedSymbolsForNode Method = "getReferencedSymbolsForNode"
	MethodGetSignatureUsages          Method = "getSignatureUsages"

	// Language service methods
	MethodGetCompletionsAtPosition Method = "getCompletionsAtPosition"
	MethodFormatNodeForInsertion   Method = "formatNodeForInsertion"

	// Diagnostic methods
	MethodGetSyntacticDiagnostics         Method = "getSyntacticDiagnostics"
	MethodGetBindDiagnostics              Method = "getBindDiagnostics"
	MethodGetSemanticDiagnostics          Method = "getSemanticDiagnostics"
	MethodGetSuggestionDiagnostics        Method = "getSuggestionDiagnostics"
	MethodGetDeclarationDiagnostics       Method = "getDeclarationDiagnostics"
	MethodGetProgramDiagnostics           Method = "getProgramDiagnostics"
	MethodGetGlobalDiagnostics            Method = "getGlobalDiagnostics"
	MethodGetConfigFileParsingDiagnostics Method = "getConfigFileParsingDiagnostics"
	// Printer methods
	MethodPrintNode          Method = "printNode"
	MethodEmit               Method = "emit"
	MethodEmitToString       Method = "emitToString"
	MethodGetJavaScriptEmit  Method = "getJavaScriptEmit"
	MethodGetDeclarationEmit Method = "getDeclarationEmit"

	// Intrinsic type getters
	MethodGetAnyType          Method = "getAnyType"
	MethodGetStringType       Method = "getStringType"
	MethodGetNumberType       Method = "getNumberType"
	MethodGetBooleanType      Method = "getBooleanType"
	MethodGetVoidType         Method = "getVoidType"
	MethodGetUndefinedType    Method = "getUndefinedType"
	MethodGetNullType         Method = "getNullType"
	MethodGetNeverType        Method = "getNeverType"
	MethodGetUnknownType      Method = "getUnknownType"
	MethodGetBigIntType       Method = "getBigIntType"
	MethodGetESSymbolType     Method = "getESSymbolType"
	MethodGetNonPrimitiveType Method = "getNonPrimitiveType"

	// Well-known per-checker symbols
	MethodGetWellKnownSymbols Method = "getWellKnownSymbols"

	// Well-known per-checker signatures
	MethodGetWellKnownSignatures Method = "getWellKnownSignatures"

	// Profiling methods
	MethodStartCPUProfile Method = "startCPUProfile"
	MethodStopCPUProfile  Method = "stopCPUProfile"
	MethodSaveHeapProfile Method = "saveHeapProfile"
)

type ModuleResolutionEntry

type ModuleResolutionEntry struct {
	ModuleName          string                  `json:"moduleName"`
	ContainingDirectory *DocumentIdentifier     `json:"containingDirectory,omitempty"`
	ResolutionMode      *ResolutionMode         `json:"resolutionMode,omitempty"`
	Result              *StaticModuleResolution `json:"result" nonnil:"true"`
}

type ModuleResolutionFallback

type ModuleResolutionFallback string
const (
	ModuleResolutionFallbackResolve    ModuleResolutionFallback = "resolve"
	ModuleResolutionFallbackUnresolved ModuleResolutionFallback = "unresolved"
)

type ModuleResolutionSpec

type ModuleResolutionSpec struct {
	Fallback ModuleResolutionFallback `json:"fallback"`
	Entries  []*ModuleResolutionEntry `json:"entries" nonnil:"true"`
}

type ModuleResolverID

type ModuleResolverID uint64

type NodeHandle

type NodeHandle string

type OpenedFileOperationResult

type OpenedFileOperationResult struct {
	Project project.ID `json:"project"`
}

type PackageId

type PackageId struct {
	Name             string `json:"name"`
	SubModuleName    string `json:"subModuleName"`
	Version          string `json:"version"`
	PeerDependencies string `json:"peerDependencies"`
}

func NewPackageId

func NewPackageId(packageID module.PackageId) *PackageId

type ParseCommandLineParams

type ParseCommandLineParams struct {
	CommandLine []string `json:"commandLine"`
}

type ParseConfigFileParams

type ParseConfigFileParams struct {
	File DocumentIdentifier `json:"file"`
}

type ParseJsonConfigFileContentParams

type ParseJsonConfigFileContentParams struct {
	JSON            packagejson.JSONValue `json:"json"`
	ConfigDirectory *string               `json:"configDirectory,omitempty"`
	ConfigFileName  *DocumentIdentifier   `json:"configFileName,omitempty"`
}

type PrintNodeParams

type PrintNodeParams struct {
	Data                          string `json:"data"` // base64-encoded binary AST data
	PreserveSourceNewlines        bool   `json:"preserveSourceNewlines,omitempty"`
	NeverAsciiEscape              bool   `json:"neverAsciiEscape,omitempty"`
	TerminateUnterminatedLiterals bool   `json:"terminateUnterminatedLiterals,omitempty"`
}

PrintNodeParams are the parameters for the printNode method.

type ProfileParams

type ProfileParams struct {
	Dir string `json:"dir"`
}

type ProfileResult

type ProfileResult struct {
	File tspath.RootedFilePath `json:"file"`
}

type ProjectFileChanges

type ProjectFileChanges struct {
	// ChangedFiles lists source file paths whose content differs.
	ChangedFiles []tspath.PathKey `json:"changedFiles,omitempty"`
	// DeletedFiles lists source file paths removed from the project's program.
	DeletedFiles []tspath.PathKey `json:"deletedFiles,omitempty"`
}

ProjectFileChanges describes what source files changed within a single project.

type ProjectResponse

type ProjectResponse struct {
	Id                project.ID                 `json:"id"`
	ConfigFileName    *tspath.RootedFilePath     `json:"configFileName,omitempty"`
	CurrentDirectory  tspath.RootedDirectoryPath `json:"currentDirectory"`
	Dirty             bool                       `json:"dirty"`
	ParsedCommandLine *ConfigFileResponse        `json:"parsedCommandLine" nonnil:"true"`
}

func NewProjectResponse

func NewProjectResponse(p *project.Project) *ProjectResponse

type RawBinary

type RawBinary []byte

RawBinary is a marker type for binary data that should be written directly by MessagePackProtocol instead of being JSON-encoded.

type ReadConfigFileParams

type ReadConfigFileParams struct {
	File DocumentIdentifier `json:"file"`
}

type ReadConfigFileResponse

type ReadConfigFileResponse struct {
	Config any                 `json:"config"`
	Error  *DiagnosticResponse `json:"error,omitempty"`
}

type ReconfigureSnapshotProgramParams

type ReconfigureSnapshotProgramParams struct {
	Id                   project.SyntheticProjectID    `json:"id"`
	RootFiles            []DocumentIdentifier          `json:"rootFiles"`
	CompilerOptions      core.CompilerOptions          `json:"-"`
	CompilerOptionsInput *tsoptions.RawCompilerOptions `json:"compilerOptions" nonnil:"true"`
	Options              *CreateProgramOptions         `json:"options,omitempty"`
}

type ReferencedSymbolEntry

type ReferencedSymbolEntry struct {
	Definition NodeHandle      `json:"definition"`
	Symbol     *SymbolResponse `json:"symbol,omitempty"`
	References []NodeHandle    `json:"references" nonnil:"true"`
}

ReferencedSymbolEntry represents a symbol definition and its references.

type ReleaseModuleResolverParams

type ReleaseModuleResolverParams struct {
	Resolver ModuleResolverID `json:"resolver"`
}

type ReleaseParams

type ReleaseParams struct {
	Snapshot SnapshotID `json:"snapshot"`
}

ReleaseParams are the parameters for the release method.

type ReleaseSourceFileParams

type ReleaseSourceFileParams struct {
	Lease SourceFileLeaseID `json:"lease"`
}

type ResolutionMode

type ResolutionMode core.ModuleKind

type ResolveModuleNameCallbackParams

type ResolveModuleNameCallbackParams struct {
	ModuleName          string          `json:"moduleName"`
	ContainingDirectory string          `json:"containingDirectory"`
	ResolutionMode      *ResolutionMode `json:"resolutionMode,omitempty"`
	Snapshot            *SnapshotID     `json:"snapshot,omitempty"`
	InProgressSnapshot  *uint64         `json:"inProgressSnapshot,omitempty"`
}

type ResolveModuleNameParams

type ResolveModuleNameParams struct {
	Snapshot            SnapshotID         `json:"snapshot,omitempty"`
	InProgressSnapshot  uint64             `json:"inProgressSnapshot,omitempty"`
	Resolver            ModuleResolverID   `json:"resolver"`
	ModuleName          string             `json:"moduleName"`
	ContainingDirectory DocumentIdentifier `json:"containingDirectory"`
	ResolutionMode      *ResolutionMode    `json:"resolutionMode,omitempty"`
}

type ResolveModuleNameResult

type ResolveModuleNameResult struct {
	ResolvedModule *ResolvedModule `json:"resolvedModule,omitempty"`
	// Trace is provided when compilerOptions.traceResolution is true.
	Trace []string `json:"trace,omitempty"`
}

type ResolveNameParams

type ResolveNameParams struct {
	Snapshot       SnapshotID          `json:"snapshot"`
	Project        project.ID          `json:"project"`
	Name           string              `json:"name"`
	Location       NodeHandle          `json:"location,omitempty"`       // Optional: node handle for location context
	File           *DocumentIdentifier `json:"file,omitempty"`           // Optional: file for location context (alternative to Location)
	Position       *uint32             `json:"position,omitempty"`       // Optional: position in file for location context (with File)
	Meaning        uint32              `json:"meaning"`                  // SymbolFlags for what kind of symbol to find
	ExcludeGlobals bool                `json:"excludeGlobals,omitempty"` // Whether to exclude global symbols
}

type ResolvedModule

type ResolvedModule struct {
	ResolvedFileName             string     `json:"resolvedFileName"`
	OriginalPath                 string     `json:"originalPath,omitempty"`
	Extension                    string     `json:"extension"`
	ResolvedUsingTsExtension     bool       `json:"resolvedUsingTsExtension,omitempty"`
	ResolvedUsingExtraExtensions bool       `json:"resolvedUsingExtraExtensions,omitempty"`
	PackageId                    *PackageId `json:"packageId,omitempty"`
	IsExternalLibraryImport      bool       `json:"isExternalLibraryImport,omitempty"`
	AlternateResult              string     `json:"alternateResult,omitempty"`
}

type ResolvedTypeReferenceDirective

type ResolvedTypeReferenceDirective struct {
	Primary                 bool       `json:"primary"`
	ResolvedFileName        string     `json:"resolvedFileName"`
	OriginalPath            string     `json:"originalPath,omitempty"`
	PackageId               *PackageId `json:"packageId,omitempty"`
	IsExternalLibraryImport bool       `json:"isExternalLibraryImport,omitempty"`
}

type RetainSourceFileParams

type RetainSourceFileParams struct {
	File SourceFileDescriptor `json:"file"`
}

type RetainSourceFileResponse

type RetainSourceFileResponse struct {
	Lease SourceFileLeaseID `json:"lease"`
}

type SelectedFilesEmitParams

type SelectedFilesEmitParams struct {
	Snapshot SnapshotID           `json:"snapshot"`
	Project  project.ID           `json:"project"`
	Files    []DocumentIdentifier `json:"files"`
}

type Session

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

Session represents an API session that provides programmatic access to TypeScript language services through the LSP server. It implements the Handler interface to process incoming API requests. The session supports multiple active snapshots, each with their own symbol and type registries for maintaining object identity.

func NewLSPSession

func NewLSPSession(projectSession *project.Session, options *SessionOptions) *Session

NewLSPSession creates a new API session with the given project session.

func NewStandaloneSession

func NewStandaloneSession(init *project.SessionInit, options *SessionOptions) *Session

NewStandaloneSession creates an API session with an independently owned snapshot host.

func (*Session) Close

func (s *Session) Close()

Close closes the session and releases all active snapshots, regardless of their ref counts.

func (*Session) DefaultLibraryPath

func (s *Session) DefaultLibraryPath() tspath.RootedDirectoryPath

func (*Session) FS

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

func (*Session) GetCurrentDirectory

func (s *Session) GetCurrentDirectory() tspath.RootedDirectoryPath

func (*Session) HandleNotification

func (s *Session) HandleNotification(ctx context.Context, method string, params json.Value) error

HandleNotification implements Handler.

func (*Session) HandleRequest

func (s *Session) HandleRequest(ctx context.Context, method string, params json.Value) (any, error)

HandleRequest implements Handler.

func (*Session) ID

func (s *Session) ID() string

ID returns the unique identifier for this session.

func (*Session) SetConnection

func (s *Session) SetConnection(conn ipc.Conn)

type SessionOptions

type SessionOptions struct {
	// UseBinaryResponses enables binary responses for msgpack protocol.
	UseBinaryResponses bool
}

SessionOptions configures an API session.

type SignatureID

type SignatureID uint64

func SignatureHandle

func SignatureHandle(sig *checker.Signature) SignatureID

type SignatureResponse

type SignatureResponse struct {
	Id             SignatureID              `json:"id"`
	Flags          uint32                   `json:"flags"`
	Declaration    NodeHandle               `json:"declaration,omitempty"`
	TypeParameters []TypeID                 `json:"typeParameters,omitempty"`
	Parameters     []CompactSymbolReference `json:"parameters,omitempty"`
	ThisParameter  *CompactSymbolReference  `json:"thisParameter,omitempty"`
	Target         SignatureID              `json:"target,omitzero"`
}

type SignatureToSignatureDeclarationParams

type SignatureToSignatureDeclarationParams struct {
	Snapshot  SnapshotID  `json:"snapshot"`
	Project   project.ID  `json:"project"`
	Signature SignatureID `json:"signature"`
	Kind      int32       `json:"kind"`
	Location  NodeHandle  `json:"location,omitempty"`
	Flags     int32       `json:"flags,omitempty"`
}

SignatureToSignatureDeclarationParams are the parameters for the signatureToSignatureDeclaration method.

type SignatureUsageResponse

type SignatureUsageResponse struct {
	Name NodeHandle `json:"name"`
	Call NodeHandle `json:"call,omitempty"`
}

SignatureUsageResponse represents a single usage of a signature as a name-call pair.

type SnapshotChanges

type SnapshotChanges struct {
	// ChangedProjects maps project handles to the file changes within that project.
	// Projects not listed here (and not in RemovedProjects) are unchanged.
	ChangedProjects map[project.ID]*ProjectFileChanges `json:"changedProjects,omitempty"`
	// RemovedProjects lists project handles that were present in the previous
	// snapshot but absent from the new one.
	RemovedProjects []project.ID `json:"removedProjects,omitempty"`
}

SnapshotChanges describes what changed between a response base and a new snapshot. Changes are reported per-project so clients can track cache refs at the (snapshot, project) level.

type SnapshotID

type SnapshotID uint64

type SnapshotOperationResponse

type SnapshotOperationResponse struct {
	CreatedPrograms *[]project.SyntheticProjectID `json:"createdPrograms,omitzero"`
	OpenedFiles     *[]*OpenedFileOperationResult `json:"openedFiles,omitzero"`
}

type SnapshotRequestChangesParams

type SnapshotRequestChangesParams struct {
	// OpenProjects lists tsconfig.json files to open/load in the new snapshot.
	OpenProjects []DocumentIdentifier `json:"openProjects,omitempty"`
	// CloseProjects lists tsconfig.json files to release in the new snapshot.
	// A project is only unloaded once every API client that opened it closes it.
	CloseProjects []DocumentIdentifier `json:"closeProjects,omitempty"`
	// OpenFiles lists files to open in the new snapshot, mirroring LSP's
	// textDocument/didOpen. For each file, ancestor directories are searched for a
	// tsconfig that contains it; if found, that configured project is loaded and
	// becomes the file's default project. Otherwise the file is loaded into the
	// inferred project (e.g. a node_modules d.ts not in any project's import graph).
	// If a file cannot be loaded into any project, the request fails.
	OpenFiles []DocumentIdentifier `json:"openFiles,omitempty"`
	// CloseFiles lists files to release in the new snapshot. A file is only fully
	// closed once every API client that opened it closes it.
	CloseFiles []DocumentIdentifier `json:"closeFiles,omitempty"`
	// CreatePrograms describes synthetic programs to create in the snapshot.
	CreatePrograms []*CreateSnapshotProgramParams `json:"createPrograms,omitempty"`
	// ReconfigurePrograms replaces the configuration of existing synthetic programs.
	ReconfigurePrograms []*ReconfigureSnapshotProgramParams `json:"reconfigurePrograms,omitempty"`
	// RemovePrograms lists synthetic project handles to remove from the snapshot.
	RemovePrograms []project.SyntheticProjectID `json:"removePrograms,omitempty"`
	// EnsurePrograms identifies projects whose programs should be updated if dirty,
	// or all contained projects when true.
	EnsurePrograms *EnsurePrograms `json:"ensurePrograms,omitempty"`
}

SnapshotRequestChangesParams describes project, file, and program changes to apply while creating or updating a snapshot.

type SourceFileDescriptor

type SourceFileDescriptor struct {
	FileName        tspath.RootedFilePath `json:"fileName"`
	Path            tspath.PathKey        `json:"path"`
	ContentHash     string                `json:"contentHash"`
	ParseOptionsKey string                `json:"parseOptionsKey"`
	ScriptKind      core.ScriptKind       `json:"scriptKind"`
	NodeID          string                `json:"nodeId"`
}

type SourceFileLeaseID

type SourceFileLeaseID uint64

type SourceFileMetadata

type SourceFileMetadata struct {
	IsDefaultLibrary      bool                       `json:"isDefaultLibrary"`
	IsFromExternalLibrary bool                       `json:"isFromExternalLibrary"`
	PackageJsonType       string                     `json:"packageJsonType"`
	PackageJsonDirectory  tspath.RootedDirectoryPath `json:"packageJsonDirectory"`
	ImpliedNodeFormat     core.ResolutionMode        `json:"impliedNodeFormat"`
}

SourceFileMetadata carries program-stored metadata about a single source file.

type SourceFileResponse

type SourceFileResponse struct {
	// Data is the base64-encoded binary AST data in the encoder's format.
	Data string `json:"data"`
}

SourceFileResponse contains the binary-encoded AST data for a source file. The Data field is base64-encoded binary data in the encoder's format.

type StaticModuleResolution

type StaticModuleResolution struct {
	ResolvedFileName *DocumentIdentifier `json:"resolvedFileName,omitempty"`
	OriginalPath     *DocumentIdentifier `json:"originalPath,omitempty"`
	PackageID        *PackageId          `json:"packageId,omitempty"`
}

type StdioServer

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

StdioServer runs an API session over STDIO using MessagePack protocol. This is the entry point for the synchronous STDIO-based API used by native TypeScript tooling integration.

func NewStdioServer

func NewStdioServer(options *StdioServerOptions) *StdioServer

NewStdioServer creates a new STDIO-based API server.

func (*StdioServer) Run

func (s *StdioServer) Run(ctx context.Context) error

Run starts the server and blocks until the connection closes.

type StdioServerOptions

type StdioServerOptions struct {
	In                 io.ReadCloser
	Out                io.WriteCloser
	Err                io.Writer
	Cwd                tspath.RootedDirectoryPath
	DefaultLibraryPath tspath.RootedDirectoryPath
	// PipePath, if set, is the named pipe path on Windows. On Unix, it must
	// not exist and is created as a private directory containing "socket".
	PipePath string
	// Callbacks specifies which filesystem operations should be delegated
	// to the client (e.g., "readFile", "fileExists"). Empty means no callbacks.
	Callbacks []string
	// UseCaseSensitiveFileNames overrides the base filesystem's case sensitivity.
	UseCaseSensitiveFileNames *bool
	// Async enables JSON-RPC protocol with async connection handling.
	// When false (default), uses MessagePack protocol with sync connection.
	Async bool
	// CollectTiming enables per-request server processing-time measurement.
	// When enabled, the server accumulates each request's processing time into
	// running totals and a recent-request ring buffer. Response messages are
	// left unchanged; the client folds this data into its own timing snapshot
	// on demand via getServerTiming / resetServerTiming requests.
	CollectTiming bool
	// RunExternalCode allows configured content mappers to execute.
	RunExternalCode      bool
	ContentMapperSpawner contentmapper.Spawner
}

StdioServerOptions configures the STDIO-based API server.

type SymbolID

type SymbolID uint64

func SymbolHandle

func SymbolHandle(symbol *ast.Symbol) SymbolID

type SymbolOwner

type SymbolOwner struct {
	Kind     SymbolOwnerKind       `json:"kind"`
	File     *SourceFileDescriptor `json:"file,omitempty"`
	Snapshot SnapshotID            `json:"snapshot,omitzero"`
	Project  project.ID            `json:"project,omitempty"`
}

type SymbolOwnerKind

type SymbolOwnerKind uint32
const (
	SymbolOwnerKindFile SymbolOwnerKind = iota
	SymbolOwnerKindSnapshot
)

type SymbolReference

type SymbolReference struct {
	SymbolOwner
	Id SymbolID `json:"id"`
}

SymbolReference identifies a symbol and its server-resolvable owner.

type SymbolResponse

type SymbolResponse struct {
	Reference        SymbolReference         `json:"reference"`
	Name             string                  `json:"name"`
	Flags            uint32                  `json:"flags"`
	CheckFlags       uint32                  `json:"checkFlags"`
	Declarations     []NodeHandle            `json:"declarations,omitempty"`
	ValueDeclaration NodeHandle              `json:"valueDeclaration,omitempty"`
	Parent           *CompactSymbolReference `json:"parent,omitempty"`
	ExportSymbol     *CompactSymbolReference `json:"exportSymbol,omitempty"`
}

type TextEdit

type TextEdit struct {
	Pos     int    `json:"pos"`
	End     int    `json:"end"`
	NewText string `json:"newText"`
}

type TranspileFromFileParams

type TranspileFromFileParams struct {
	FileName string           `json:"fileName"`
	Options  TranspileOptions `json:"options"`
}

type TranspileOptions

type TranspileOptions struct {
	CompilerOptions      *core.CompilerOptions         `json:"-"`
	CompilerOptionsInput *tsoptions.RawCompilerOptions `json:"compilerOptions,omitempty"`
	FileName             string                        `json:"fileName,omitempty"`
	ReportDiagnostics    bool                          `json:"reportDiagnostics,omitempty"`
}

type TranspileOutputResponse

type TranspileOutputResponse struct {
	OutputText    string                `json:"outputText"`
	Diagnostics   []*DiagnosticResponse `json:"diagnostics,omitempty"`
	SourceMapText string                `json:"sourceMapText,omitempty"`
}

type TranspileParams

type TranspileParams struct {
	Input   string           `json:"input"`
	Options TranspileOptions `json:"options"`
}

type TypeID

type TypeID uint32

func TypeHandle

func TypeHandle(t *checker.Type) TypeID

type TypePredicateResponse

type TypePredicateResponse struct {
	Kind           int32         `json:"kind"`
	ParameterIndex int32         `json:"parameterIndex"`
	ParameterName  string        `json:"parameterName,omitempty"`
	Type           *TypeResponse `json:"type,omitempty"`
}

TypePredicateResponse is the response for getTypePredicateOfSignature.

type TypeResponse

type TypeResponse struct {
	Id          TypeID `json:"id"`
	Flags       uint32 `json:"flags"`
	ObjectFlags uint32 `json:"objectFlags,omitempty"`
	IsTupleType bool   `json:"isTupleType,omitempty"`

	// Value is literal type data. BigInt literals are encoded as signed decimal
	// strings because JSON cannot represent bigint; absent values are null.
	Value any `json:"value"`

	// ObjectType / TypeReference / StringMappingType / IndexType target
	Target TypeID `json:"target,omitzero"`

	// InterfaceType type parameters
	TypeParameters      []TypeID `json:"typeParameters,omitempty"`
	OuterTypeParameters []TypeID `json:"outerTypeParameters,omitempty"`
	LocalTypeParameters []TypeID `json:"localTypeParameters,omitempty"`

	// TupleType data
	ElementFlags               []checker.ElementFlags `json:"elementFlags,omitempty"`
	FixedLength                *int                   `json:"fixedLength,omitempty"`
	TupleReadonly              *bool                  `json:"readonly,omitempty"`
	LabeledElementDeclarations []NodeHandle           `json:"labeledElementDeclarations,omitempty"`

	// IndexedAccessType data
	ObjectType TypeID `json:"objectType,omitzero"`
	IndexType  TypeID `json:"indexType,omitzero"`

	// ConditionalType data
	CheckType   TypeID `json:"checkType,omitzero"`
	ExtendsType TypeID `json:"extendsType,omitzero"`

	// SubstitutionType data
	BaseType        TypeID `json:"baseType,omitzero"`
	SubstConstraint TypeID `json:"substConstraint,omitzero"`

	// MappedType data
	TypeParameter  TypeID `json:"typeParameter,omitzero"`
	ConstraintType TypeID `json:"constraintType,omitzero"`
	NameType       TypeID `json:"nameType,omitzero"`
	TemplateType   TypeID `json:"templateType,omitzero"`

	// TemplateLiteralType text segments
	Texts []string `json:"texts,omitempty"`

	// FreshableType data (LiteralType and computed enum types)
	FreshType   TypeID `json:"freshType,omitzero"`
	RegularType TypeID `json:"regularType,omitzero"`

	// TypeParameter data
	IsThisType bool `json:"isThisType,omitempty"`

	// InterfaceType data
	ThisType TypeID `json:"thisType,omitzero"`

	// IntrinsicType data
	IntrinsicName string `json:"intrinsicName,omitempty"`

	// TypeAlias data
	AliasTypeArguments []TypeID                `json:"aliasTypeArguments,omitempty"`
	AliasSymbol        *CompactSymbolReference `json:"aliasSymbol,omitempty"`

	// Symbol associated with structured types
	Symbol *CompactSymbolReference `json:"symbol,omitempty"`
}

type TypeToTypeNodeParams

type TypeToTypeNodeParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  project.ID `json:"project"`
	Type     TypeID     `json:"type"`
	Location NodeHandle `json:"location,omitempty"`
	Flags    int32      `json:"flags,omitempty"`
}

TypeToTypeNodeParams are the parameters for the typeToTypeNode method.

type UpdateSnapshotParams

type UpdateSnapshotParams struct {
	Snapshot SnapshotID            `json:"snapshot"`
	Changes  *CreateSnapshotParams `json:"changes,omitempty"`
}

type WellKnownSignaturesResponse

type WellKnownSignaturesResponse struct {
	Unknown SignatureID `json:"unknown"`
}

WellKnownSignaturesResponse carries the handle id of the per-checker singleton unknown signature (the signature the checker yields when a call cannot be resolved) so the client can identify it by id without a round-trip on every check.

type WellKnownSymbolsResponse

type WellKnownSymbolsResponse struct {
	Unknown   SymbolID `json:"unknown"`
	Undefined SymbolID `json:"undefined"`
	Arguments SymbolID `json:"arguments"`
}

WellKnownSymbolsResponse carries the handle ids of the per-checker singleton symbols (unknown, undefined, arguments) so the client can identify them by id without a round-trip on every check.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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