api

package
v0.0.0-...-e00a6a3 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: Apache-2.0 Imports: 46 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 APIFileChangeSummary

type APIFileChangeSummary struct {
	Changed []DocumentIdentifier `json:"changed,omitempty"`
	Created []DocumentIdentifier `json:"created,omitempty"`
	Deleted []DocumentIdentifier `json:"deleted,omitempty"`
}

APIFileChangeSummary lists documents that have been changed, created, or deleted.

type APIFileChanges

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

APIFileChanges describes file changes to apply when updating a snapshot. Either InvalidateAll is true (discard all caches) or Changed/Created/Deleted list individual documents.

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 CheckerNodeParams

type CheckerNodeParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  ProjectID  `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   ProjectID   `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  ProjectID  `json:"project"`
	Symbol   SymbolID   `json:"symbol"`
}

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

type CheckerTypeParams

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

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

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         []string                 `json:"fileNames" nonnil:"true"`
	Options           *core.CompilerOptions    `json:"options" nonnil:"true"`
	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 CreateProgramOldProgramParams

type CreateProgramOldProgramParams struct {
	Snapshot SnapshotID `json:"snapshot,omitempty"`
	Project  ProjectID  `json:"project,omitempty"`
}

type CreateProgramOptions

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

type CreateProgramParams

type CreateProgramParams struct {
	RootFiles            []DocumentIdentifier           `json:"rootFiles"`
	CreateProgramOptions CreateProgramOptions           `json:"createProgramOptions"`
	OldProgram           *CreateProgramOldProgramParams `json:"oldProgram,omitempty"`
	FileChanges          *APIFileChanges                `json:"fileChanges,omitempty"`
}

type CreateProgramResponse

type CreateProgramResponse struct {
	Snapshot SnapshotID       `json:"snapshot"`
	Project  *ProjectResponse `json:"project"`
}

type DiagnosticPositionResponse

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

type DiagnosticResponse

type DiagnosticResponse struct {
	// FileName is the path of the file this diagnostic belongs to, if any.
	FileName string `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 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) ToAbsoluteFileName

func (d DocumentIdentifier) ToAbsoluteFileName(cwd string) string

func (DocumentIdentifier) ToFileName

func (d DocumentIdentifier) ToFileName() string

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       string  `json:"fileName"`
	Text           string  `json:"text"`
	SourceFileName *string `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  ProjectID  `json:"project"`
	EmitOnly *uint32    `json:"emitOnly,omitempty"`
}

type EmitResponse

type EmitResponse struct {
	EmitSkipped  bool                  `json:"emitSkipped"`
	Diagnostics  []*DiagnosticResponse `json:"diagnostics" nonnil:"true"`
	EmittedFiles []string              `json:"emittedFiles" nonnil:"true"`
}

type FormatNodeForInsertionParams

type FormatNodeForInsertionParams struct {
	Snapshot SnapshotID         `json:"snapshot"`
	Project  ProjectID          `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  ProjectID  `json:"project"`
	Type     TypeID     `json:"type"`
}

GetBaseTypeOfLiteralTypeParams returns the base type of a literal type.

type GetCompletionsAtPositionParams

type GetCompletionsAtPositionParams struct {
	Snapshot         SnapshotID         `json:"snapshot"`
	Project          ProjectID          `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 GetContextualTypeParams

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

GetContextualTypeParams returns the contextual type for a node.

type GetDefaultProjectForFileParams

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

type GetDiagnosticsParams

type GetDiagnosticsParams struct {
	Snapshot SnapshotID           `json:"snapshot"`
	Project  ProjectID            `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  ProjectID           `json:"project"`
	File     DocumentIdentifier  `json:"file"`
	Actions  []ImportAdderAction `json:"actions"`
}

type GetIntrinsicTypeParams

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

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

type GetMemberInModuleExportsParams

type GetMemberInModuleExportsParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  ProjectID  `json:"project"`
	Symbol   SymbolID   `json:"symbol"`
	Name     string     `json:"name"`
}

GetMemberInModuleExportsParams are parameters for getMemberInModuleExports.

type GetNonNullableTypeParams

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

GetNonNullableTypeParams are the parameters for the getNonNullableType method.

type GetParameterTypeParams

type GetParameterTypeParams struct {
	Snapshot  SnapshotID  `json:"snapshot"`
	Project   ProjectID   `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  ProjectID  `json:"project"`
}

GetProjectDiagnosticsParams are parameters for project-wide diagnostic methods.

type GetPropertyOfTypeParams

type GetPropertyOfTypeParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  ProjectID  `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  ProjectID  `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  ProjectID          `json:"project"`
	File     DocumentIdentifier `json:"file"`
	Symbol   SymbolID           `json:"symbol"`
}

GetReferencesToSymbolInFileParams are the parameters for the getReferencesToSymbolInFile method.

type GetResolvedSignatureParams

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

type GetSignaturePropertyParams

type GetSignaturePropertyParams struct {
	Snapshot  SnapshotID  `json:"snapshot"`
	Project   ProjectID   `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       ProjectID  `json:"project"`
	SignatureDecl NodeHandle `json:"signatureDecl"`
}

GetSignatureUsagesParams are the parameters for the getSignatureUsages method.

type GetSignaturesOfTypeParams

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

type GetSourceFileNamesParams

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

type GetSourceFileParams

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

type GetSymbolAtLocationParams

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

type GetSymbolAtPositionParams

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

type GetSymbolOfSourceFileParams

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

type GetSymbolPropertyParams

type GetSymbolPropertyParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  ProjectID  `json:"project"`
	Symbol   SymbolID   `json:"objectId"`
}

GetSymbolPropertyParams is used for all symbol sub-property endpoints.

type GetSymbolsAtLocationsParams

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

type GetSymbolsAtPositionsParams

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

type GetSymbolsInScopeParams

type GetSymbolsInScopeParams struct {
	Snapshot SnapshotID          `json:"snapshot"`
	Project  ProjectID           `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  ProjectID            `json:"project"`
	Files    []DocumentIdentifier `json:"files"`
}

type GetTypeAtLocationParams

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

type GetTypeAtLocationsParams

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

type GetTypeAtPositionParams

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

type GetTypeFromTypeNodeParams

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

GetTypeFromTypeNodeParams are the parameters for the getTypeFromTypeNode method.

type GetTypeOfSymbolAtLocationParams

type GetTypeOfSymbolAtLocationParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  ProjectID  `json:"project"`
	Symbol   SymbolID   `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  ProjectID  `json:"project"`
	Symbol   SymbolID   `json:"symbol"`
}

type GetTypePropertyParams

type GetTypePropertyParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  ProjectID  `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   ProjectID          `json:"project"`
	File      DocumentIdentifier `json:"file"`
	Positions []uint32           `json:"positions"`
}

type GetTypesOfSymbolsParams

type GetTypesOfSymbolsParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  ProjectID  `json:"project"`
	Symbols  []SymbolID `json:"symbols"`
}

type GetWidenedTypeParams

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

GetWidenedTypeParams are the parameters for the getWidenedType method.

type ImportAdderAction

type ImportAdderAction struct {
	Kind                   ImportAdderActionKind `json:"kind"`
	Symbol                 SymbolID              `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 {
	// UseCaseSensitiveFileNames indicates whether the host file system is case-sensitive.
	UseCaseSensitiveFileNames bool `json:"useCaseSensitiveFileNames"`
	// CurrentDirectory is the server's current working directory.
	CurrentDirectory string `json:"currentDirectory"`
}

InitializeResponse is returned by the initialize method.

type IsArrayLikeTypeParams

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

IsArrayLikeTypeParams checks whether a type is array-like.

type IsTypeAssignableToParams

type IsTypeAssignableToParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  ProjectID  `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 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"

	MethodBatchRequests Method = "batchRequests"

	MethodInitialize                   Method = "initialize"
	MethodUpdateSnapshot               Method = "updateSnapshot"
	MethodUpdateTemporarySnapshot      Method = "updateTemporarySnapshot"
	MethodCreateProgram                Method = "createProgram"
	MethodParseCommandLine             Method = "parseCommandLine"
	MethodReadConfigFile               Method = "readConfigFile"
	MethodParseJsonConfigFile          Method = "parseJsonConfigFileContent"
	MethodParseConfigFile              Method = "parseConfigFile"
	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"
	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"
	MethodGetAliasTypeArgumentsOfType  Method = "getAliasTypeArgumentsOfType"
	MethodGetAliasSymbolOfType         Method = "getAliasSymbolOfType"
	MethodGetObjectTypeOfType          Method = "getObjectTypeOfType"
	MethodGetIndexTypeOfType           Method = "getIndexTypeOfType"
	MethodGetCheckTypeOfType           Method = "getCheckTypeOfType"
	MethodGetExtendsTypeOfType         Method = "getExtendsTypeOfType"
	MethodGetBaseTypeOfType            Method = "getBaseTypeOfType"
	MethodGetConstraintOfType          Method = "getConstraintOfType"

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

	// Checker methods
	MethodGetContextualType                 Method = "getContextualType"
	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"
	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"
	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"

	// 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"
	// Emitter methods
	MethodPrintNode              Method = "printNode"
	MethodFormatNodeForInsertion Method = "formatNodeForInsertion"
	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 NodeHandle

type NodeHandle string

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 string `json:"file"`
}

type ProjectFileChanges

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

ProjectFileChanges describes what source files changed within a single project.

type ProjectID

type ProjectID string

func ProjectHandle

func ProjectHandle(p *project.Project) ProjectID

type ProjectResponse

type ProjectResponse struct {
	Id                ProjectID           `json:"id"`
	ConfigFileName    string              `json:"configFileName"`
	CurrentDirectory  string              `json:"currentDirectory"`
	ParsedCommandLine *ConfigFileResponse `json:"parsedCommandLine" nonnil:"true"`
	// Deprecated: Use parsedCommandLine.fileNames.
	RootFiles []string `json:"rootFiles" nonnil:"true"`
	// Deprecated: Use parsedCommandLine.options.
	CompilerOptions *core.CompilerOptions `json:"compilerOptions" 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 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 ReleaseParams

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

ReleaseParams are the parameters for the release method.

type ResolveNameParams

type ResolveNameParams struct {
	Snapshot       SnapshotID          `json:"snapshot"`
	Project        ProjectID           `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 SelectedFilesEmitParams

type SelectedFilesEmitParams struct {
	Snapshot SnapshotID           `json:"snapshot"`
	Project  ProjectID            `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) 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.

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     []SymbolID  `json:"parameters,omitempty"`
	ThisParameter  SymbolID    `json:"thisParameter,omitzero"`
	Target         SignatureID `json:"target,omitzero"`
}

type SignatureToSignatureDeclarationParams

type SignatureToSignatureDeclarationParams struct {
	Snapshot  SnapshotID  `json:"snapshot"`
	Project   ProjectID   `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[ProjectID]*ProjectFileChanges `json:"changedProjects,omitempty"`
	// RemovedProjects lists project handles that were present in the previous
	// snapshot but absent from the new one.
	RemovedProjects []ProjectID `json:"removedProjects,omitempty"`
}

SnapshotChanges describes what changed between the previous latest snapshot and the newly created snapshot. Changes are reported per-project so clients can track cache refs at the (snapshot, project) level.

type SnapshotID

type SnapshotID uint64

type SourceFileMetadata

type SourceFileMetadata struct {
	IsDefaultLibrary      bool                `json:"isDefaultLibrary"`
	IsFromExternalLibrary bool                `json:"isFromExternalLibrary"`
	PackageJsonType       string              `json:"packageJsonType"`
	PackageJsonDirectory  string              `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 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                string
	DefaultLibraryPath string
	// PipePath, if set, listens on a named pipe (Windows) or Unix domain
	// socket instead of using In/Out for communication.
	PipePath string
	// Callbacks specifies which filesystem operations should be delegated
	// to the client (e.g., "readFile", "fileExists"). Empty means no callbacks.
	Callbacks []string
	// 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 SymbolResponse

type SymbolResponse struct {
	Id SymbolID `json:"id"`
	// Project is the project in which the symbol was first observed. It is the
	// default project for follow-up lookups whose results can vary by project.
	Project          ProjectID    `json:"project"`
	Name             string       `json:"name"`
	Flags            uint32       `json:"flags"`
	CheckFlags       uint32       `json:"checkFlags"`
	Declarations     []NodeHandle `json:"declarations,omitempty"`
	ValueDeclaration NodeHandle   `json:"valueDeclaration,omitempty"`
	Parent           SymbolID     `json:"parent,omitzero"`
	ExportSymbol     SymbolID     `json:"exportSymbol,omitzero"`
}

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:"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"`

	// 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"`

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

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

	// Symbol associated with structured types
	Symbol SymbolID `json:"symbol,omitzero"`
}

type TypeToTypeNodeParams

type TypeToTypeNodeParams struct {
	Snapshot SnapshotID `json:"snapshot"`
	Project  ProjectID  `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 {
	// OpenProjects lists tsconfig.json files to open/load in the new snapshot.
	// Opens are ref-counted and persist across snapshots until closed.
	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"`
	// FileChanges describes file system changes since the last snapshot.
	FileChanges *APIFileChanges `json:"fileChanges,omitempty"`
	// OpenFiles lists files to keep open for the API client, 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).
	// Opens persist across snapshots until the file is closed.
	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"`
}

UpdateSnapshotParams are the parameters for creating a new snapshot. All fields are optional. With no fields set, the server adopts the latest LSP state.

type UpdateSnapshotResponse

type UpdateSnapshotResponse struct {
	// Snapshot is the handle for the newly created snapshot.
	Snapshot SnapshotID `json:"snapshot"`
	// Projects is the list of projects in the snapshot.
	Projects []*ProjectResponse `json:"projects" nonnil:"true"`
	// Changes describes source file differences from the previous snapshot.
	// Nil for the first snapshot in a session.
	Changes *SnapshotChanges `json:"changes,omitempty"`
}

UpdateSnapshotResponse is returned by updateSnapshot.

type UpdateTemporarySnapshotParams

type UpdateTemporarySnapshotParams struct {
	// Snapshot is the current client snapshot on which to layer the temporary update.
	Snapshot SnapshotID `json:"snapshot"`
	// File identifies the file whose content is temporarily overridden.
	File DocumentIdentifier `json:"file"`
	// NewText is the temporary content for the file.
	NewText string `json:"newText"`
}

UpdateTemporarySnapshotParams are the parameters for creating a temporary snapshot that overrides a single file's content.

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