Documentation
¶
Index ¶
- Constants
- Variables
- type ApplyModelEditParams
- type ApplyModelEditResult
- type DocumentInfo
- type DocumentsResult
- type EditPalette
- type ImportDiagramEdit
- type ImportDiagramParams
- type ImportDiagramResult
- type ModelEditLayout
- type ModelEditNote
- type ModelEditOperation
- type ModelEditPicture
- type ModelEditReferrer
- type ModelEditRefusal
- type Option
- type RelatedElement
- type RelatedElementsParams
- type RelatedElementsResult
- type RelatedGroup
- type RenderCanvas
- type RenderDocumentParams
- type RenderDocumentResult
- type RenderEdge
- type RenderFrame
- type RenderNode
- type RenderOrigin
- type RenderOwner
- type RenderParams
- type RenderPoint
- type RenderPort
- type RenderResult
- type RenderRow
- type RenderStyle
- type Server
- func (s *Server) ApplyModelEdit(params *ApplyModelEditParams) (*ApplyModelEditResult, error)
- func (s *Server) CodeAction(ctx context.Context, params *protocol.CodeActionParams) ([]protocol.CommandOrCodeAction, error)
- func (s *Server) CodeLens(ctx context.Context, params *protocol.CodeLensParams) ([]protocol.CodeLens, error)
- func (s *Server) CodeLensResolve(ctx context.Context, lens *protocol.CodeLens) (*protocol.CodeLens, error)
- func (s *Server) Completion(ctx context.Context, params *protocol.CompletionParams) (protocol.CompletionResult, error)
- func (s *Server) DebugAdvance(params *debugAdvanceParams) (*debugSnapshot, error)
- func (s *Server) DebugBreakpoints(params *debugBreakpointsParams) (*debugSnapshot, error)
- func (s *Server) DebugContinue(params *debugSessionParams) (*debugSnapshot, error)
- func (s *Server) DebugSend(params *debugSendParams) (*debugSnapshot, error)
- func (s *Server) DebugStart(params *debugStartParams) (*debugSnapshot, error)
- func (s *Server) DebugStep(params *debugSessionParams) (*debugSnapshot, error)
- func (s *Server) DebugStop(params *debugSessionParams) (*debugSnapshot, error)
- func (s *Server) Definition(ctx context.Context, params *protocol.DefinitionParams) (protocol.DefinitionResult, error)
- func (s *Server) DidChange(ctx context.Context, params *protocol.DidChangeTextDocumentParams) error
- func (s *Server) DidChangeConfiguration(ctx context.Context, params *protocol.DidChangeConfigurationParams) error
- func (s *Server) DidChangeNotebookDocument(ctx context.Context, params *protocol.DidChangeNotebookDocumentParams) error
- func (s *Server) DidChangeWatchedFiles(ctx context.Context, params *protocol.DidChangeWatchedFilesParams) error
- func (s *Server) DidChangeWorkspaceFolders(ctx context.Context, params *protocol.DidChangeWorkspaceFoldersParams) error
- func (s *Server) DidClose(ctx context.Context, params *protocol.DidCloseTextDocumentParams) error
- func (s *Server) DidCloseNotebookDocument(ctx context.Context, params *protocol.DidCloseNotebookDocumentParams) error
- func (s *Server) DidOpen(ctx context.Context, params *protocol.DidOpenTextDocumentParams) error
- func (s *Server) DidOpenNotebookDocument(ctx context.Context, params *protocol.DidOpenNotebookDocumentParams) error
- func (s *Server) DidSave(ctx context.Context, params *protocol.DidSaveTextDocumentParams) error
- func (s *Server) DidSaveNotebookDocument(ctx context.Context, params *protocol.DidSaveNotebookDocumentParams) error
- func (s *Server) DocumentSymbol(ctx context.Context, params *protocol.DocumentSymbolParams) (protocol.DocumentSymbolResult, error)
- func (s *Server) Documents() *DocumentsResult
- func (s *Server) Exit(ctx context.Context) error
- func (s *Server) ExitCode() int
- func (s *Server) Formatting(ctx context.Context, params *protocol.DocumentFormattingParams) ([]protocol.TextEdit, error)
- func (s *Server) Hover(ctx context.Context, params *protocol.HoverParams) (*protocol.Hover, error)
- func (s *Server) ImportDiagram(params *ImportDiagramParams) (*ImportDiagramResult, error)
- func (s *Server) Initialize(ctx context.Context, params *protocol.InitializeParams) (*protocol.InitializeResult, error)
- func (s *Server) Initialized(ctx context.Context, params *protocol.InitializedParams) error
- func (s *Server) InlayHint(ctx context.Context, params *protocol.InlayHintParams) ([]protocol.InlayHint, error)
- func (s *Server) PrepareRename(ctx context.Context, params *protocol.PrepareRenameParams) (protocol.PrepareRenameResult, error)
- func (s *Server) RangeFormatting(ctx context.Context, params *protocol.DocumentRangeFormattingParams) ([]protocol.TextEdit, error)
- func (s *Server) References(ctx context.Context, params *protocol.ReferenceParams) ([]protocol.Location, error)
- func (s *Server) RelatedElements(params *RelatedElementsParams) (*RelatedElementsResult, error)
- func (s *Server) Rename(ctx context.Context, params *protocol.RenameParams) (*protocol.WorkspaceEdit, error)
- func (s *Server) Render(params *RenderParams) (*RenderResult, error)
- func (s *Server) RenderDocument(params *RenderDocumentParams) (*RenderDocumentResult, error)
- func (s *Server) Rescan(ctx context.Context)
- func (s *Server) Run(ctx context.Context, rwc io.ReadWriteCloser) error
- func (s *Server) SemanticTokensFull(ctx context.Context, params *protocol.SemanticTokensParams) (*protocol.SemanticTokens, error)
- func (s *Server) SemanticTokensRange(ctx context.Context, params *protocol.SemanticTokensRangeParams) (*protocol.SemanticTokens, error)
- func (s *Server) Shutdown(ctx context.Context) error
- func (s *Server) SignatureHelp(ctx context.Context, params *protocol.SignatureHelpParams) (*protocol.SignatureHelp, error)
- func (s *Server) StdlibContent(params *StdlibContentParams) (*StdlibContentResult, error)
- func (s *Server) Symbols(ctx context.Context, params *protocol.WorkspaceSymbolParams) (protocol.WorkspaceSymbolResult, error)
- func (s *Server) Views(params *ViewsParams) *ViewsResult
- type StdlibContentParams
- type StdlibContentResult
- type ViewInfo
- type ViewsParams
- type ViewsResult
Constants ¶
const ( // MethodDebugStart renders the view, runs the target in a runtime built from // the workspace as it is now, and answers the initial snapshot. MethodDebugStart = "opensysml/debug/start" // MethodDebugStep advances the session by one step: one token move of an // action, or one event, change or do-round of a state machine. MethodDebugStep = "opensysml/debug/step" // MethodDebugContinue runs until the behavior completes, waits, reaches a // breakpoint or exhausts its budget, holding the clock where it is. MethodDebugContinue = "opensysml/debug/continue" // MethodDebugSend posts a signal to the behavior; the next step delivers it. MethodDebugSend = "opensysml/debug/send" // MethodDebugAdvance moves the runtime's clock forward, dispatching what // falls due on the way. MethodDebugAdvance = "opensysml/debug/advance" // MethodDebugBreakpoints replaces the session's breakpoints with the nodes // named, by render ID. MethodDebugBreakpoints = "opensysml/debug/breakpoints" // MethodDebugStop ends the session and releases its runtime. MethodDebugStop = "opensysml/debug/stop" // MethodDebugChanged notifies the client of a session a document change // moved to new render IDs or ended. MethodDebugChanged = "opensysml/debugChanged" )
The debug service runs the behavior a rendering draws and reports where it stands in that rendering's IDs, so a client can overlay the run on its drawing.
const ( // MethodDocuments lists the document definitions the workspace holds. MethodDocuments = "opensysml/documents" // MethodRenderDocument renders a named document definition as Markdown. MethodRenderDocument = "opensysml/renderDocument" )
The custom methods a document-preview client speaks, alongside the diagram methods in render.go.
const ( EditSetValue = "setValue" EditRename = "rename" EditAddMember = "addMember" EditAddConnection = "addConnection" EditAddSequence = "addSequence" EditDelete = "delete" EditMove = "move" EditSetLayout = "setLayout" EditSetRoute = "setRoute" EditSetCanvas = "setCanvas" EditSetStyle = "setStyle" EditSetNote = "setNote" EditSetPicture = "setPicture" )
The operation kinds a ModelEditOperation names.
const ( // MethodRender renders a view of a document, or an element directly. MethodRender = "opensysml/render" // MethodViews lists the views a document declares. MethodViews = "opensysml/views" // MethodRenderChanged tells a client the renderings of a document are out of // date. It carries no artifact: the client pulls a fresh one. MethodRenderChanged = "opensysml/renderChanged" )
The custom methods a diagram client speaks. They are not in the protocol, so they are dispatched ahead of the library's own handler.
const CrossDocumentCapability = "openSysmlCrossDocumentLayout"
CrossDocumentCapability is the experimental capability a client and the server each advertise when they speak the cross-document diagram contract: renderings naming other documents' declarations and layouts pinned with declaredIn.
const LibraryScheme = "sysml-stdlib"
LibraryScheme is the URI scheme the server gives the bundled standard library: `sysml-stdlib:/<path>`, where the path is the file's path inside the library (`Kernel Libraries/Kernel Semantic Library/Base.kerml`), percent-encoded. A client opens one through the opensysml/stdlibContent request; the documents are read-only.
const MethodApplyModelEdit = "opensysml/applyModelEdit"
MethodApplyModelEdit turns diagram actions into a WorkspaceEdit the client applies to the document and to every other document the edit reached: the server rewrites nothing itself.
const MethodImportDiagram = "opensysml/importDiagram"
MethodImportDiagram is the request importing a draw.io file the drawio rendering form wrote and the user edited, as DiagramLayout metadata edits.
const MethodRelatedElements = "opensysml/relatedElements"
MethodRelatedElements answers what relates to an element and how, grouped by relationship kind, so a client can offer them for a rendering's `include`.
const MethodStdlibContent = "opensysml/stdlibContent"
MethodStdlibContent serves the text of a bundled library document by its sysml-stdlib URI, which is how a client opens one.
const RelatedElementsCapability = "openSysmlRelatedElements"
RelatedElementsCapability is the capability a server advertises when it serves opensysml/relatedElements; its value lists the relationship kinds the result groups by, in listing order.
const RenderCompartmentsCapability = "openSysmlRenderCompartments"
RenderCompartmentsCapability is the experimental capability whose value lists the foldings a render request's `compartments` folds a tree's owned members into compartment rows with, the first the default; a server without it folds only the layout-less members of a positioned tree.
const RenderDepthCapability = "openSysmlRenderDepth"
RenderDepthCapability is the experimental capability a server advertises when a render request's depth bounds how many levels are drawn below each exposed element.
const RenderElementsCapability = "openSysmlRenderElements"
RenderElementsCapability is the experimental capability whose value lists the optional notation elements a render request's `show` names, in the order the writer defines them, then "all", every one of them.
const RenderFormsCapability = "openSysmlRenderForms"
RenderFormsCapability is the experimental capability whose value lists the forms opensysml/render writes, so a client offers exactly those.
const RenderIncludeCapability = "openSysmlRenderInclude"
RenderIncludeCapability is the capability a server advertises when a render request's `include` draws elements besides the view's own content, marking each node drawn that way `included`.
const RenderLinesCapability = "openSysmlRenderLines"
RenderLinesCapability is the experimental capability whose value lists the edge routings a render request's `lines` draws the DOT or PlantUML form with, the first the default; a server without it routes every edge as splines.
const RenderOverlaysCapability = "openSysmlRenderOverlays"
RenderOverlaysCapability is the experimental capability whose value lists the overlays a render request's `overlay` draws over a requirement rendering.
const RenderPaletteCapability = "openSysmlRenderPalette"
RenderPaletteCapability is the experimental capability the server advertises when a render request's palette colours the result's nodes with fill and border.
const RenderPortsCapability = "openSysmlRenderPorts"
RenderPortsCapability is the experimental capability whose value lists the port displays a render request's `ports` draws an interconnection or mixed rendering's parts with, the first the default; a server without it draws every port.
const RenderStylesCapability = "openSysmlRenderStyles"
RenderStylesCapability is the experimental capability whose value lists the drawing styles a render request's `style` draws the DOT or Mermaid form in, the first the default; a server without it draws the Pilot look alone.
Variables ¶
var ( // ErrDebugSession reports a request naming no live session. ErrDebugSession = errors.New("no such debug session") // ErrDebugTarget reports a target no debugger can run. ErrDebugTarget = errors.New("cannot debug target") // ErrDebugNode reports a breakpoint on a node the rendering does not draw. ErrDebugNode = errors.New("no such node in the session's rendering") // ErrDebugSignal reports a signal the behavior would not take. ErrDebugSignal = errors.New("signal refused") // ErrDebugEnded reports a request on a session that has ended. ErrDebugEnded = errors.New("debug session has ended") // ErrDebugTime reports an advance by something other than a finite duration. ErrDebugTime = errors.New("invalid duration") )
Typed errors the debug requests answer.
Functions ¶
This section is empty.
Types ¶
type ApplyModelEditParams ¶ added in v0.11.0
type ApplyModelEditParams struct {
TextDocument protocol.TextDocumentIdentifier `json:"textDocument"`
Version int `json:"version"`
Operations []ModelEditOperation `json:"operations"`
}
ApplyModelEditParams asks for the operations to be applied to the document as the client holds it, at the version the client last sent.
type ApplyModelEditResult ¶ added in v0.11.0
type ApplyModelEditResult struct {
Edit *protocol.WorkspaceEdit `json:"edit,omitempty"`
Refused []ModelEditRefusal `json:"refused,omitempty"`
Stale bool `json:"stale,omitzero"`
Version int `json:"version"`
}
ApplyModelEditResult is exactly one of: an edit to apply, the refusals that kept the model as it was, or a stale version. Version is the document version the answer was made at, which tells a stale client how far behind it was. The edit holds one versioned TextDocumentEdit per document it rewrites, the requested document first when it is among them; the others carry the versions the server holds, null for one it read from disk, so a client refuses to apply them to text that has moved on rather than land them wrong.
type DocumentInfo ¶ added in v0.11.0
DocumentInfo is one document definition a client may ask to render.
type DocumentsResult ¶ added in v0.11.0
type DocumentsResult struct {
Documents []DocumentInfo `json:"documents"`
}
DocumentsResult lists the document definitions of the workspace, each by qualified name and the file declaring it.
type EditPalette ¶ added in v0.11.0
type EditPalette struct {
Members []string `json:"members"`
Connections []string `json:"connections"`
Typed []string `json:"typed"`
Owners map[string][]string `json:"owners,omitempty"`
}
EditPalette lists the declarations a diagram of one rendering kind offers to add, in the document's language; Typed are the Members that take a type. Owners lists, for each Member only some bodies offer (`subject`) and for the notation of each drawn declaration that is such a member, the nodes whose declaration offers it; a kind absent from Owners goes into any node.
type ImportDiagramEdit ¶ added in v0.12.0
type ImportDiagramEdit struct {
Kind string `json:"kind"`
Target string `json:"target,omitempty"`
NewName string `json:"newName,omitempty"`
Label string `json:"label,omitempty"`
Cell string `json:"cell"`
}
ImportDiagramEdit is one edit the import plans: the annotation kind, the element it is about, and the file cell it comes from.
type ImportDiagramParams ¶ added in v0.12.0
type ImportDiagramParams struct {
TextDocument protocol.TextDocumentIdentifier `json:"textDocument"`
Path string `json:"path,omitempty"`
Content string `json:"content,omitempty"`
View string `json:"view,omitempty"`
// Inline writes the annotations beside the elements rather than in the view's body.
Inline bool `json:"inline,omitempty"`
// DryRun answers the edits without the client being asked to apply them.
DryRun bool `json:"dryRun,omitempty"`
}
ImportDiagramParams names the document whose view the file draws, the file by path or content, and the view when the file has several pages.
type ImportDiagramResult ¶ added in v0.12.0
type ImportDiagramResult struct {
View string `json:"view"`
DryRun bool `json:"dryRun"`
Stale bool `json:"stale,omitempty"`
Edits []ImportDiagramEdit `json:"edits"`
Unmatched []string `json:"unmatched,omitempty"`
Unknown []string `json:"unknown,omitempty"`
Deleted []string `json:"deleted,omitempty"`
Notices []string `json:"notices,omitempty"`
Refused []ModelEditRefusal `json:"refused,omitempty"`
Version int `json:"version"`
Edit *protocol.WorkspaceEdit `json:"edit,omitempty"`
}
ImportDiagramResult is what the import plans and what it leaves alone, and the WorkspaceEdit the plan amounts to, as opensysml/applyModelEdit answers it.
type ModelEditLayout ¶ added in v0.11.0
type ModelEditLayout struct {
// X and Y go together; both absent, the Layout only folds and places nothing.
X *float64 `json:"x,omitzero"`
Y *float64 `json:"y,omitzero"`
Width *float64 `json:"width,omitzero"`
Height *float64 `json:"height,omitzero"`
Collapsed bool `json:"collapsed,omitzero"`
}
ModelEditLayout is a node's geometry as setLayout writes it, in the units opensysml/render reports: pixels, y down. Width and Height are written both or neither; Collapsed is written only when set.
type ModelEditNote ¶ added in v0.12.0
type ModelEditNote struct {
Text string `json:"text"`
X float64 `json:"x"`
Y float64 `json:"y"`
Width *float64 `json:"width,omitempty"`
Height *float64 `json:"height,omitempty"`
}
ModelEditNote is a note as setNote writes it: its text and the top-left corner of its box in the units opensysml/render reports; Width and Height are written both or neither.
type ModelEditOperation ¶ added in v0.11.0
type ModelEditOperation struct {
Kind string `json:"kind"`
Target string `json:"target,omitempty"`
Declaration *protocol.Range `json:"declaration,omitempty"`
DeclaredIn uri.URI `json:"declaredIn,omitempty"`
Digest string `json:"digest,omitempty"`
Value string `json:"value,omitempty"`
BodyExpression string `json:"bodyExpression,omitempty"`
NewName string `json:"newName,omitempty"`
Owner string `json:"owner,omitempty"`
MemberKind string `json:"memberKind,omitempty"`
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Multiplicity string `json:"multiplicity,omitempty"`
Specializes []string `json:"specializes,omitempty"`
From string `json:"from,omitempty"`
To string `json:"to,omitempty"`
Cascade bool `json:"cascade,omitzero"`
View string `json:"view,omitempty"`
Keyword string `json:"keyword,omitempty"`
Ref string `json:"ref,omitempty"`
After string `json:"after,omitempty"`
Condition string `json:"condition,omitempty"`
Via string `json:"via,omitempty"`
Until string `json:"until,omitempty"`
Parameter string `json:"parameter,omitempty"`
Body []ModelEditOperation `json:"body,omitempty"`
ElseBody []ModelEditOperation `json:"elseBody,omitempty"`
Layout *ModelEditLayout `json:"layout,omitzero"`
Route []RenderPoint `json:"route,omitempty"`
Canvas *RenderCanvas `json:"canvas,omitzero"`
Style *RenderStyle `json:"style,omitzero"`
Note *ModelEditNote `json:"note,omitempty"`
Picture *ModelEditPicture `json:"picture,omitempty"`
}
ModelEditOperation is one modeledit.Operation on the wire. Kind selects the operation; the other fields are read as that operation reads them. Elements are named by qualified name, as a rendering's nodes report them.
The DiagramLayout kinds place what a rendering draws: setLayout writes the Layout of the node Target, setRoute the Route of the edge Target, setCanvas the Canvas of the view Target, setStyle the Style of the node or edge Target. A setLayout, setRoute or setStyle may give Declaration instead of Target, the range a rendering reports for a node or edge no qualified name reaches. DeclaredIn names the document declaring the target — the document the range is one of, the one Target must be declared in — or is empty for the requested one; Digest is the origin's digest of that document's text, and a target of another document is refused as stale when that text has changed since it was rendered. View names the view whose body states a Layout or Route, so it applies in that view alone; left empty, the annotation goes inline into Target's declaration and applies in every view. A setLayout with no Layout, a setRoute with no or an empty Route, a setCanvas with no Canvas and a setStyle with no Style clear the annotation. setNote writes a Note about the node or edge Target in View (inline on Target without one, and a note about nothing when Target is the view itself), setPicture a Picture into the body of the view Target; both may be stated many times, so for these two Declaration is the range of the annotation itself, as a rendering reports a note's or picture's origin, and rewrites or clears that one wherever it is.
type ModelEditPicture ¶ added in v0.12.0
type ModelEditPicture struct {
Location string `json:"location"`
X float64 `json:"x"`
Y float64 `json:"y"`
Width float64 `json:"width"`
Height float64 `json:"height"`
Alt string `json:"alt,omitempty"`
Above bool `json:"above,omitempty"`
}
ModelEditPicture is a picture as setPicture writes it: the file, relative to the view's document, the box it fills, its alt text and whether it is drawn over the elements.
type ModelEditReferrer ¶ added in v0.11.0
ModelEditReferrer is one referring declaration and the document declaring it.
type ModelEditRefusal ¶ added in v0.11.0
type ModelEditRefusal struct {
Operation int `json:"operation"`
Failure string `json:"failure"`
Message string `json:"message"`
Diagnostics []protocol.Diagnostic `json:"diagnostics,omitempty"`
Referring []string `json:"referring,omitempty"`
Referrers []ModelEditReferrer `json:"referrers,omitempty"`
}
ModelEditRefusal is why an operation was not applied. Operation is its index in the request, or -1 when the edited model as a whole was refused. Referring names the declarations that refer to a target whose delete or rename was refused, qualified by document when that is another; Referrers tells each name from its document, so a client can list them by file.
type Option ¶ added in v0.10.0
type Option func(*Server)
Option configures a Server at construction.
func WithKeepLineBreaks ¶ added in v0.12.0
WithKeepLineBreaks starts the server formatting with the author's line breaks kept, as the -keep-line-breaks flag asks; a client's setting may change it later.
func WithLibraryRoots ¶ added in v0.11.0
WithLibraryRoots sets the directories installed projects are looked for under, besides the well-known ones beneath a folder's project; the libraryRoots setting replaces them.
func WithVersion ¶ added in v0.10.0
WithVersion sets the version initialize reports in serverInfo, which is the version of the binary serving: the one its -version flag prints.
type RelatedElement ¶ added in v0.11.0
type RelatedElement struct {
// FQN is the qualified name a render request includes the element by.
FQN string `json:"fqn"`
// Name is the element's own name; Kind the keyword the notation declares it with.
Name string `json:"name"`
Kind string `json:"kind"`
// DeclaredHere is true when the requested document declares the element.
DeclaredHere bool `json:"declaredHere,omitzero"`
Origin *RenderOrigin `json:"origin,omitzero"`
}
RelatedElement names an element a rendering can include.
type RelatedElementsParams ¶ added in v0.11.0
type RelatedElementsParams struct {
TextDocument protocol.TextDocumentIdentifier `json:"textDocument"`
// Element is the qualified name of the element, as a rendering's node carries it in `fqn`.
Element string `json:"element"`
}
RelatedElementsParams asks what relates to one element.
type RelatedElementsResult ¶ added in v0.11.0
type RelatedElementsResult struct {
Element RelatedElement `json:"element"`
Groups []RelatedGroup `json:"groups"`
}
RelatedElementsResult groups the elements related to one element by relationship kind; a kind relating nothing is left out.
type RelatedGroup ¶ added in v0.11.0
type RelatedGroup struct {
Kind string `json:"kind"`
Label string `json:"label"`
Elements []RelatedElement `json:"elements"`
}
RelatedGroup is the elements one kind of relationship relates the element to.
type RenderCanvas ¶ added in v0.11.0
type RenderDocumentParams ¶ added in v0.11.0
type RenderDocumentParams struct {
Name string `json:"name"`
DiagramForm string `json:"diagramForm,omitempty"`
Show []string `json:"show,omitempty"`
LinkTemplate string `json:"linkTemplate,omitempty"`
}
RenderDocumentParams asks for the Markdown rendering of the document definition Name names. DiagramForm is the source its graph-shaped diagrams are written as, mermaid, dot, plantuml or d2; empty is mermaid.
type RenderDocumentResult ¶ added in v0.11.0
RenderDocumentResult is the rendered document.
type RenderEdge ¶ added in v0.11.0
type RenderEdge struct {
From string `json:"from"`
To string `json:"to"`
Label string `json:"label"`
Kind string `json:"kind"`
FromPort string `json:"fromPort,omitempty"`
ToPort string `json:"toPort,omitempty"`
Style *RenderStyle `json:"style,omitzero"`
FQN string `json:"fqn,omitempty"`
Declaration *protocol.Range `json:"declaration,omitempty"`
Origin *RenderOrigin `json:"origin,omitzero"`
Route []RenderPoint `json:"route,omitempty"`
}
RenderEdge is one edge of a rendering, located at the connector, transition, succession or flow it was written as, with the waypoints a Route gives it. FQN and Declaration identify that declaration to a setRoute as a node's do. Style is the edge's own Style annotation.
type RenderFrame ¶ added in v0.13.0
type RenderFrame struct {
Name string `json:"name"`
Type string `json:"type,omitempty"`
Exposes []string `json:"exposes,omitempty"`
Filters []string `json:"filters,omitempty"`
Annotations []string `json:"annotations,omitempty"`
}
RenderCanvas is the drawing surface the view states with a Canvas annotation. RenderFrame is the view frame drawn round a diagram (§8.2.3.26): its name compartment and the info compartments at its corners.
type RenderNode ¶ added in v0.11.0
type RenderNode struct {
ID string `json:"id"`
Kind string `json:"kind"`
Name string `json:"name"`
NameSynthesized bool `json:"nameSynthesized,omitzero"`
Inherited bool `json:"inherited,omitzero"`
Parallel bool `json:"parallel,omitzero"`
Type string `json:"type"`
Detail string `json:"detail"`
Text string `json:"text,omitempty"`
Arrow string `json:"arrow,omitempty"`
Parent string `json:"parent,omitempty"`
Compartment string `json:"compartment,omitempty"`
Fill string `json:"fill,omitempty"`
Border string `json:"border,omitempty"`
Style *RenderStyle `json:"style,omitzero"`
Ports []RenderPort `json:"ports,omitempty"`
FQN string `json:"fqn,omitempty"`
DeclaredHere bool `json:"declaredHere,omitzero"`
Notation string `json:"notation,omitempty"`
Owners []RenderOwner `json:"owners,omitempty"`
Declaration *protocol.Range `json:"declaration,omitempty"`
Origin *RenderOrigin `json:"origin,omitzero"`
X *float64 `json:"x,omitzero"`
Y *float64 `json:"y,omitzero"`
Width *float64 `json:"width,omitzero"`
Height *float64 `json:"height,omitzero"`
Collapsed bool `json:"collapsed,omitzero"`
Verdict string `json:"verdict,omitempty"`
// Included marks a node the request's `include` drew rather than the view.
Included bool `json:"included,omitzero"`
}
RenderNode is one node of a rendering, with the range of the declaration it was built from when there is one, and its position when a Layout gives one. FQN names that declaration the way opensysml/applyModelEdit targets it, and Owners the namespaces declaring it, nearest first, drawn or not. Declaration stands in for FQN when no qualified name reaches the node: a layout operation targets the declaration at that range of the document Origin names. Both are given for a declaration of a workspace document alone, a library's being beyond every operation; DeclaredHere marks the requested document's own, the only ones the operations besides a layout reach. Fill and Border are the `#RRGGBB` colours the palette gives the node, as the DOT, Mermaid, PlantUML and D2 forms draw it; absent for a node left black and white, and for every node when no palette is asked for. Style is the node's own Style annotation, which wins over the palette and the drawing style.
type RenderOrigin ¶ added in v0.11.0
type RenderOrigin struct {
URI uri.URI `json:"uri"`
Range protocol.Range `json:"range"`
SelectionRange *protocol.Range `json:"selectionRange,omitempty"`
Digest string `json:"digest"`
}
RenderOrigin is where an element was declared: Range is the whole declaration, SelectionRange the declared identifier alone, which is where a client goes. Digest fingerprints the text the ranges are of; an operation naming a range of another document hands it back, so a range of text since changed is refused rather than misread.
type RenderOwner ¶ added in v0.11.0
RenderOwner is a namespace declaring a node: its qualified name, and whether it is a feature, which an end path chains through with `.` rather than `::`.
type RenderParams ¶ added in v0.11.0
type RenderParams struct {
TextDocument protocol.TextDocumentIdentifier `json:"textDocument"`
View string `json:"view,omitempty"`
Form string `json:"form,omitempty"`
Palette string `json:"palette,omitempty"`
Style string `json:"style,omitempty"`
Ports string `json:"ports,omitempty"`
Lines string `json:"lines,omitempty"`
Compartments string `json:"compartments,omitempty"`
Show []string `json:"show,omitempty"`
Depth int `json:"depth,omitzero"`
// Include names elements drawn besides what the view exposes, each by
// qualified name, as if the view exposed them; nothing in the model changes.
Include []string `json:"include,omitempty"`
Overlay string `json:"overlay,omitempty"`
LinkTemplate string `json:"linkTemplate,omitempty"`
}
RenderParams asks for one rendering. View names a view the document declares, or a supported pseudo-view (`#<kind>` or `#<kind>:<fqn>`); empty renders the document's own view. Form is the artifact written, defaulting to the machine form of the rendering's kind. Palette names the palette that fills the nodes by keyword family, in the artifact and as each node's Fill and Border; empty is black and white. Style names the drawing style the DOT and Mermaid forms draw in; empty is the default, pilot. Ports names how much of a part's ports an interconnection or mixed rendering draws; empty is the default, minimal. Lines names how the DOT and PlantUML forms route their edges; empty is the default, splines. Show names the optional notation elements drawn besides the ones the view's rendering shows, or "all".
type RenderPoint ¶ added in v0.11.0
RenderPoint is one waypoint of an edge, in the canvas's pixels, y down.
type RenderPort ¶ added in v0.11.0
type RenderResult ¶ added in v0.11.0
type RenderResult struct {
View string `json:"view"`
Kind string `json:"kind"`
Style string `json:"style"`
Stated string `json:"stated"`
Shown []string `json:"shown"`
Form string `json:"form"`
Artifact string `json:"artifact"`
Nodes []RenderNode `json:"nodes"`
Edges []RenderEdge `json:"edges"`
Rows []RenderRow `json:"rows,omitempty"`
Columns []string `json:"columns,omitempty"`
Notices []string `json:"notices"`
Canvas *RenderCanvas `json:"canvas,omitzero"`
Frame *RenderFrame `json:"frame,omitzero"`
Palette *EditPalette `json:"palette,omitzero"`
Version int `json:"version"`
}
RenderResult is one rendering: the artifact a client draws, plus the nodes and edges it is made of, each located in the source it was declared in. Style is the drawing style the artifact was drawn in, the default named.
type RenderRow ¶ added in v0.11.0
type RenderRow struct {
Cells []string `json:"cells"`
Origin *RenderOrigin `json:"origin,omitzero"`
}
RenderRow is one row of a table rendering, located at the element it reports.
type RenderStyle ¶ added in v0.11.0
type RenderStyle struct {
Fill string `json:"fill,omitempty"`
Line string `json:"line,omitempty"`
Text string `json:"text,omitempty"`
Font string `json:"font,omitempty"`
FontSize float64 `json:"fontSize,omitzero"`
Bold bool `json:"bold,omitzero"`
Italic bool `json:"italic,omitzero"`
}
RenderStyle is how a node or edge is drawn where a Style annotation says so: `#RRGGBB` colours of fill, line and text, and the face, size in points and weight of its text; each empty or zero when unstated.
type Server ¶
type Server struct {
protocol.UnimplementedServer
// contains filtered or unexported fields
}
Server is the SysML v2 language server. It wraps a single model.Workspace and serves the Language Server Protocol over a jsonrpc2 stream.
func NewServer ¶
NewServer returns a Server bound to ws; without WithVersion it reports an unversioned build.
func (*Server) ApplyModelEdit ¶
func (s *Server) ApplyModelEdit(params *ApplyModelEditParams) (*ApplyModelEditResult, error)
ApplyModelEdit answers opensysml/applyModelEdit: the edits that make the document say what the operations ask, or why it cannot. The document is read at the version the client named; any other version is reported stale, since an edit computed against text the client no longer has would land wrong. The other documents a rename, a delete or a layout operation reaches are read at the versions the server holds, which their edits carry; a document read for a target's declaration and left as it was carries its version with no edits, so that the client refuses the edit once that document has moved on too.
func (*Server) CodeAction ¶
func (s *Server) CodeAction(ctx context.Context, params *protocol.CodeActionParams) ([]protocol.CommandOrCodeAction, error)
CodeAction answers the code actions for a range: the quick fixes attached to its diagnostics and the opt-in identity rewrites of the declaration under it.
func (*Server) CodeLens ¶
func (s *Server) CodeLens(ctx context.Context, params *protocol.CodeLensParams) ([]protocol.CodeLens, error)
CodeLens answers a document's lenses: a reference count on each definition, and in a file on disk a Run or Evaluate command on each top-level behavior.
func (*Server) CodeLensResolve ¶
func (s *Server) CodeLensResolve(ctx context.Context, lens *protocol.CodeLens) (*protocol.CodeLens, error)
CodeLensResolve fills in a reference-count lens: the references the workspace holds to its definition, shown by the editor's references peek.
func (*Server) Completion ¶
func (s *Server) Completion(ctx context.Context, params *protocol.CompletionParams) (protocol.CompletionResult, error)
Completion implements textDocument/completion: members of what a member access names, else the names in scope plus library names and keywords. Prefix filtering is left to the client.
func (*Server) DebugAdvance ¶
DebugAdvance answers opensysml/debug/advance.
func (*Server) DebugBreakpoints ¶
DebugBreakpoints answers opensysml/debug/breakpoints.
func (*Server) DebugContinue ¶
DebugContinue answers opensysml/debug/continue.
func (*Server) DebugStart ¶
DebugStart answers opensysml/debug/start.
func (*Server) Definition ¶
func (s *Server) Definition(ctx context.Context, params *protocol.DefinitionParams) (protocol.DefinitionResult, error)
Definition returns the declaration location of the reference under the cursor, in a workspace document or a bundled library one.
func (*Server) DidChange ¶
DidChange applies content changes (full-replace or incremental) then updates the workspace document, publishing the edited document at once and the other open ones once typing settles: the edit changes what they resolve.
func (*Server) DidChangeConfiguration ¶
func (s *Server) DidChangeConfiguration(ctx context.Context, params *protocol.DidChangeConfigurationParams) error
DidChangeConfiguration applies those of the pushed settings the server reads: the conformance mode, the lints, the library roots, keepLineBreaks and the hover members.
func (*Server) DidChangeNotebookDocument ¶ added in v0.12.0
func (s *Server) DidChangeNotebookDocument(ctx context.Context, params *protocol.DidChangeNotebookDocumentParams) error
DidChangeNotebookDocument re-analyzes the notebook after cells were edited, added, removed or moved, publishing every cell's diagnostics again and withdrawing those of a cell that left the document.
func (*Server) DidChangeWatchedFiles ¶
func (s *Server) DidChangeWatchedFiles(ctx context.Context, params *protocol.DidChangeWatchedFilesParams) error
DidChangeWatchedFiles reindexes model files changed outside the editor. A deletion leaves an open buffer alone; it is still authoritative. A project interchange file changed — a usage added, a project installed or removed — has the projects the folders use found again.
func (*Server) DidChangeWorkspaceFolders ¶
func (s *Server) DidChangeWorkspaceFolders(ctx context.Context, params *protocol.DidChangeWorkspaceFoldersParams) error
DidChangeWorkspaceFolders indexes the model sources a folder added to the session holds, and drops those a removed folder contributed. The file watcher reports changes only, so a newly added folder has to be walked here.
func (*Server) DidClose ¶
DidClose marks the document closed, re-reading its on-disk content first so closing a tab does not unindex names other documents resolve through it. Its markers are withdrawn: only an open document has a set that keeps pace with the workspace.
func (*Server) DidCloseNotebookDocument ¶ added in v0.12.0
func (s *Server) DidCloseNotebookDocument(ctx context.Context, params *protocol.DidCloseNotebookDocumentParams) error
DidCloseNotebookDocument drops the notebook's document and symbols and withdraws every cell's diagnostics.
func (*Server) DidOpen ¶
DidOpen registers a newly opened document with the workspace. The buffer the editor sends can differ from what was read from disk, so when the open moved the workspace the other open documents are refreshed too; a buffer holding what the folder scan indexed changes nothing they report. A document under none of the session's folders has its directory indexed, so its imports of sibling files resolve. A library document is served from the bundled text the index holds, so opening one changes nothing.
func (*Server) DidOpenNotebookDocument ¶ added in v0.12.0
func (s *Server) DidOpenNotebookDocument(ctx context.Context, params *protocol.DidOpenNotebookDocumentParams) error
DidOpenNotebookDocument opens a notebook as one document of its model cells, indexed with the directory it lives in so imports of files beside it resolve as the kernel's do, and publishes each cell's diagnostics.
func (*Server) DidSave ¶
DidSave refreshes diagnostics for every open document, since an edit to one file changes what the others resolve, and writes the saved document's record.
func (*Server) DidSaveNotebookDocument ¶ added in v0.12.0
func (s *Server) DidSaveNotebookDocument(ctx context.Context, params *protocol.DidSaveNotebookDocumentParams) error
DidSaveNotebookDocument refreshes every open document, as a file's save does: the notebook on disk is what the other documents' imports read.
func (*Server) DocumentSymbol ¶
func (s *Server) DocumentSymbol(ctx context.Context, params *protocol.DocumentSymbolParams) (protocol.DocumentSymbolResult, error)
DocumentSymbol returns the hierarchical symbol tree for a document, a bundled library one included.
func (*Server) Documents ¶
func (s *Server) Documents() *DocumentsResult
Documents answers opensysml/documents: the document definitions declared across the workspace, in qualified-name order.
func (*Server) Exit ¶
Exit ends the session. It records the status the process owes its client and releases Run, which owns the stream, rather than closing it from under the read loop that dispatched this notification.
func (*Server) ExitCode ¶
ExitCode is the process status LSP 3.17 asks of a served session: 0 when exit followed a shutdown request, 1 when exit arrived without one. A session the client ended by closing the stream instead served to its end, so it is 0.
func (*Server) Formatting ¶
func (s *Server) Formatting(ctx context.Context, params *protocol.DocumentFormattingParams) ([]protocol.TextEdit, error)
Formatting lays the whole document out as one edit per changed region, so the editor keeps its undo history, cursor and folds.
func (*Server) Hover ¶
Hover returns type/kind information for the declaration under the cursor, in a workspace document or a bundled library one.
func (*Server) ImportDiagram ¶ added in v0.12.0
func (s *Server) ImportDiagram(params *ImportDiagramParams) (*ImportDiagramResult, error)
ImportDiagram answers opensysml/importDiagram: the file is read, the view it draws rendered as the export rendered it, and what differs becomes edits.
func (*Server) Initialize ¶
func (s *Server) Initialize(ctx context.Context, params *protocol.InitializeParams) (*protocol.InitializeResult, error)
Initialize advertises the server capabilities this plan implements and records the session's folders, scanned later so the handshake is not delayed.
func (*Server) Initialized ¶
Initialized indexes the session's folders, so cross-file names resolve without the editor having opened every file.
func (*Server) InlayHint ¶ added in v0.10.0
func (s *Server) InlayHint(ctx context.Context, params *protocol.InlayHintParams) ([]protocol.InlayHint, error)
InlayHint answers a range's hints: the types of each feature written without one and the constant each non-literal value evaluates to, reading only the declarations in the range.
func (*Server) PrepareRename ¶
func (s *Server) PrepareRename(ctx context.Context, params *protocol.PrepareRenameParams) (protocol.PrepareRenameResult, error)
PrepareRename reports the range the client should offer for editing, and rejects positions that name nothing renameable before the user types.
func (*Server) RangeFormatting ¶
func (s *Server) RangeFormatting(ctx context.Context, params *protocol.DocumentRangeFormattingParams) ([]protocol.TextEdit, error)
RangeFormatting formats the whole document as Formatting does and returns only the edits on the requested lines, so nothing outside them moves.
func (*Server) References ¶
func (s *Server) References(ctx context.Context, params *protocol.ReferenceParams) ([]protocol.Location, error)
References returns every location naming the symbol under the cursor, in all workspace documents, at whichever segment of a qualified name denotes it. The cursor may sit in a bundled library document; the declaration it names is located there when it is a library one. Uses inside the library itself are not enumerated.
func (*Server) RelatedElements ¶ added in v0.11.0
func (s *Server) RelatedElements(params *RelatedElementsParams) (*RelatedElementsResult, error)
RelatedElements answers opensysml/relatedElements. The elements are read under the workspace lock and described after it is released: describing one locates it in its document, which reads the workspace again.
func (*Server) Rename ¶
func (s *Server) Rename(ctx context.Context, params *protocol.RenameParams) (*protocol.WorkspaceEdit, error)
Rename renames the name under the cursor — a declaration's long or short name — where the declaration states it and at every reference across the workspace's documents written with that name, including the qualifier positions of multi-segment names (`A::B` when renaming A). A reference written with the element's other name still resolves afterwards, so it is left as written.
func (*Server) Render ¶
func (s *Server) Render(params *RenderParams) (*RenderResult, error)
Render answers opensysml/render: the rendering of the view or element asked for, in the form asked for, at the version of the document it was made from: version, node FQNs, ranges and digests all come from the one read of the workspace the rendering was made under.
func (*Server) RenderDocument ¶
func (s *Server) RenderDocument(params *RenderDocumentParams) (*RenderDocumentResult, error)
RenderDocument answers opensysml/renderDocument: the named document compiled, evaluated and rendered as Markdown, or the typed error stopping it.
func (*Server) Rescan ¶ added in v0.11.0
Rescan reconciles the workspace with the session's folders as they are on disk now, for a client with no file watcher: sources added or rewritten since the last walk are reindexed as one batch, and closed sources gone from disk are dropped. An open buffer stays authoritative, as for a watched change.
func (*Server) Run ¶
Run wires the server to a stdio-style stream and blocks until the connection is done.
The connection is built here rather than with protocol.NewServer because that helper starts the read loop with its own handler chain; runHandler is the chain this server needs, with the lifecycle ordered ahead of the asynchronous dispatch.
func (*Server) SemanticTokensFull ¶
func (s *Server) SemanticTokensFull(ctx context.Context, params *protocol.SemanticTokensParams) (*protocol.SemanticTokens, error)
SemanticTokensFull answers the semantic tokens of a whole document, a bundled library one included.
func (*Server) SemanticTokensRange ¶
func (s *Server) SemanticTokensRange(ctx context.Context, params *protocol.SemanticTokensRangeParams) (*protocol.SemanticTokens, error)
SemanticTokensRange answers the tokens overlapping a range, the document's tokens filtered: highlighting a name resolves the whole document either way.
func (*Server) Shutdown ¶
Shutdown prepares the server for exit: the session stays readable, but only the exit notification is still answered (LSP 3.17 §Shutdown Request). Live debug sessions end with it, releasing what they hold.
func (*Server) SignatureHelp ¶
func (s *Server) SignatureHelp(ctx context.Context, params *protocol.SignatureHelpParams) (*protocol.SignatureHelp, error)
SignatureHelp answers the signature of the call the cursor's argument list belongs to: one signature per declaration the call may invoke, each listing the parameters a positional argument binds in order, with the parameter the cursor's argument binds active.
func (*Server) StdlibContent ¶
func (s *Server) StdlibContent(params *StdlibContentParams) (*StdlibContentResult, error)
StdlibContent answers opensysml/stdlibContent with the bundled text of the library document params names, or an error for a URI that names none.
func (*Server) Symbols ¶
func (s *Server) Symbols(ctx context.Context, params *protocol.WorkspaceSymbolParams) (protocol.WorkspaceSymbolResult, error)
Symbols implements workspace/symbol: a flat, query-filtered list of all symbols across every open document.
func (*Server) Views ¶
func (s *Server) Views(params *ViewsParams) *ViewsResult
Views answers opensysml/views: the views the document declares, with the rendering kind each states and why an unsupported one cannot be drawn.
type StdlibContentParams ¶ added in v0.11.0
StdlibContentParams names the library document whose text is asked for.
type StdlibContentResult ¶ added in v0.11.0
type StdlibContentResult struct {
Text string `json:"text"`
}
StdlibContentResult is the text of a library document, read-only.
type ViewInfo ¶ added in v0.11.0
type ViewInfo struct {
Name string `json:"name"`
Kind string `json:"kind"`
Supported bool `json:"supported"`
Reason string `json:"reason,omitempty"`
Range *protocol.Range `json:"range,omitempty"`
SelectionRange *protocol.Range `json:"selectionRange,omitempty"`
}
ViewInfo is one view a document declares. Range is its whole declaration and SelectionRange its name, so a client can tell which view the cursor is in.
type ViewsParams ¶ added in v0.11.0
type ViewsParams struct {
TextDocument protocol.TextDocumentIdentifier `json:"textDocument"`
}
ViewsParams asks for the views a document declares.
type ViewsResult ¶ added in v0.11.0
type ViewsResult struct {
Views []ViewInfo `json:"views"`
PseudoViews []string `json:"pseudoViews"`
}
ViewsResult lists a document's views, unsupported ones included so a client can say why they cannot be drawn.
Source Files
¶
- codeaction.go
- codelens.go
- completion.go
- conformance.go
- debug.go
- definition.go
- diagnostics.go
- document.go
- files.go
- formatting.go
- hover.go
- hover_members.go
- identity.go
- importdiagram.go
- inlayhint.go
- lifecycle.go
- metadata.go
- modeledit.go
- notebook.go
- notebook_requests.go
- posmap.go
- references.go
- related.go
- rename.go
- render.go
- semantictokens.go
- server.go
- signaturehelp.go
- stdlib.go
- symbols.go
- sync.go
- uri.go
- walk.go