Documentation
¶
Overview ¶
Package editor provides a pure, graph-aware language-service core for canonical .ortg topology source. It never reads or writes files, mounts a graph, or mixes node values into topology.
Index ¶
- Constants
- Variables
- func ApplyEdits(source []byte, editSet EditSet) ([]byte, error)
- type Completion
- type CompletionKind
- type CompletionList
- type ConfigContract
- type ConfigSchemaStatus
- type Cursor
- type Definition
- type DefinitionList
- type Diagnostic
- type DiagnosticReport
- type Document
- func (document *Document) Canonical() bool
- func (document *Document) CatalogMetadata() MetadataReport
- func (document *Document) Complete(cursor Cursor) (CompletionList, error)
- func (document *Document) CompleteElements(cursor Cursor) (CompletionList, error)
- func (document *Document) CompleteNodes(cursor Cursor) (CompletionList, error)
- func (document *Document) CompletePorts(cursor Cursor) (CompletionList, error)
- func (document *Document) CreateEdgeID(edgeID string, from, to syntax.Endpoint, delivery syntax.Delivery) (EditSet, error)
- func (document *Document) Cursor(offset int) (Cursor, error)
- func (document *Document) Definitions(cursor Cursor) (DefinitionList, error)
- func (document *Document) Diagnostics() DiagnosticReport
- func (document *Document) ElementCompletions(cursor Cursor, prefix string) (CompletionList, error)
- func (document *Document) FormatEdits() (EditSet, error)
- func (document *Document) Hover(cursor Cursor) (Hover, error)
- func (document *Document) LSPCompletions(position LSPPosition) (LSPCompletionList, error)
- func (document *Document) LSPConfigurationHover(position LSPPosition) (LSPHover, error)
- func (document *Document) LSPDefinitions(position LSPPosition, identity LSPDocumentIdentity) ([]LSPLocationLink, error)
- func (document *Document) LSPDiagnostics() (LSPFullDocumentDiagnosticReport, error)
- func (document *Document) LSPFormatting(identity LSPDocumentIdentity) (LSPWorkspaceEdit, error)
- func (document *Document) LSPRename(position LSPPosition, newName string, identity LSPDocumentIdentity) (LSPWorkspaceEdit, error)
- func (document *Document) LSPVirtualDescriptorDocument(elementName string) (LSPVirtualDocument, error)
- func (document *Document) NodeCompletions(cursor Cursor, prefix, port string, direction element.Direction) (CompletionList, error)
- func (document *Document) Parsed() bool
- func (document *Document) Path() string
- func (document *Document) PortCompletions(cursor Cursor, node, prefix string, direction element.Direction) (CompletionList, error)
- func (document *Document) Recovered() bool
- func (document *Document) RemoveEdgeID(edgeID string) (EditSet, error)
- func (document *Document) RenameNode(cursor Cursor, newName string) (EditSet, error)
- func (document *Document) RenameNodeID(node, newName string) (EditSet, error)
- func (document *Document) Source() []byte
- func (document *Document) SourceDigest() string
- func (document *Document) ValidateCursor(cursor Cursor) error
- type EditSet
- type ElementMetadata
- type Hover
- type LSPAdapter
- type LSPAdapterLimits
- type LSPAdapterOptions
- type LSPCompletionData
- type LSPCompletionItem
- type LSPCompletionItemKind
- type LSPCompletionList
- type LSPDiagnostic
- type LSPDiagnosticData
- type LSPDiagnosticSeverity
- type LSPDocumentIdentity
- type LSPFullDocumentDiagnosticReport
- type LSPHover
- type LSPLocationLink
- type LSPMarkupContent
- type LSPPosition
- type LSPRange
- type LSPTextDocumentEdit
- type LSPTextEdit
- type LSPVersionedTextDocumentIdentifier
- type LSPVirtualDocument
- type LSPWorkspaceEdit
- type Limits
- type MetadataReport
- type NodeConfigContract
- type NormalizedDocument
- func (document *NormalizedDocument) CreateEdgeID(edgeID string, from, to syntax.Endpoint, delivery syntax.Delivery) (EditSet, error)
- func (document *NormalizedDocument) Path() string
- func (document *NormalizedDocument) RemoveEdgeID(edgeID string) (EditSet, error)
- func (document *NormalizedDocument) RenameNodeID(oldName, newName string) (EditSet, error)
- func (document *NormalizedDocument) Source() []byte
- func (document *NormalizedDocument) SourceDigest() string
- type Options
- type PortMetadata
- type ReactionMetadata
- type Severity
- type SymbolKind
- type TextEdit
- type ValuesPropertyMetadata
- type WorkspaceDefinition
- type WorkspaceDefinitionKind
- type WorkspaceDocument
- type WorkspaceIndex
- type WorkspaceLimits
Constants ¶
const LSPDocumentLanguageID = "openrealtime-ortg"
Variables ¶
var ( ErrLSPDisposed = errors.New("LSP adapter is disposed") ErrLSPNotInitialized = errors.New("LSP adapter is not initialized") ErrLSPDocumentOpen = errors.New("LSP document is already open") ErrLSPDocumentMissing = errors.New("LSP document is not open") ErrLSPVersion = errors.New("LSP document version is stale") )
var ( ErrStalePosition = errors.New("editor position belongs to another source revision") ErrInvalidPosition = errors.New("editor position is invalid") ErrNoCompletionContext = errors.New("position has no completion context") ErrNoSymbol = errors.New("position does not name a graph symbol") ErrDefinitionMissing = errors.New("symbol has no resolvable definition") ErrInvalidRename = errors.New("invalid graph node rename") ErrRenameCollision = errors.New("graph node rename collides with an existing node") ErrEditLimit = errors.New("graph node rename exceeds the edit bound") ErrInvalidEdgeMutation = errors.New("invalid graph edge mutation") ErrPresentationLimit = errors.New("editor presentation exceeds its byte bound") )
Functions ¶
Types ¶
type Completion ¶
type Completion struct {
Kind CompletionKind `json:"kind"`
Label string `json:"label"`
InsertText string `json:"insert_text"`
Detail string `json:"detail,omitempty"`
Replacement syntax.Span `json:"replacement"`
Element string `json:"element,omitempty"`
Node string `json:"node,omitempty"`
Port string `json:"port,omitempty"`
Type string `json:"type,omitempty"`
}
type CompletionKind ¶
type CompletionKind string
const ( CompletionElement CompletionKind = "element" CompletionNode CompletionKind = "node" CompletionPort CompletionKind = "port" )
type CompletionList ¶
type CompletionList struct {
Items []Completion `json:"items"`
Total int `json:"total"`
Incomplete bool `json:"incomplete,omitempty"`
}
type ConfigContract ¶
type ConfigContract struct {
Artifact string `json:"artifact"`
Resolved bool `json:"resolved"`
SchemaReference string `json:"schema_reference,omitempty"`
InlineTopologyValues bool `json:"inline_topology_values"`
EmptyObjectOnly bool `json:"empty_object_only"`
SchemaStatus ConfigSchemaStatus `json:"schema_status"`
SchemaID string `json:"schema_id,omitempty"`
SchemaDigest string `json:"schema_digest,omitempty"`
PropertiesComplete bool `json:"properties_complete"`
Properties []ValuesPropertyMetadata `json:"properties"`
AdditionalProperties json.RawMessage `json:"additional_properties,omitempty"`
}
ConfigContract makes the topology/values boundary explicit. A descriptor supplies a schema reference, not inline .ortg configuration fields.
type ConfigSchemaStatus ¶
type ConfigSchemaStatus string
const ( ConfigSchemaEmpty ConfigSchemaStatus = "empty-object-only" ConfigSchemaUnresolved ConfigSchemaStatus = "unresolved" ConfigSchemaResolved ConfigSchemaStatus = "resolved" ConfigSchemaInvalid ConfigSchemaStatus = "invalid" )
type Cursor ¶
type Cursor struct {
SourceDigest string `json:"source_digest"`
Position syntax.Position `json:"position"`
}
Cursor binds a source position to the exact immutable source digest from which it was computed. Query methods reject cursors from stale snapshots and positions whose offset/line/column disagree.
type Definition ¶
type DefinitionList ¶
type DefinitionList struct {
Items []Definition `json:"items"`
}
type Diagnostic ¶
type Diagnostic struct {
Code string `json:"code"`
Severity Severity `json:"severity"`
Path string `json:"path,omitempty"`
Span syntax.Span `json:"span"`
Message string `json:"message"`
Notes []string `json:"notes,omitempty"`
}
Diagnostic is a deterministic, source-mapped language-service finding.
type DiagnosticReport ¶
type DiagnosticReport struct {
Items []Diagnostic `json:"items"`
Total int `json:"total"`
Incomplete bool `json:"incomplete,omitempty"`
}
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
Document is an immutable analysis snapshot. Its methods allocate fresh result slices, so concurrent readers cannot mutate one another or the catalog/source snapshot used for analysis.
func Analyze ¶
func Analyze(path string, source []byte, catalog *resolve.Catalog, limits Limits) (*Document, error)
Analyze captures a stable latest-revision catalog snapshot and analyzes one in-memory .ortg document. Syntax/semantic failures are diagnostics, while invalid API inputs and configured bound violations are returned as errors.
func AnalyzeWithOptions ¶
func AnalyzeWithOptions( ctx context.Context, path string, source []byte, catalog *resolve.Catalog, options Options, ) (*Document, error)
AnalyzeWithOptions is the context-aware form used by management services. Schema resolution is optional and its results are captured into the same immutable descriptor snapshot as syntax and diagnostics.
func (*Document) CatalogMetadata ¶
func (document *Document) CatalogMetadata() MetadataReport
CatalogMetadata returns descriptor-derived metadata in element-name order. Configuration remains an opaque schema reference in the separate values artifact; this API never manufactures inline topology fields.
func (*Document) Complete ¶
func (document *Document) Complete(cursor Cursor) (CompletionList, error)
Complete dispatches to element, node, or port completion according to the exact symbol under the cursor.
func (*Document) CompleteElements ¶
func (document *Document) CompleteElements(cursor Cursor) (CompletionList, error)
func (*Document) CompleteNodes ¶
func (document *Document) CompleteNodes(cursor Cursor) (CompletionList, error)
func (*Document) CompletePorts ¶
func (document *Document) CompletePorts(cursor Cursor) (CompletionList, error)
func (*Document) CreateEdgeID ¶
func (document *Document) CreateEdgeID( edgeID string, from, to syntax.Endpoint, delivery syntax.Delivery, ) (EditSet, error)
CreateEdgeID returns one atomic full-document replacement that appends a named canonical edge. Semantic connection checks remain the compiler's job; this syntax operation only admits unambiguous declared nodes and bounded identifiers from an immutable canonical snapshot.
func (*Document) Definitions ¶
func (document *Document) Definitions(cursor Cursor) (DefinitionList, error)
func (*Document) Diagnostics ¶
func (document *Document) Diagnostics() DiagnosticReport
func (*Document) ElementCompletions ¶
func (document *Document) ElementCompletions(cursor Cursor, prefix string) (CompletionList, error)
ElementCompletions returns catalog-derived declaration completions at an arbitrary valid insertion cursor. Unlike CompleteElements it does not require an already-valid element token, so an LSP may use it while the user is creating a new node declaration.
func (*Document) FormatEdits ¶
FormatEdits returns one atomic full-document replacement bound to the exact source digest. Recovery snapshots deliberately have no formatter edit: a formatter must not delete or guess an incomplete statement to make it parse.
func (*Document) LSPCompletions ¶
func (document *Document) LSPCompletions(position LSPPosition) (LSPCompletionList, error)
LSPCompletions converts one standards-defined position and the exact symbol completion result into a deterministic CompletionList. Replacement ranges are verified against the immutable source and expressed in UTF-16 units; opaque data retains the source digest so an adapter can reject stale resolve or apply operations.
func (*Document) LSPConfigurationHover ¶
func (document *Document) LSPConfigurationHover(position LSPPosition) (LSPHover, error)
LSPConfigurationHover converts one standards-defined LSP position to the exact immutable source snapshot and renders the node's complete values contract. It performs no I/O and returns no inline topology values.
func (*Document) LSPDefinitions ¶
func (document *Document) LSPDefinitions( position LSPPosition, identity LSPDocumentIdentity, ) ([]LSPLocationLink, error)
LSPDefinitions projects the exact symbol target into standards-defined LocationLink values. Same-document node targets use the caller's validated URI. Element and port targets use a deterministic read-only virtual descriptor document, whose real ranges are generated alongside its text; no placeholder descriptor position is invented.
func (*Document) LSPDiagnostics ¶
func (document *Document) LSPDiagnostics() (LSPFullDocumentDiagnosticReport, error)
LSPDiagnostics projects the complete immutable diagnostic snapshot into the standards-defined full document report. This single-document boundary fails closed if a result names another path, carries a stale span, has an unknown severity, was truncated by the editor limit, or exceeds the independent wire presentation bound.
func (*Document) LSPFormatting ¶
func (document *Document) LSPFormatting( identity LSPDocumentIdentity, ) (LSPWorkspaceEdit, error)
LSPFormatting returns a versioned full-document formatting WorkspaceEdit. Recovery snapshots remain non-formatable, and no edit is applied here.
func (*Document) LSPRename ¶
func (document *Document) LSPRename( position LSPPosition, newName string, identity LSPDocumentIdentity, ) (LSPWorkspaceEdit, error)
LSPRename returns a versioned, single-document WorkspaceEdit for the exact immutable node symbol under position. It never applies the edit or performs file I/O.
func (*Document) LSPVirtualDescriptorDocument ¶
func (document *Document) LSPVirtualDescriptorDocument( elementName string, ) (LSPVirtualDocument, error)
LSPVirtualDescriptorDocument returns the exact plaintext document targeted by descriptor and port definition links. It is derived only from the immutable catalog snapshot and is safe to serve through an adapter-owned read-only virtual-document scheme.
func (*Document) NodeCompletions ¶
func (document *Document) NodeCompletions(cursor Cursor, prefix, port string, direction element.Direction) (CompletionList, error)
NodeCompletions returns only declared nodes whose exact descriptor has the named port in the requested direction. It is suitable for a partial endpoint before the parser can form an Endpoint AST.
func (*Document) PortCompletions ¶
func (document *Document) PortCompletions(cursor Cursor, node, prefix string, direction element.Direction) (CompletionList, error)
PortCompletions returns only ports declared by the exact descriptor for a declared node and requested direction. Unknown/ambiguous nodes yield an empty list; no speculative port is manufactured.
func (*Document) RemoveEdgeID ¶
RemoveEdgeID returns one atomic full-document replacement that removes the unique canonical .ortg edge whose syntax identity equals edgeID. It does not compile the intermediate result: removing an edge may intentionally expose a required-port diagnostic for the caller to resolve in a later edit.
func (*Document) RenameNode ¶
func (*Document) RenameNodeID ¶
RenameNodeID produces the same exact atomic edit set as RenameNode without requiring a source cursor. It exists for visual frontends whose selected node is bound to a compiled graph identity rather than a text position.
func (*Document) SourceDigest ¶
func (*Document) ValidateCursor ¶
ValidateCursor verifies both the source revision and the exact offset/line/column tuple without performing a symbol query.
type ElementMetadata ¶
type ElementMetadata struct {
Identity element.Identity `json:"identity"`
TopologyDeclaration string `json:"topology_declaration"`
Generics []string `json:"generics,omitempty"`
Ports []PortMetadata `json:"ports"`
Reaction ReactionMetadata `json:"reaction"`
StateSchema string `json:"state_schema,omitempty"`
StateTransfer *element.StateTransferCapabilities `json:"state_transfer,omitempty"`
Config ConfigContract `json:"config"`
Dependencies []element.Dependency `json:"dependencies,omitempty"`
Effects []element.Effect `json:"effects,omitempty"`
CompositeFingerprint string `json:"composite_fingerprint,omitempty"`
}
ElementMetadata is generated only from a validated descriptor. It is sufficient for completion, hover, a virtual descriptor document, or a future visual canvas without claiming to know provider-specific config fields hidden behind Config.SchemaReference.
type Hover ¶
type Hover struct {
Range syntax.Span `json:"range"`
Kind SymbolKind `json:"kind"`
Node string `json:"node,omitempty"`
ElementReference string `json:"element_reference,omitempty"`
Descriptor *ElementMetadata `json:"descriptor,omitempty"`
Port *PortMetadata `json:"port,omitempty"`
Config *NodeConfigContract `json:"config,omitempty"`
}
type LSPAdapter ¶
type LSPAdapter struct {
// contains filtered or unexported fields
}
LSPAdapter owns only immutable in-memory Document snapshots. HandleJSONRPC is transport-neutral: a caller supplies one complete JSON-RPC message and decides how bytes are framed or carried.
func NewLSPAdapter ¶
func NewLSPAdapter(catalog *resolve.Catalog, options LSPAdapterOptions) (*LSPAdapter, error)
func (*LSPAdapter) Dispose ¶
func (adapter *LSPAdapter) Dispose()
func (*LSPAdapter) DocumentCount ¶
func (adapter *LSPAdapter) DocumentCount() int
func (*LSPAdapter) HandleJSONRPC ¶
HandleJSONRPC accepts one complete JSON-RPC 2.0 message and returns at most one complete response. It owns no framing, socket, process, workspace, or filesystem behavior. Request failures are encoded as JSON-RPC errors; notification failures have no response and are returned to the caller.
type LSPAdapterLimits ¶
type LSPAdapterLimits struct {
MaxRequestBytes int `json:"max_request_bytes"`
MaxResponseBytes int `json:"max_response_bytes"`
MaxDocuments int `json:"max_documents"`
MaxURIBytes int `json:"max_uri_bytes"`
MaxMethodBytes int `json:"max_method_bytes"`
MaxIDBytes int `json:"max_id_bytes"`
}
LSPAdapterLimits independently bounds protocol work around the editor's own source/catalog/result limits. Zero fields select defaults.
type LSPAdapterOptions ¶
type LSPAdapterOptions struct {
Editor Options `json:"editor"`
Limits LSPAdapterLimits `json:"limits"`
Workspace WorkspaceLimits `json:"workspace"`
}
LSPAdapterOptions configures an in-memory, transport-neutral adapter. Editor options may resolve schemas but expose no file, network, process, or runtime mounting operation through this API.
type LSPCompletionData ¶
type LSPCompletionData struct {
SourceDigest string `json:"source_digest"`
Kind CompletionKind `json:"kind"`
Element string `json:"element,omitempty"`
ElementRevision uint64 `json:"element_revision,omitempty"`
ElementDigest string `json:"element_digest,omitempty"`
Node string `json:"node,omitempty"`
Port string `json:"port,omitempty"`
Type string `json:"type,omitempty"`
}
type LSPCompletionItem ¶
type LSPCompletionItem struct {
Label string `json:"label"`
Kind LSPCompletionItemKind `json:"kind"`
Detail string `json:"detail,omitempty"`
SortText string `json:"sortText"`
FilterText string `json:"filterText"`
InsertTextFormat int `json:"insertTextFormat"`
TextEdit LSPTextEdit `json:"textEdit"`
Data LSPCompletionData `json:"data"`
}
type LSPCompletionItemKind ¶
type LSPCompletionItemKind int
LSPCompletionItemKind uses the numeric values fixed by the Language Server Protocol: graph ports are fields, nodes are variables, and descriptor-backed elements are classes.
const ( LSPCompletionField LSPCompletionItemKind = 5 LSPCompletionVariable LSPCompletionItemKind = 6 LSPCompletionClass LSPCompletionItemKind = 7 )
type LSPCompletionList ¶
type LSPCompletionList struct {
IsIncomplete bool `json:"isIncomplete"`
Items []LSPCompletionItem `json:"items"`
}
type LSPDiagnostic ¶
type LSPDiagnostic struct {
Range LSPRange `json:"range"`
Severity LSPDiagnosticSeverity `json:"severity"`
Code string `json:"code"`
Source string `json:"source"`
Message string `json:"message"`
Data LSPDiagnosticData `json:"data"`
}
type LSPDiagnosticData ¶
type LSPDiagnosticData struct {
SourceDigest string `json:"source_digest"`
Path string `json:"path,omitempty"`
Notes []string `json:"notes,omitempty"`
}
LSPDiagnosticData preserves immutable editor evidence in the protocol's opaque data field. It is never interpreted as markup or filesystem authority by this package.
type LSPDiagnosticSeverity ¶
type LSPDiagnosticSeverity int
LSPDiagnosticSeverity uses the numeric values fixed by the Language Server Protocol. The editor currently emits only mechanical errors and warnings.
const ( LSPDiagnosticError LSPDiagnosticSeverity = 1 LSPDiagnosticWarning LSPDiagnosticSeverity = 2 )
type LSPDocumentIdentity ¶
type LSPDocumentIdentity struct {
Path string `json:"path"`
URI string `json:"uri"`
Version int `json:"version"`
SourceDigest string `json:"source_digest"`
}
LSPDocumentIdentity binds protocol wire values to the caller's exact versioned document and this immutable analysis snapshot. Path is the language-service identity; URI is the independently validated LSP identity.
type LSPFullDocumentDiagnosticReport ¶
type LSPFullDocumentDiagnosticReport struct {
Kind string `json:"kind"`
Items []LSPDiagnostic `json:"items"`
}
LSPFullDocumentDiagnosticReport is the standards-defined full document report. A bounded editor report that was truncated is rejected instead of being mislabeled as a complete LSP result.
type LSPHover ¶
type LSPHover struct {
Contents LSPMarkupContent `json:"contents"`
Range LSPRange `json:"range"`
}
LSPHover is the protocol-shaped, frontend-independent hover projection used by an LSP adapter. It contains the complete node values contract rather than a lossy summary of the descriptor metadata.
type LSPLocationLink ¶
type LSPMarkupContent ¶
LSPMarkupContent deliberately uses plaintext. Descriptor and schema text is data supplied by plug-ins, so treating it as Markdown would grant it a presentation language and make markup-shaped values ambiguous.
type LSPPosition ¶
LSPPosition is a Language Server Protocol position: both fields are zero-based and Character counts UTF-16 code units, not UTF-8 bytes or Unicode scalar values.
type LSPRange ¶
type LSPRange struct {
Start LSPPosition `json:"start"`
End LSPPosition `json:"end"`
}
type LSPTextDocumentEdit ¶
type LSPTextDocumentEdit struct {
TextDocument LSPVersionedTextDocumentIdentifier `json:"textDocument"`
Edits []LSPTextEdit `json:"edits"`
}
type LSPTextEdit ¶
type LSPVirtualDocument ¶
type LSPVirtualDocument struct {
URI string `json:"uri"`
LanguageID string `json:"languageId"`
Text string `json:"text"`
}
LSPVirtualDocument is immutable adapter input for descriptor-backed definition targets. Its plaintext body is generated from the exact catalog snapshot and grants no filesystem or network authority.
type LSPWorkspaceEdit ¶
type LSPWorkspaceEdit struct {
DocumentChanges []LSPTextDocumentEdit `json:"documentChanges"`
}
LSPWorkspaceEdit uses documentChanges rather than the unversioned changes map, so a conforming client can refuse edits after its document advances.
type Limits ¶
type Limits struct {
MaxPathBytes int `json:"max_path_bytes"`
MaxSourceBytes int `json:"max_source_bytes"`
MaxCatalogElements int `json:"max_catalog_elements"`
MaxCatalogPorts int `json:"max_catalog_ports"`
MaxCatalogBytes int `json:"max_catalog_bytes"`
MaxGraphStatements int `json:"max_graph_statements"`
MaxResultItems int `json:"max_result_items"`
MaxRenameEdits int `json:"max_rename_edits"`
MaxIdentifierBytes int `json:"max_identifier_bytes"`
MaxResolvedSchemaBytes int `json:"max_resolved_schema_bytes"`
MaxTotalResolvedSchemaBytes int `json:"max_total_resolved_schema_bytes"`
MaxSchemaProperties int `json:"max_schema_properties"`
}
Limits bounds every input collection retained by a Document and every collection returned by its query methods. Zero fields select defaults.
func DefaultLimits ¶
func DefaultLimits() Limits
DefaultLimits returns bounds deliberately sized for an interactive editor rather than an unbounded generated graph. A function keeps shared defaults immutable and race-free.
type MetadataReport ¶
type MetadataReport struct {
Elements []ElementMetadata `json:"elements"`
Total int `json:"total"`
Incomplete bool `json:"incomplete,omitempty"`
}
type NodeConfigContract ¶
type NodeConfigContract struct {
ConfigContract
ValuesPath string `json:"values_path"`
}
type NormalizedDocument ¶
type NormalizedDocument struct {
// contains filtered or unexported fields
}
NormalizedDocument is an immutable canonical YAML/JSON topology snapshot. Unlike the .ortg language-service Document, normalized interchange is regenerated atomically after a graph mutation instead of preserving source trivia or exposing position-sensitive language features.
func AnalyzeNormalized ¶
func AnalyzeNormalized(path string, source []byte, limits Limits) (*NormalizedDocument, error)
AnalyzeNormalized admits only the canonical output of the normalized graph manifest marshalers. Strict but noncanonical YAML/JSON remains compilable, but must be normalized before a visual mutation can replace the document.
func (*NormalizedDocument) CreateEdgeID ¶
func (document *NormalizedDocument) CreateEdgeID( edgeID string, from, to syntax.Endpoint, delivery syntax.Delivery, ) (EditSet, error)
CreateEdgeID appends one named normalized edge. Catalog-dependent direction, type, arity, and delivery checks remain the compiler's responsibility.
func (*NormalizedDocument) Path ¶
func (document *NormalizedDocument) Path() string
func (*NormalizedDocument) RemoveEdgeID ¶
func (document *NormalizedDocument) RemoveEdgeID(edgeID string) (EditSet, error)
RemoveEdgeID removes exactly one named or endpoint-derived edge and regenerates the canonical normalized document.
func (*NormalizedDocument) RenameNodeID ¶
func (document *NormalizedDocument) RenameNodeID(oldName, newName string) (EditSet, error)
RenameNodeID regenerates a canonical normalized manifest after changing the one unambiguous node declaration and every edge/boundary reference to it.
func (*NormalizedDocument) Source ¶
func (document *NormalizedDocument) Source() []byte
func (*NormalizedDocument) SourceDigest ¶
func (document *NormalizedDocument) SourceDigest() string
type PortMetadata ¶
type PortMetadata struct {
Name string `json:"name"`
Direction element.Direction `json:"direction"`
Type element.Type `json:"type"`
Cardinality element.Cardinality `json:"cardinality"`
Required bool `json:"required,omitempty"`
MinConnections int `json:"min_connections,omitempty"`
LossAllowed bool `json:"loss_allowed,omitempty"`
DefaultDepth int `json:"default_depth,omitempty"`
ReactionRole string `json:"reaction_role,omitempty"`
}
type ReactionMetadata ¶
type ReactionMetadata struct {
Triggers []string `json:"triggers,omitempty"`
SampledState []string `json:"sampled_state,omitempty"`
Interrupts []string `json:"interrupts,omitempty"`
Outcomes []string `json:"outcomes,omitempty"`
MaxConcurrency int `json:"max_concurrency,omitempty"`
BreaksCycles bool `json:"breaks_cycles,omitempty"`
}
type SymbolKind ¶
type SymbolKind string
const ( SymbolElement SymbolKind = "element" SymbolNodeDeclaration SymbolKind = "node_declaration" SymbolNodeReference SymbolKind = "node_reference" SymbolPortReference SymbolKind = "port_reference" )
type ValuesPropertyMetadata ¶
type ValuesPropertyMetadata struct {
Name string `json:"name"`
Pointer string `json:"pointer"`
Required bool `json:"required,omitempty"`
Types []string `json:"types,omitempty"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Format string `json:"format,omitempty"`
Default json.RawMessage `json:"default,omitempty"`
Enum []json.RawMessage `json:"enum,omitempty"`
Schema json.RawMessage `json:"schema"`
}
type WorkspaceDefinition ¶
type WorkspaceDefinition struct {
WorkspaceDigest string `json:"workspace_digest"`
Kind WorkspaceDefinitionKind `json:"kind"`
OriginSelectionRange LSPRange `json:"originSelectionRange"`
TargetDocument LSPDocumentIdentity `json:"target_document"`
TargetRange LSPRange `json:"targetRange"`
TargetSelectionRange LSPRange `json:"targetSelectionRange"`
}
WorkspaceDefinition retains both source and target snapshot identities even though the final standards-defined LocationLink cannot carry target version or digest fields. An adapter must revalidate the workspace lease before it projects this value onto the wire.
type WorkspaceDefinitionKind ¶
type WorkspaceDefinitionKind string
WorkspaceDefinitionKind identifies which workspace-owned source symbol was resolved without conflating it with a descriptor or local node definition.
const ( WorkspaceImportDefinition WorkspaceDefinitionKind = "import" WorkspaceSubgraphDefinition WorkspaceDefinitionKind = "subgraph" WorkspaceBoundaryDefinition WorkspaceDefinitionKind = "subgraph_boundary" )
type WorkspaceDocument ¶
type WorkspaceDocument struct {
Identity LSPDocumentIdentity `json:"identity"`
Snapshot *Document `json:"-"`
}
WorkspaceDocument binds one immutable analysis snapshot to the caller's exact protocol identity. Snapshot is deliberately not a serialized source or loading capability.
type WorkspaceIndex ¶
type WorkspaceIndex struct {
// contains filtered or unexported fields
}
WorkspaceIndex is an immutable index over only the documents supplied to NewWorkspaceIndex. Relative imports are resolved as identifiers inside that closed set; no path is opened and no missing document is discovered.
func NewWorkspaceIndex ¶
func NewWorkspaceIndex( documents []WorkspaceDocument, configured WorkspaceLimits, ) (*WorkspaceIndex, error)
NewWorkspaceIndex validates and fingerprints a closed immutable population.
func (*WorkspaceIndex) Definition ¶
func (index *WorkspaceIndex) Definition( identity LSPDocumentIdentity, position LSPPosition, ) (result WorkspaceDefinition, handled bool, err error)
Definition resolves import declarations, imported graph references, and imported boundary-port references. handled is true whenever the workspace namespace owns the symbol, including a missing or invalid target; callers must not fall back to a descriptor namespace in that case.
func (*WorkspaceIndex) Documents ¶
func (index *WorkspaceIndex) Documents() []LSPDocumentIdentity
Documents returns independent identities in deterministic URI order.
func (*WorkspaceIndex) Fingerprint ¶
func (index *WorkspaceIndex) Fingerprint() string
Fingerprint returns the digest of the sorted path/URI/version/source-digest population from which this index was built.
type WorkspaceLimits ¶
type WorkspaceLimits struct {
MaxDocuments int `json:"max_documents"`
MaxTotalSourceBytes int `json:"max_total_source_bytes"`
MaxImports int `json:"max_imports"`
MaxPathBytes int `json:"max_path_bytes"`
}
WorkspaceLimits bounds an explicitly supplied in-memory document set. It does not authorize discovery, loading, or mutation of any path. Zero fields select defaults.
func DefaultWorkspaceLimits ¶
func DefaultWorkspaceLimits() WorkspaceLimits
DefaultWorkspaceLimits returns immutable standalone index bounds. An LSP adapter derives larger zero-valued aggregate bounds when its configured document or source limits require them.