namespace ZB.MOM.WW.ScadaBridge.CentralUI.ScriptAnalysis; /// /// Which runtime globals surface a script is analyzed against. Template and /// shared scripts see (mirroring the site /// runtime's ScriptGlobals); inbound API method scripts see /// (with Route and Parameters). /// public enum ScriptKind { Template, InboundApi } public record DiagnoseRequest( string Code, IReadOnlyList? DeclaredParameters = null, IReadOnlyList? SiblingScripts = null, IReadOnlyList? SelfAttributes = null, IReadOnlyList? Children = null, CompositionContext? Parent = null, ScriptKind Kind = ScriptKind.Template); public record DiagnoseResponse(IReadOnlyList Markers); /// /// Shape Monaco's setModelMarkers expects (with severity mapped to Monaco's /// MarkerSeverity enum: 1=Hint, 2=Info, 4=Warning, 8=Error). /// public record DiagnosticMarker( int Severity, int StartLineNumber, int StartColumn, int EndLineNumber, int EndColumn, string Message, string Code); public record CompletionsRequest( string CodeText, int Line, int Column, IReadOnlyList? DeclaredParameters = null, IReadOnlyList? SiblingScripts = null, IReadOnlyList? SelfAttributes = null, IReadOnlyList? Children = null, CompositionContext? Parent = null, ScriptKind Kind = ScriptKind.Template); public record CompletionsResponse(IReadOnlyList Items); public record CompletionItem( string Label, string InsertText, string Detail, string Kind, /// Monaco CompletionItemInsertTextRule. 4 = InsertAsSnippet. int InsertTextRules = 0); public record HoverRequest( string CodeText, int Line, int Column, IReadOnlyList? SiblingScripts = null, IReadOnlyList? DeclaredParameters = null, IReadOnlyList? SelfAttributes = null, IReadOnlyList? Children = null, CompositionContext? Parent = null); public record HoverResponse(string? Markdown); public record SignatureHelpRequest( string CodeText, int Line, int Column, IReadOnlyList? SiblingScripts = null, IReadOnlyList? Children = null, CompositionContext? Parent = null); public record SignatureHelpResponse( string? Label, IReadOnlyList? Parameters, int ActiveParameter); public record SignatureHelpParameter(string Label, string? Documentation); /// /// Shape metadata for a script. Captured from the form's ParameterListEditor /// and ReturnTypeEditor (for siblings) or from SharedScriptCatalog (for shared /// scripts). Used by hover, signature-help, snippet expansion, and the /// argument-count diagnostic. /// public record ScriptShape( string Name, IReadOnlyList Parameters, string? ReturnType); public record ParameterShape(string Name, string Type, bool Required); /// /// Attribute declared on a template: name + canonical SCADA type (Boolean, /// Integer, Float, String, Object, List). /// public record AttributeShape(string Name, string Type); /// /// One end of a composition relationship — either a child (referenced by /// composition instance name) or the parent (referenced by template name). /// The shape carries the attributes and scripts at that scope so the editor /// can complete Children["X"].Attributes["Y"] and /// Children["X"].CallScript("Z") with the right metadata. /// public record CompositionContext( string Name, IReadOnlyList Attributes, IReadOnlyList Scripts); public record FormatRequest(string Code); public record FormatResponse(string Code); public record InlayHintsRequest( string Code, IReadOnlyList? SiblingScripts = null); public record InlayHintsResponse(IReadOnlyList Hints); public record InlayHint(int Line, int Column, string Label);