diff --git a/examples/tests/valid/class.test.w b/examples/tests/valid/class.test.w index 65476775a7c..159c4d873a6 100644 --- a/examples/tests/valid/class.test.w +++ b/examples/tests/valid/class.test.w @@ -212,4 +212,19 @@ new Baz(); class Boom { new() { } } -class Bam extends Boom {} \ No newline at end of file +class Bam extends Boom {} + +// A documented class (should be parssed without errors) +/// Class documentation +/// blah blah blah +class DocClass { + /// Method documentation + /// blah blah blah + docMethod() {} + /// Field documentation + /// blah blah blah + docField: num; + /// Ctor documentation + /// blah blah blah + new() { this.docField = 0; } +} \ No newline at end of file diff --git a/examples/tests/valid/enums.test.w b/examples/tests/valid/enums.test.w index cb8ccaf5faa..0cf201e3898 100644 --- a/examples/tests/valid/enums.test.w +++ b/examples/tests/valid/enums.test.w @@ -31,3 +31,12 @@ test "toStr inflight" { assert("{SomeEnum.TWO}" == "TWO"); assert("{SomeEnum.THREE}" == "THREE"); } + +// A documented enum (should be parssed without errors) +/// Enum documentation +/// blah blah blah +enum DocumentedEnum { + /// Variant documentation + /// blah blah blah + VARIANT +} diff --git a/examples/tests/valid/external_ts.extern.d.ts b/examples/tests/valid/external_ts.extern.d.ts index 5d10ff6b79d..d6f5909df1b 100644 --- a/examples/tests/valid/external_ts.extern.d.ts +++ b/examples/tests/valid/external_ts.extern.d.ts @@ -187,7 +187,14 @@ export interface IHostedLiftable extends ILiftable { } /** Abstract interface for `Resource`. */ export interface IResource extends IConstruct, IHostedLiftable { + /** The tree node. */ readonly node: Node; + /** A hook called by the Wing compiler once for each inflight host that needs to use this object inflight. + The list of requested inflight methods + needed by the inflight host are given by `ops`. + + This method is commonly used for adding permissions, environment variables, or + other capabilities to the inflight host. */ readonly onLift: (host: IInflightHost, ops: (readonly (string)[])) => void; } /** Shared behavior between all Wing SDK resources. */ @@ -207,10 +214,22 @@ containers (such as ECS or Kubernetes), VMs or even physical servers. This data represents the code together with the bindings to preflight data required to run. */ export interface IInflight extends IHostedLiftable { + /** A hook called by the Wing compiler once for each inflight host that needs to use this object inflight. + The list of requested inflight methods + needed by the inflight host are given by `ops`. + + This method is commonly used for adding permissions, environment variables, or + other capabilities to the inflight host. */ readonly onLift: (host: IInflightHost, ops: (readonly (string)[])) => void; } /** A resource with an inflight "handle" method that can be passed to the bucket events. */ export interface IBucketEventHandler extends IInflight { + /** A hook called by the Wing compiler once for each inflight host that needs to use this object inflight. + The list of requested inflight methods + needed by the inflight host are given by `ops`. + + This method is commonly used for adding permissions, environment variables, or + other capabilities to the inflight host. */ readonly onLift: (host: IInflightHost, ops: (readonly (string)[])) => void; } /** `onCreate` event options. */ diff --git a/examples/tests/valid/interface.test.w b/examples/tests/valid/interface.test.w index b5a422f3c3c..2046cc5f3cb 100644 --- a/examples/tests/valid/interface.test.w +++ b/examples/tests/valid/interface.test.w @@ -41,3 +41,12 @@ interface IThing1 { interface IThing2 { m1(): IThing1?; } + +// A documented interface (should be parsed without errors) +/// Interface documentation +/// blah blah blah +interface IDocumentedInterface { + /// Method documentation + /// blah blah blah + method1(): void; +} diff --git a/examples/tests/valid/structs.test.w b/examples/tests/valid/structs.test.w index fe006bd0088..8c6a91b1010 100644 --- a/examples/tests/valid/structs.test.w +++ b/examples/tests/valid/structs.test.w @@ -100,4 +100,13 @@ struct Node { let aNode = Node {val: "someval"}; let bNode = Node {val: "otherval", next: aNode}; -expect.equal(Json.stringify(bNode), "\{\"val\":\"otherval\",\"next\":\{\"val\":\"someval\"\}\}"); \ No newline at end of file +expect.equal(Json.stringify(bNode), "\{\"val\":\"otherval\",\"next\":\{\"val\":\"someval\"\}\}"); + +// A documented struct (should be parsed without errors) +/// Struct documentation +/// blah blah blah +struct DocumentedStruct { + /// Field documentation + /// blah blah blah + field: str; +} diff --git a/libs/tree-sitter-wing/grammar.js b/libs/tree-sitter-wing/grammar.js index 533ab8f2e58..afad7c69925 100644 --- a/libs/tree-sitter-wing/grammar.js +++ b/libs/tree-sitter-wing/grammar.js @@ -22,7 +22,7 @@ const PREC = { module.exports = grammar({ name: "wing", - extras: ($) => [$.comment, /[\s\p{Zs}\uFEFF\u2060\u200B]/], + extras: ($) => [$.comment, $.doc, /[\s\p{Zs}\uFEFF\u2060\u200B]/], word: ($) => $.identifier, @@ -54,9 +54,10 @@ module.exports = grammar({ choice(braced(optional(repeat($._statement))), $.AUTOMATIC_BLOCK), _semicolon: ($) => choice(";", $.AUTOMATIC_SEMICOLON), comment: ($) => - token( - choice(seq("//", /.*/), seq("/*", /[^*]*\*+([^/*][^*]*\*+)*/, "/")) - ), + token(choice(seq(/\/\/[^\/]/, /.*/), seq("/*", /[^*]*\*+([^/*][^*]*\*+)*/, "/"))), + + doc: ($) => seq("///", field("content", $.doc_content)), + doc_content: ($) => /.*/, // Identifiers reference: ($) => @@ -504,7 +505,7 @@ module.exports = grammar({ initializer: ($) => seq( optional(field("inflight", $.inflight_specifier)), - "new", + field("ctor_name", "new"), field("parameter_list", $.parameter_list), field("block", $.block) ), diff --git a/libs/tree-sitter-wing/src/grammar.json b/libs/tree-sitter-wing/src/grammar.json index 458b5295649..bbdefaf79a8 100644 --- a/libs/tree-sitter-wing/src/grammar.json +++ b/libs/tree-sitter-wing/src/grammar.json @@ -68,8 +68,8 @@ "type": "SEQ", "members": [ { - "type": "STRING", - "value": "//" + "type": "PATTERN", + "value": "\\/\\/[^\\/]" }, { "type": "PATTERN", @@ -97,6 +97,27 @@ ] } }, + "doc": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "///" + }, + { + "type": "FIELD", + "name": "content", + "content": { + "type": "SYMBOL", + "name": "doc_content" + } + } + ] + }, + "doc_content": { + "type": "PATTERN", + "value": ".*" + }, "reference": { "type": "CHOICE", "members": [ @@ -2730,8 +2751,12 @@ ] }, { - "type": "STRING", - "value": "new" + "type": "FIELD", + "name": "ctor_name", + "content": { + "type": "STRING", + "value": "new" + } }, { "type": "FIELD", @@ -4424,6 +4449,10 @@ "type": "SYMBOL", "name": "comment" }, + { + "type": "SYMBOL", + "name": "doc" + }, { "type": "PATTERN", "value": "[\\s\\p{Zs}\\uFEFF\\u2060\\u200B]" diff --git a/libs/tree-sitter-wing/test/corpus/comments.txt b/libs/tree-sitter-wing/test/corpus/comments.txt new file mode 100644 index 00000000000..a76b541b314 --- /dev/null +++ b/libs/tree-sitter-wing/test/corpus/comments.txt @@ -0,0 +1,22 @@ +================================================================================ +Docstrings & comments +================================================================================ + +// This is a plain comment +/// This is a doc string +/// This is another one +// This too is a plain comment + +/// This is a doc after an empty line + +-------------------------------------------------------------------------------- + +(source + (comment) + (doc + content: (doc_content)) + (doc + content: (doc_content)) + (comment) + (doc + content: (doc_content))) diff --git a/libs/wingc/src/ast.rs b/libs/wingc/src/ast.rs index 2a2b01d634c..ede16e742e3 100644 --- a/libs/wingc/src/ast.rs +++ b/libs/wingc/src/ast.rs @@ -3,7 +3,7 @@ use std::hash::{Hash, Hasher}; use std::sync::atomic::{AtomicUsize, Ordering}; use camino::Utf8PathBuf; -use indexmap::{Equivalent, IndexMap, IndexSet}; +use indexmap::{Equivalent, IndexMap}; use itertools::Itertools; use crate::diagnostic::WingSpan; @@ -295,6 +295,8 @@ pub struct FunctionDefinition { pub is_static: bool, /// Function's access modifier. In case of a closure, this is always public. pub access: AccessModifier, + /// Function's documentation + pub doc: Option, pub span: WingSpan, } @@ -303,6 +305,7 @@ pub struct Stmt { pub kind: StmtKind, pub span: WingSpan, pub idx: usize, + pub doc: Option, } #[derive(Debug)] @@ -391,7 +394,8 @@ impl Class { #[derive(Debug)] pub struct Interface { pub name: Symbol, - pub methods: Vec<(Symbol, FunctionSignature)>, + // Each method has a symbol, a signature, and an optional documentation string + pub methods: Vec<(Symbol, FunctionSignature, Option)>, pub extends: Vec, pub access: AccessModifier, pub phase: Phase, @@ -408,7 +412,8 @@ pub struct Struct { #[derive(Debug)] pub struct Enum { pub name: Symbol, - pub values: IndexSet, + // Each value has a symbol and an optional documenation string + pub values: IndexMap>, pub access: AccessModifier, } @@ -517,6 +522,7 @@ pub struct ClassField { pub phase: Phase, pub is_static: bool, pub access: AccessModifier, + pub doc: Option, } #[derive(Debug, Clone, Copy, PartialEq)] @@ -540,6 +546,7 @@ impl Display for AccessModifier { pub struct StructField { pub name: Symbol, pub member_type: TypeAnnotation, + pub doc: Option, } #[derive(Debug)] diff --git a/libs/wingc/src/closure_transform.rs b/libs/wingc/src/closure_transform.rs index 3315550dabe..abcf9c26302 100644 --- a/libs/wingc/src/closure_transform.rs +++ b/libs/wingc/src/closure_transform.rs @@ -181,6 +181,7 @@ impl Fold for ClosureTransformer { // we need to set this to false. is_static: false, access: AccessModifier::Public, + doc: None, }; // class_init_body := @@ -220,6 +221,7 @@ impl Fold for ClosureTransformer { value: Expr::new(ExprKind::Literal(Literal::Boolean(true)), WingSpan::for_file(file_id)), }, span: WingSpan::for_file(file_id), + doc: None, }]; // If we are inside a scope with "this", add define `let __parent_this_${CLOSURE_COUNT} = this` which can be @@ -242,6 +244,7 @@ impl Fold for ClosureTransformer { }, span: WingSpan::for_file(file_id), idx: 0, + doc: None, }; self.class_statements.push(parent_this_def); } @@ -271,6 +274,7 @@ impl Fold for ClosureTransformer { body: FunctionBody::Statements(Scope::new(class_init_body, WingSpan::for_file(file_id))), span: WingSpan::for_file(file_id), access: AccessModifier::Public, + doc: None, }, fields: class_fields, implements: vec![], @@ -290,12 +294,14 @@ impl Fold for ClosureTransformer { body: FunctionBody::Statements(Scope::new(vec![], WingSpan::for_file(file_id))), span: WingSpan::for_file(file_id), access: AccessModifier::Public, + doc: None, }, access: AccessModifier::Private, auto_id: true, }), idx: self.nearest_stmt_idx, span: WingSpan::for_file(file_id), + doc: None, }; // new_class_instance := diff --git a/libs/wingc/src/docs.rs b/libs/wingc/src/docs.rs index 2c9f0782fc5..8a46f69f609 100644 --- a/libs/wingc/src/docs.rs +++ b/libs/wingc/src/docs.rs @@ -382,7 +382,12 @@ fn render_enum(e: &Enum) -> String { } for prop in e.values.iter() { - markdown.line(&format!("- `{}`\n", prop)); + let value_doc = if let Some(doc) = prop.1.as_ref() { + format!(" — {}", doc) + } else { + String::default() + }; + markdown.line(&format!("- `{}{}`\n", prop.0, value_doc)); } markdown.empty_line(); diff --git a/libs/wingc/src/dtsify/extern_dtsify.rs b/libs/wingc/src/dtsify/extern_dtsify.rs index b9c931322e9..f09706adb00 100644 --- a/libs/wingc/src/dtsify/extern_dtsify.rs +++ b/libs/wingc/src/dtsify/extern_dtsify.rs @@ -198,7 +198,7 @@ impl<'a> ExternDTSifier<'a> { code.open(format!("export enum {} {{", enum_.name.name)); for (i, variant) in enum_.values.iter().enumerate() { - code.line(format!("{variant} = {i},")); + code.line(format!("{} = {i},", variant.0)); } code.close("}"); diff --git a/libs/wingc/src/dtsify/mod.rs b/libs/wingc/src/dtsify/mod.rs index a871981247e..02c1f2dbf12 100644 --- a/libs/wingc/src/dtsify/mod.rs +++ b/libs/wingc/src/dtsify/mod.rs @@ -280,7 +280,7 @@ impl<'a> DTSifier<'a> { StmtKind::Enum(enu) => { code.open(format!("export enum {} {{", enu.name.name)); for value in &enu.values { - code.line(format!("{},", value.name)); + code.line(format!("{},", value.0.name)); } code.close("}"); } diff --git a/libs/wingc/src/fold.rs b/libs/wingc/src/fold.rs index a4a570d82ad..1c51bb24253 100644 --- a/libs/wingc/src/fold.rs +++ b/libs/wingc/src/fold.rs @@ -208,6 +208,7 @@ where kind, span: node.span, idx: node.idx, + doc: node.doc, } } @@ -249,6 +250,7 @@ where phase: node.phase, is_static: node.is_static, access: node.access, + doc: node.doc, } } @@ -259,6 +261,7 @@ where StructField { name: f.fold_symbol(node.name), member_type: f.fold_type_annotation(node.member_type), + doc: node.doc, } } @@ -271,7 +274,7 @@ where methods: node .methods .into_iter() - .map(|(name, sig)| (f.fold_symbol(name), f.fold_function_signature(sig))) + .map(|(name, sig, doc)| (f.fold_symbol(name), f.fold_function_signature(sig), doc)) .collect(), extends: node .extends @@ -305,7 +308,7 @@ where { Enum { name: f.fold_symbol(node.name), - values: node.values.into_iter().map(|v| f.fold_symbol(v)).collect(), + values: node.values.into_iter().map(|v| (f.fold_symbol(v.0), v.1)).collect(), access: node.access, } } @@ -467,6 +470,7 @@ where is_static: node.is_static, span: node.span, access: node.access, + doc: node.doc, } } diff --git a/libs/wingc/src/jsify.rs b/libs/wingc/src/jsify.rs index e4cc2a3d858..21ddfba90b0 100644 --- a/libs/wingc/src/jsify.rs +++ b/libs/wingc/src/jsify.rs @@ -1288,13 +1288,13 @@ impl<'a> JSifier<'a> { code } - fn jsify_enum(&self, name: &Symbol, values: &IndexSet) -> CodeMaker { + fn jsify_enum(&self, name: &Symbol, values: &IndexMap>) -> CodeMaker { let mut code = CodeMaker::with_source(&name.span); let mut value_index = 0; code.open("(function (tmp) {"); - for value in values { + for value in values.keys() { code.line(new_code!( &value.span, "tmp[\"", diff --git a/libs/wingc/src/lsp/completions.rs b/libs/wingc/src/lsp/completions.rs index 956ef6f37e5..456f01f2e33 100644 --- a/libs/wingc/src/lsp/completions.rs +++ b/libs/wingc/src/lsp/completions.rs @@ -920,7 +920,7 @@ fn get_completions_from_type( let variants = &enum_.values; variants .iter() - .map(|item| CompletionItem { + .map(|(item, _)| CompletionItem { label: item.name.clone(), detail: Some(enum_.name.name.clone()), kind: Some(CompletionItemKind::ENUM_MEMBER), diff --git a/libs/wingc/src/lsp/hover.rs b/libs/wingc/src/lsp/hover.rs index d0c4c9bc051..d7e4b860264 100644 --- a/libs/wingc/src/lsp/hover.rs +++ b/libs/wingc/src/lsp/hover.rs @@ -117,7 +117,7 @@ mod tests { r#" bring cloud; new cloud. - //^ + //^ "#, ); @@ -427,4 +427,213 @@ Json.stringify({}); //^ "#, ); + + test_hover_list!( + class_doc, + r#" + /// Class doc + class Foo { + //^ + } + "#, + ); + + test_hover_list!( + enum_doc, + r#" + /// Enum doc + enum Foo { + //^ + } + "#, + ); + + test_hover_list!( + struct_doc, + r#" + /// Struct doc + struct Foo { + //^ + } + "#, + ); + + test_hover_list!( + interface_doc, + r#" + /// Interface doc + interface Foo { + //^ + } + "#, + ); + + test_hover_list!( + class_field_doc, + r#" + class Foo { + /// Class field doc + field: num; + //^ + } + "#, + ); + + test_hover_list!( + class_method_doc, + r#" + class Foo { + /// Class method doc + do() { } + //^ + } + "#, + ); + + test_hover_list!( + interface_method_doc, + r#" + interface Foo { + /// Interface method doc + do(): void; + //^ + } + "#, + ); + + test_hover_list!( + enum_variant_doc, + r#" + enum Foo { + /// Enum variant doc + A + } + Foo.A; + //^ + "#, + ); + + test_hover_list!( + struct_field_doc, + r#" + struct Foo { + /// Struct field doc + field: num; + //^ + } + "#, + ); + + test_hover_list!( + inherited_struct_field_doc, + r#" + struct Foo { + /// Parent struct field doc + field: num; + } + struct ChildFoo extends Foo { + child_field: num; + } + let child = ChildFoo { field: 1, child_field: 2 }; + child.field; + //^ + "#, + ); + + test_hover_list!( + inherited_interface_method_doc, + r#" + interface Foo { + /// Parent interface method doc + do(): void; + } + interface ChildFoo extends Foo { + child_do(): void; + } + (x: ChildFoo) => { + x.do(); + //^ + }; + "#, + ); + + test_hover_list!( + ignoe_empty_lines_in_doc, + r#" + /// Class doc with empty lines after it + + class Foo { + //^ + + "#, + ); + + test_hover_list!( + class_doc_with_multiline_and_markdown, + r#" + /// Class doc + /// With multiline + /// ## And markdown + class Foo { + //^ + pub a: num; + } + "#, + ); + + test_hover_list!( + member_doc_on_same_line_as_something_else, + r#" + class Foo { /// Member doc in unexpected place + field: num; + //^ + } + "#, + ); + + test_hover_list!( + ctor_doc, + r#" + class Bob { + /// I'm bob the constructor + new() {} + //^ + } + "# + ); + + test_hover_list!( + inflight_ctor_doc, + r#" + class Bob { + /// I'm bob the constructor (inflight) + inflight new() {} + //^ + } + "# + ); + + test_hover_list!( + ctor_doc_from_new_expr, + r#" + class Bob { + /// I'm bob the constructor + new() {} + } + new Bob(); + //^ + "# + ); + + test_hover_list!( + inflight_ctor_doc_from_new_expr, + r#" + inflight class Bob { + /// I'm bob the constructor (inflight) + new() {} + } + inflight () => { new Bob(); }; + //^ + "# + ); } diff --git a/libs/wingc/src/lsp/snapshots/completions/capture_in_test.snap b/libs/wingc/src/lsp/snapshots/completions/capture_in_test.snap index 38bf9dfdd26..8130c805472 100644 --- a/libs/wingc/src/lsp/snapshots/completions/capture_in_test.snap +++ b/libs/wingc/src/lsp/snapshots/completions/capture_in_test.snap @@ -169,7 +169,7 @@ source: libs/wingc/src/lsp/completions.rs detail: "inflight (key: str, options: BucketTryGetOptions?): str?" documentation: kind: markdown - value: "```wing\ninflight tryGet: inflight (key: str, options: BucketTryGetOptions?): str?\n```\n---\nGet an object from the bucket if it exists If the bytes returned are not a valid UTF-8 string, an error is thrown.\n### Parameters\n- `key` — `str` — Key of the object.\n- `...options` — `BucketTryGetOptions?` — Additional get options.\n \n - `endByte?` — `num?`\n - `startByte?` — `num?`\n\n### Returns\nthe contents of the object as a string if it exists, nil otherwise" + value: "```wing\ninflight tryGet: inflight (key: str, options: BucketTryGetOptions?): str?\n```\n---\nGet an object from the bucket if it exists If the bytes returned are not a valid UTF-8 string, an error is thrown.\n### Parameters\n- `key` — `str` — Key of the object.\n- `...options` — `BucketTryGetOptions?` — Additional get options.\n \n - `endByte?` — `num?` — The ending byte to read up to (including).\n - `startByte?` — `num?` — The starting byte to read from.\n\n### Returns\nthe contents of the object as a string if it exists, nil otherwise" sortText: ff|tryGet insertText: tryGet($1) insertTextFormat: 2 diff --git a/libs/wingc/src/lsp/snapshots/completions/incomplete_inflight_namespace.snap b/libs/wingc/src/lsp/snapshots/completions/incomplete_inflight_namespace.snap index 85029c605a7..f2a5773dfb8 100644 --- a/libs/wingc/src/lsp/snapshots/completions/incomplete_inflight_namespace.snap +++ b/libs/wingc/src/lsp/snapshots/completions/incomplete_inflight_namespace.snap @@ -41,7 +41,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 7 documentation: kind: markdown - value: "```wing\nclass OnDeploy\n```\n---\nRun code every time the app is deployed.\n\n### Initializer\n- `handler` — `inflight (): void`\n- `...props` — `OnDeployProps?`\n \n - `concurrency?` — `num?`\n - `env?` — `Map?`\n - `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n - `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n - `logRetentionDays?` — `num?`\n - `memory?` — `num?`\n - `timeout?` — `duration?`\n### Fields\n- `node` — `Node` — The tree node.\n### Methods\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." + value: "```wing\nclass OnDeploy\n```\n---\nRun code every time the app is deployed.\n\n### Initializer\n- `handler` — `inflight (): void`\n- `...props` — `OnDeployProps?`\n \n - `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n - `env?` — `Map?` — Environment variables to pass to the function.\n - `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n - `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n - `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n - `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n - `timeout?` — `duration?` — The maximum amount of time the function can run.\n### Fields\n- `node` — `Node` — The tree node.\n### Methods\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." sortText: gg|OnDeploy - label: Queue kind: 7 @@ -77,7 +77,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 7 documentation: kind: markdown - value: "```wing\nclass Website impl IWebsite\n```\n---\nA cloud static website.\n\n### Initializer\n- `...props` — `WebsiteProps`\n \n - `path` — `str`\n - `domain?` — `Domain?`\n - `errorDocument?` — `str?`\n### Fields\n- `node` — `Node` — The tree node.\n- `path` — `str` — Absolute local path to the website's static files.\n- `url` — `str` — The website's url.\n### Methods\n- `addFile` — `preflight (path: str, data: str, options: AddFileOptions?): str` — Add a file to the website during deployment.\n- `addJson` — `preflight (path: str, data: Json): str` — Add a JSON file with custom values during the website's deployment.\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." + value: "```wing\nclass Website impl IWebsite\n```\n---\nA cloud static website.\n\n### Initializer\n- `...props` — `WebsiteProps`\n \n - `path` — `str` — Local path to the website's static files, relative to the Wing source file or absolute.\n - `domain?` — `Domain?` — The website's custom domain object.\n - `errorDocument?` — `str?` — Name of the error document for the website.\n### Fields\n- `node` — `Node` — The tree node.\n- `path` — `str` — Absolute local path to the website's static files.\n- `url` — `str` — The website's url.\n### Methods\n- `addFile` — `preflight (path: str, data: str, options: AddFileOptions?): str` — Add a file to the website during deployment.\n- `addJson` — `preflight (path: str, data: Json): str` — Add a JSON file with custom values during the website's deployment.\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." sortText: gg|Website - label: AddFileOptions kind: 22 @@ -221,7 +221,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct BucketTryGetOptions extends BucketGetOptions\n```\n---\nOptions for `Bucket.tryGet()`.\n### Fields\n- `endByte?` — `num?`\n- `startByte?` — `num?`" + value: "```wing\nstruct BucketTryGetOptions extends BucketGetOptions\n```\n---\nOptions for `Bucket.tryGet()`.\n### Fields\n- `endByte?` — `num?` — The ending byte to read up to (including).\n- `startByte?` — `num?` — The starting byte to read from." sortText: hh|BucketTryGetOptions - label: CorsHeaders kind: 22 @@ -275,7 +275,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct OnDeployProps extends FunctionProps\n```\n---\nOptions for `OnDeploy`.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n- `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct OnDeployProps extends FunctionProps\n```\n---\nOptions for `OnDeploy`.\n### Fields\n- `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n- `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." sortText: hh|OnDeployProps - label: QueueProps kind: 22 @@ -287,13 +287,13 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct QueueSetConsumerOptions extends FunctionProps\n```\n---\nOptions for Queue.setConsumer.\n### Fields\n- `batchSize?` — `num?` — The maximum number of messages to send to subscribers at once.\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct QueueSetConsumerOptions extends FunctionProps\n```\n---\nOptions for Queue.setConsumer.\n### Fields\n- `batchSize?` — `num?` — The maximum number of messages to send to subscribers at once.\n- `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." sortText: hh|QueueSetConsumerOptions - label: ScheduleOnTickOptions kind: 22 documentation: kind: markdown - value: "```wing\nstruct ScheduleOnTickOptions extends FunctionProps\n```\n---\nOptions for Schedule.onTick.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct ScheduleOnTickOptions extends FunctionProps\n```\n---\nOptions for Schedule.onTick.\n### Fields\n- `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." sortText: hh|ScheduleOnTickOptions - label: ScheduleProps kind: 22 @@ -311,7 +311,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct ServiceOnStartOptions extends FunctionProps\n```\n---\nOptions for Service.onStart.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct ServiceOnStartOptions extends FunctionProps\n```\n---\nOptions for Service.onStart.\n### Fields\n- `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." sortText: hh|ServiceOnStartOptions - label: ServiceProps kind: 22 @@ -323,7 +323,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct TopicOnMessageOptions extends FunctionProps\n```\n---\nOptions for `Topic.onMessage`.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct TopicOnMessageOptions extends FunctionProps\n```\n---\nOptions for `Topic.onMessage`.\n### Fields\n- `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." sortText: hh|TopicOnMessageOptions - label: TopicProps kind: 22 @@ -335,7 +335,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct TopicSubscribeQueueOptions extends QueueProps\n```\n---\nOptions for `Topic.subscribeQueue`.\n### Fields\n- `dlq?` — `DeadLetterQueueProps?`\n- `retentionPeriod?` — `duration?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct TopicSubscribeQueueOptions extends QueueProps\n```\n---\nOptions for `Topic.subscribeQueue`.\n### Fields\n- `dlq?` — `DeadLetterQueueProps?` — A dead-letter queue.\n- `retentionPeriod?` — `duration?` — How long a queue retains a message.\n- `timeout?` — `duration?` — How long a queue's consumers have to process a message." sortText: hh|TopicSubscribeQueueOptions - label: WebsiteDomainOptions kind: 22 @@ -353,7 +353,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct WebsiteProps extends WebsiteOptions, WebsiteDomainOptions\n```\n---\nOptions for `Website`.\n### Fields\n- `path` — `str`\n- `domain?` — `Domain?`\n- `errorDocument?` — `str?`" + value: "```wing\nstruct WebsiteProps extends WebsiteOptions, WebsiteDomainOptions\n```\n---\nOptions for `Website`.\n### Fields\n- `path` — `str` — Local path to the website's static files, relative to the Wing source file or absolute.\n- `domain?` — `Domain?` — The website's custom domain object.\n- `errorDocument?` — `str?` — Name of the error document for the website." sortText: hh|WebsiteProps - label: IApiClient kind: 8 @@ -365,7 +365,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IApiEndpointHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to one of the `Api` request preflight methods.\n### Methods\n- `handle` — `inflight (request: ApiRequest): ApiResponse?` — Inflight that will be called when a request is made to the endpoint.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IApiEndpointHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to one of the `Api` request preflight methods.\n### Methods\n- `handle` — `inflight (request: ApiRequest): ApiResponse?` — Inflight that will be called when a request is made to the endpoint.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IApiEndpointHandler - label: IApiEndpointHandlerClient kind: 8 @@ -383,7 +383,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IBucketEventHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to the bucket events.\n### Methods\n- `handle` — `inflight (key: str, type: BucketEventType): void` — Function that will be called when an event notification is fired.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IBucketEventHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to the bucket events.\n### Methods\n- `handle` — `inflight (key: str, type: BucketEventType): void` — Function that will be called when an event notification is fired.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IBucketEventHandler - label: IBucketEventHandlerClient kind: 8 @@ -419,7 +419,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IFunctionHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be used to create a `cloud.Function`.\n### Methods\n- `handle` — `inflight (event: str?): str?` — Entrypoint function that will be called when the cloud function is invoked.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IFunctionHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be used to create a `cloud.Function`.\n### Methods\n- `handle` — `inflight (event: str?): str?` — Entrypoint function that will be called when the cloud function is invoked.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IFunctionHandler - label: IFunctionHandlerClient kind: 8 @@ -437,7 +437,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IOnDeployHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be used by `cloud.OnDeploy`.\n### Methods\n- `handle` — `inflight (): void` — Entrypoint function that will be called when the app is deployed.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IOnDeployHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be used by `cloud.OnDeploy`.\n### Methods\n- `handle` — `inflight (): void` — Entrypoint function that will be called when the app is deployed.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IOnDeployHandler - label: IOnDeployHandlerClient kind: 8 @@ -455,7 +455,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IQueueSetConsumerHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to `Queue.setConsumer`.\n### Methods\n- `handle` — `inflight (message: str): void` — Function that will be called when a message is received from the queue.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IQueueSetConsumerHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to `Queue.setConsumer`.\n### Methods\n- `handle` — `inflight (message: str): void` — Function that will be called when a message is received from the queue.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IQueueSetConsumerHandler - label: IQueueSetConsumerHandlerClient kind: 8 @@ -473,7 +473,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IScheduleOnTickHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to `Schedule.on_tick`.\n### Methods\n- `handle` — `inflight (): void` — Function that will be called when a message is received from the schedule.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IScheduleOnTickHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to `Schedule.on_tick`.\n### Methods\n- `handle` — `inflight (): void` — Function that will be called when a message is received from the schedule.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IScheduleOnTickHandler - label: IScheduleOnTickHandlerClient kind: 8 @@ -497,7 +497,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IServiceHandler extends IInflight\n```\n---\nExecuted when a `cloud.Service` is started.\n### Methods\n- `handle` — `inflight (): inflight (): void?` — Handler to run when the service starts.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IServiceHandler extends IInflight\n```\n---\nExecuted when a `cloud.Service` is started.\n### Methods\n- `handle` — `inflight (): inflight (): void?` — Handler to run when the service starts.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IServiceHandler - label: IServiceHandlerClient kind: 8 @@ -509,7 +509,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IServiceStopHandler extends IInflight\n```\n---\nExecuted when a `cloud.Service` is stopped.\n### Methods\n- `handle` — `inflight (): void` — Handler to run when the service stops.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IServiceStopHandler extends IInflight\n```\n---\nExecuted when a `cloud.Service` is stopped.\n### Methods\n- `handle` — `inflight (): void` — Handler to run when the service stops.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IServiceStopHandler - label: IServiceStopHandlerClient kind: 8 @@ -527,7 +527,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface ITopicOnMessageHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to `Topic.on_message`.\n### Methods\n- `handle` — `inflight (event: str): void` — Function that will be called when a message is received from the topic.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface ITopicOnMessageHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to `Topic.on_message`.\n### Methods\n- `handle` — `inflight (event: str): void` — Function that will be called when a message is received from the topic.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|ITopicOnMessageHandler - label: ITopicOnMessageHandlerClient kind: 8 @@ -551,18 +551,18 @@ source: libs/wingc/src/lsp/completions.rs kind: 13 documentation: kind: markdown - value: "```wing\nenum BucketEventType\n```\n---\nBucket events to subscribe to.\n- `CREATE`\n- `DELETE`\n- `UPDATE`" + value: "```wing\nenum BucketEventType\n```\n---\nBucket events to subscribe to.\n- `CREATE — Create.`\n- `DELETE — Delete.`\n- `UPDATE — Update.`" sortText: jj|BucketEventType - label: BucketSignedUrlAction kind: 13 documentation: kind: markdown - value: "```wing\nenum BucketSignedUrlAction\n```\n---\nSpecifies the action permitted by a presigned URL for a bucket.\n- `DOWNLOAD`\n- `UPLOAD`" + value: "```wing\nenum BucketSignedUrlAction\n```\n---\nSpecifies the action permitted by a presigned URL for a bucket.\n- `DOWNLOAD — Represents a HTTP GET request for a presigned URL, allowing read access for an object in the bucket.`\n- `UPLOAD — Represents a HTTP PUT request for a presigned URL, allowing write access for an object in the bucket.`" sortText: jj|BucketSignedUrlAction - label: HttpMethod kind: 13 documentation: kind: markdown - value: "```wing\nenum HttpMethod\n```\n---\nAllowed HTTP methods for a endpoint.\n- `GET`\n- `HEAD`\n- `POST`\n- `PUT`\n- `DELETE`\n- `CONNECT`\n- `OPTIONS`\n- `PATCH`" + value: "```wing\nenum HttpMethod\n```\n---\nAllowed HTTP methods for a endpoint.\n- `GET — Get.`\n- `HEAD — Head.`\n- `POST — Post.`\n- `PUT — Put.`\n- `DELETE — Delete.`\n- `CONNECT — Connect.`\n- `OPTIONS — Options.`\n- `PATCH — Patch.`" sortText: jj|HttpMethod diff --git a/libs/wingc/src/lsp/snapshots/completions/namespace_inflight.snap b/libs/wingc/src/lsp/snapshots/completions/namespace_inflight.snap index b305bdddf93..5dd4bbccc03 100644 --- a/libs/wingc/src/lsp/snapshots/completions/namespace_inflight.snap +++ b/libs/wingc/src/lsp/snapshots/completions/namespace_inflight.snap @@ -131,18 +131,18 @@ source: libs/wingc/src/lsp/completions.rs kind: 13 documentation: kind: markdown - value: "```wing\nenum HttpMethod\n```\n---\nThe request's method.\n- `GET`\n- `PUT`\n- `DELETE`\n- `PATCH`\n- `POST`\n- `OPTIONS`\n- `HEAD`" + value: "```wing\nenum HttpMethod\n```\n---\nThe request's method.\n- `GET — GET.`\n- `PUT — PUT.`\n- `DELETE — DELETE.`\n- `PATCH — PATCH.`\n- `POST — POST.`\n- `OPTIONS — OPTIONS.`\n- `HEAD — HEAD.`" sortText: jj|HttpMethod - label: RequestCache kind: 13 documentation: kind: markdown - value: "```wing\nenum RequestCache\n```\n---\nThe cache mode of the request.\n- `DEFAULT`\n- `NO_STORE`\n- `RELOAD`\n- `NO_CACHE`\n- `FORCE_CACHE`\n\n\n### Remarks\nIt controls how a request will interact with the system's HTTP cache." + value: "```wing\nenum RequestCache\n```\n---\nThe cache mode of the request.\n- `DEFAULT — The runtime environment looks for a matching request in its HTTP cache.`\n- `NO_STORE — The runtime environment fetches the resource from the remote server without first looking in the cache, and will not update the cache with the downloaded resource.`\n- `RELOAD — The runtime environment fetches the resource from the remote server without first looking in the cache, but then will update the cache with the downloaded resource.`\n- `NO_CACHE — The runtime environment looks for a matching request in its HTTP cache.`\n- `FORCE_CACHE — The runtime environment looks for a matching request in its HTTP cache.`\n\n\n### Remarks\nIt controls how a request will interact with the system's HTTP cache." sortText: jj|RequestCache - label: RequestRedirect kind: 13 documentation: kind: markdown - value: "```wing\nenum RequestRedirect\n```\n---\nThe redirect read-only property that contains the mode for how redirects are handled.\n- `MANUAL`\n- `FOLLOW`\n- `ERROR`" + value: "```wing\nenum RequestRedirect\n```\n---\nThe redirect read-only property that contains the mode for how redirects are handled.\n- `MANUAL — Do not follow redirects automatically.`\n- `FOLLOW — Follow all redirects incurred when fetching a resource.`\n- `ERROR — Return a network error when a request is met with a redirect.`" sortText: jj|RequestRedirect diff --git a/libs/wingc/src/lsp/snapshots/completions/namespace_middle_dot.snap b/libs/wingc/src/lsp/snapshots/completions/namespace_middle_dot.snap index 85029c605a7..f2a5773dfb8 100644 --- a/libs/wingc/src/lsp/snapshots/completions/namespace_middle_dot.snap +++ b/libs/wingc/src/lsp/snapshots/completions/namespace_middle_dot.snap @@ -41,7 +41,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 7 documentation: kind: markdown - value: "```wing\nclass OnDeploy\n```\n---\nRun code every time the app is deployed.\n\n### Initializer\n- `handler` — `inflight (): void`\n- `...props` — `OnDeployProps?`\n \n - `concurrency?` — `num?`\n - `env?` — `Map?`\n - `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n - `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n - `logRetentionDays?` — `num?`\n - `memory?` — `num?`\n - `timeout?` — `duration?`\n### Fields\n- `node` — `Node` — The tree node.\n### Methods\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." + value: "```wing\nclass OnDeploy\n```\n---\nRun code every time the app is deployed.\n\n### Initializer\n- `handler` — `inflight (): void`\n- `...props` — `OnDeployProps?`\n \n - `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n - `env?` — `Map?` — Environment variables to pass to the function.\n - `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n - `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n - `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n - `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n - `timeout?` — `duration?` — The maximum amount of time the function can run.\n### Fields\n- `node` — `Node` — The tree node.\n### Methods\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." sortText: gg|OnDeploy - label: Queue kind: 7 @@ -77,7 +77,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 7 documentation: kind: markdown - value: "```wing\nclass Website impl IWebsite\n```\n---\nA cloud static website.\n\n### Initializer\n- `...props` — `WebsiteProps`\n \n - `path` — `str`\n - `domain?` — `Domain?`\n - `errorDocument?` — `str?`\n### Fields\n- `node` — `Node` — The tree node.\n- `path` — `str` — Absolute local path to the website's static files.\n- `url` — `str` — The website's url.\n### Methods\n- `addFile` — `preflight (path: str, data: str, options: AddFileOptions?): str` — Add a file to the website during deployment.\n- `addJson` — `preflight (path: str, data: Json): str` — Add a JSON file with custom values during the website's deployment.\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." + value: "```wing\nclass Website impl IWebsite\n```\n---\nA cloud static website.\n\n### Initializer\n- `...props` — `WebsiteProps`\n \n - `path` — `str` — Local path to the website's static files, relative to the Wing source file or absolute.\n - `domain?` — `Domain?` — The website's custom domain object.\n - `errorDocument?` — `str?` — Name of the error document for the website.\n### Fields\n- `node` — `Node` — The tree node.\n- `path` — `str` — Absolute local path to the website's static files.\n- `url` — `str` — The website's url.\n### Methods\n- `addFile` — `preflight (path: str, data: str, options: AddFileOptions?): str` — Add a file to the website during deployment.\n- `addJson` — `preflight (path: str, data: Json): str` — Add a JSON file with custom values during the website's deployment.\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." sortText: gg|Website - label: AddFileOptions kind: 22 @@ -221,7 +221,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct BucketTryGetOptions extends BucketGetOptions\n```\n---\nOptions for `Bucket.tryGet()`.\n### Fields\n- `endByte?` — `num?`\n- `startByte?` — `num?`" + value: "```wing\nstruct BucketTryGetOptions extends BucketGetOptions\n```\n---\nOptions for `Bucket.tryGet()`.\n### Fields\n- `endByte?` — `num?` — The ending byte to read up to (including).\n- `startByte?` — `num?` — The starting byte to read from." sortText: hh|BucketTryGetOptions - label: CorsHeaders kind: 22 @@ -275,7 +275,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct OnDeployProps extends FunctionProps\n```\n---\nOptions for `OnDeploy`.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n- `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct OnDeployProps extends FunctionProps\n```\n---\nOptions for `OnDeploy`.\n### Fields\n- `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n- `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." sortText: hh|OnDeployProps - label: QueueProps kind: 22 @@ -287,13 +287,13 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct QueueSetConsumerOptions extends FunctionProps\n```\n---\nOptions for Queue.setConsumer.\n### Fields\n- `batchSize?` — `num?` — The maximum number of messages to send to subscribers at once.\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct QueueSetConsumerOptions extends FunctionProps\n```\n---\nOptions for Queue.setConsumer.\n### Fields\n- `batchSize?` — `num?` — The maximum number of messages to send to subscribers at once.\n- `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." sortText: hh|QueueSetConsumerOptions - label: ScheduleOnTickOptions kind: 22 documentation: kind: markdown - value: "```wing\nstruct ScheduleOnTickOptions extends FunctionProps\n```\n---\nOptions for Schedule.onTick.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct ScheduleOnTickOptions extends FunctionProps\n```\n---\nOptions for Schedule.onTick.\n### Fields\n- `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." sortText: hh|ScheduleOnTickOptions - label: ScheduleProps kind: 22 @@ -311,7 +311,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct ServiceOnStartOptions extends FunctionProps\n```\n---\nOptions for Service.onStart.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct ServiceOnStartOptions extends FunctionProps\n```\n---\nOptions for Service.onStart.\n### Fields\n- `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." sortText: hh|ServiceOnStartOptions - label: ServiceProps kind: 22 @@ -323,7 +323,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct TopicOnMessageOptions extends FunctionProps\n```\n---\nOptions for `Topic.onMessage`.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct TopicOnMessageOptions extends FunctionProps\n```\n---\nOptions for `Topic.onMessage`.\n### Fields\n- `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." sortText: hh|TopicOnMessageOptions - label: TopicProps kind: 22 @@ -335,7 +335,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct TopicSubscribeQueueOptions extends QueueProps\n```\n---\nOptions for `Topic.subscribeQueue`.\n### Fields\n- `dlq?` — `DeadLetterQueueProps?`\n- `retentionPeriod?` — `duration?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct TopicSubscribeQueueOptions extends QueueProps\n```\n---\nOptions for `Topic.subscribeQueue`.\n### Fields\n- `dlq?` — `DeadLetterQueueProps?` — A dead-letter queue.\n- `retentionPeriod?` — `duration?` — How long a queue retains a message.\n- `timeout?` — `duration?` — How long a queue's consumers have to process a message." sortText: hh|TopicSubscribeQueueOptions - label: WebsiteDomainOptions kind: 22 @@ -353,7 +353,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct WebsiteProps extends WebsiteOptions, WebsiteDomainOptions\n```\n---\nOptions for `Website`.\n### Fields\n- `path` — `str`\n- `domain?` — `Domain?`\n- `errorDocument?` — `str?`" + value: "```wing\nstruct WebsiteProps extends WebsiteOptions, WebsiteDomainOptions\n```\n---\nOptions for `Website`.\n### Fields\n- `path` — `str` — Local path to the website's static files, relative to the Wing source file or absolute.\n- `domain?` — `Domain?` — The website's custom domain object.\n- `errorDocument?` — `str?` — Name of the error document for the website." sortText: hh|WebsiteProps - label: IApiClient kind: 8 @@ -365,7 +365,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IApiEndpointHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to one of the `Api` request preflight methods.\n### Methods\n- `handle` — `inflight (request: ApiRequest): ApiResponse?` — Inflight that will be called when a request is made to the endpoint.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IApiEndpointHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to one of the `Api` request preflight methods.\n### Methods\n- `handle` — `inflight (request: ApiRequest): ApiResponse?` — Inflight that will be called when a request is made to the endpoint.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IApiEndpointHandler - label: IApiEndpointHandlerClient kind: 8 @@ -383,7 +383,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IBucketEventHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to the bucket events.\n### Methods\n- `handle` — `inflight (key: str, type: BucketEventType): void` — Function that will be called when an event notification is fired.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IBucketEventHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to the bucket events.\n### Methods\n- `handle` — `inflight (key: str, type: BucketEventType): void` — Function that will be called when an event notification is fired.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IBucketEventHandler - label: IBucketEventHandlerClient kind: 8 @@ -419,7 +419,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IFunctionHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be used to create a `cloud.Function`.\n### Methods\n- `handle` — `inflight (event: str?): str?` — Entrypoint function that will be called when the cloud function is invoked.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IFunctionHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be used to create a `cloud.Function`.\n### Methods\n- `handle` — `inflight (event: str?): str?` — Entrypoint function that will be called when the cloud function is invoked.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IFunctionHandler - label: IFunctionHandlerClient kind: 8 @@ -437,7 +437,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IOnDeployHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be used by `cloud.OnDeploy`.\n### Methods\n- `handle` — `inflight (): void` — Entrypoint function that will be called when the app is deployed.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IOnDeployHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be used by `cloud.OnDeploy`.\n### Methods\n- `handle` — `inflight (): void` — Entrypoint function that will be called when the app is deployed.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IOnDeployHandler - label: IOnDeployHandlerClient kind: 8 @@ -455,7 +455,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IQueueSetConsumerHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to `Queue.setConsumer`.\n### Methods\n- `handle` — `inflight (message: str): void` — Function that will be called when a message is received from the queue.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IQueueSetConsumerHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to `Queue.setConsumer`.\n### Methods\n- `handle` — `inflight (message: str): void` — Function that will be called when a message is received from the queue.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IQueueSetConsumerHandler - label: IQueueSetConsumerHandlerClient kind: 8 @@ -473,7 +473,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IScheduleOnTickHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to `Schedule.on_tick`.\n### Methods\n- `handle` — `inflight (): void` — Function that will be called when a message is received from the schedule.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IScheduleOnTickHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to `Schedule.on_tick`.\n### Methods\n- `handle` — `inflight (): void` — Function that will be called when a message is received from the schedule.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IScheduleOnTickHandler - label: IScheduleOnTickHandlerClient kind: 8 @@ -497,7 +497,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IServiceHandler extends IInflight\n```\n---\nExecuted when a `cloud.Service` is started.\n### Methods\n- `handle` — `inflight (): inflight (): void?` — Handler to run when the service starts.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IServiceHandler extends IInflight\n```\n---\nExecuted when a `cloud.Service` is started.\n### Methods\n- `handle` — `inflight (): inflight (): void?` — Handler to run when the service starts.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IServiceHandler - label: IServiceHandlerClient kind: 8 @@ -509,7 +509,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IServiceStopHandler extends IInflight\n```\n---\nExecuted when a `cloud.Service` is stopped.\n### Methods\n- `handle` — `inflight (): void` — Handler to run when the service stops.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IServiceStopHandler extends IInflight\n```\n---\nExecuted when a `cloud.Service` is stopped.\n### Methods\n- `handle` — `inflight (): void` — Handler to run when the service stops.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IServiceStopHandler - label: IServiceStopHandlerClient kind: 8 @@ -527,7 +527,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface ITopicOnMessageHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to `Topic.on_message`.\n### Methods\n- `handle` — `inflight (event: str): void` — Function that will be called when a message is received from the topic.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface ITopicOnMessageHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to `Topic.on_message`.\n### Methods\n- `handle` — `inflight (event: str): void` — Function that will be called when a message is received from the topic.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|ITopicOnMessageHandler - label: ITopicOnMessageHandlerClient kind: 8 @@ -551,18 +551,18 @@ source: libs/wingc/src/lsp/completions.rs kind: 13 documentation: kind: markdown - value: "```wing\nenum BucketEventType\n```\n---\nBucket events to subscribe to.\n- `CREATE`\n- `DELETE`\n- `UPDATE`" + value: "```wing\nenum BucketEventType\n```\n---\nBucket events to subscribe to.\n- `CREATE — Create.`\n- `DELETE — Delete.`\n- `UPDATE — Update.`" sortText: jj|BucketEventType - label: BucketSignedUrlAction kind: 13 documentation: kind: markdown - value: "```wing\nenum BucketSignedUrlAction\n```\n---\nSpecifies the action permitted by a presigned URL for a bucket.\n- `DOWNLOAD`\n- `UPLOAD`" + value: "```wing\nenum BucketSignedUrlAction\n```\n---\nSpecifies the action permitted by a presigned URL for a bucket.\n- `DOWNLOAD — Represents a HTTP GET request for a presigned URL, allowing read access for an object in the bucket.`\n- `UPLOAD — Represents a HTTP PUT request for a presigned URL, allowing write access for an object in the bucket.`" sortText: jj|BucketSignedUrlAction - label: HttpMethod kind: 13 documentation: kind: markdown - value: "```wing\nenum HttpMethod\n```\n---\nAllowed HTTP methods for a endpoint.\n- `GET`\n- `HEAD`\n- `POST`\n- `PUT`\n- `DELETE`\n- `CONNECT`\n- `OPTIONS`\n- `PATCH`" + value: "```wing\nenum HttpMethod\n```\n---\nAllowed HTTP methods for a endpoint.\n- `GET — Get.`\n- `HEAD — Head.`\n- `POST — Post.`\n- `PUT — Put.`\n- `DELETE — Delete.`\n- `CONNECT — Connect.`\n- `OPTIONS — Options.`\n- `PATCH — Patch.`" sortText: jj|HttpMethod diff --git a/libs/wingc/src/lsp/snapshots/completions/new_expression_nested.snap b/libs/wingc/src/lsp/snapshots/completions/new_expression_nested.snap index afec5aff116..8d7edf884b5 100644 --- a/libs/wingc/src/lsp/snapshots/completions/new_expression_nested.snap +++ b/libs/wingc/src/lsp/snapshots/completions/new_expression_nested.snap @@ -71,7 +71,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 7 documentation: kind: markdown - value: "```wing\nclass OnDeploy\n```\n---\nRun code every time the app is deployed.\n\n### Initializer\n- `handler` — `inflight (): void`\n- `...props` — `OnDeployProps?`\n \n - `concurrency?` — `num?`\n - `env?` — `Map?`\n - `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n - `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n - `logRetentionDays?` — `num?`\n - `memory?` — `num?`\n - `timeout?` — `duration?`\n### Fields\n- `node` — `Node` — The tree node.\n### Methods\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." + value: "```wing\nclass OnDeploy\n```\n---\nRun code every time the app is deployed.\n\n### Initializer\n- `handler` — `inflight (): void`\n- `...props` — `OnDeployProps?`\n \n - `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n - `env?` — `Map?` — Environment variables to pass to the function.\n - `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n - `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n - `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n - `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n - `timeout?` — `duration?` — The maximum amount of time the function can run.\n### Fields\n- `node` — `Node` — The tree node.\n### Methods\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." sortText: gg|OnDeploy insertText: OnDeploy($1) insertTextFormat: 2 @@ -137,7 +137,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 7 documentation: kind: markdown - value: "```wing\nclass Website impl IWebsite\n```\n---\nA cloud static website.\n\n### Initializer\n- `...props` — `WebsiteProps`\n \n - `path` — `str`\n - `domain?` — `Domain?`\n - `errorDocument?` — `str?`\n### Fields\n- `node` — `Node` — The tree node.\n- `path` — `str` — Absolute local path to the website's static files.\n- `url` — `str` — The website's url.\n### Methods\n- `addFile` — `preflight (path: str, data: str, options: AddFileOptions?): str` — Add a file to the website during deployment.\n- `addJson` — `preflight (path: str, data: Json): str` — Add a JSON file with custom values during the website's deployment.\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." + value: "```wing\nclass Website impl IWebsite\n```\n---\nA cloud static website.\n\n### Initializer\n- `...props` — `WebsiteProps`\n \n - `path` — `str` — Local path to the website's static files, relative to the Wing source file or absolute.\n - `domain?` — `Domain?` — The website's custom domain object.\n - `errorDocument?` — `str?` — Name of the error document for the website.\n### Fields\n- `node` — `Node` — The tree node.\n- `path` — `str` — Absolute local path to the website's static files.\n- `url` — `str` — The website's url.\n### Methods\n- `addFile` — `preflight (path: str, data: str, options: AddFileOptions?): str` — Add a file to the website during deployment.\n- `addJson` — `preflight (path: str, data: Json): str` — Add a JSON file with custom values during the website's deployment.\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." sortText: gg|Website insertText: Website($1) insertTextFormat: 2 diff --git a/libs/wingc/src/lsp/snapshots/completions/partial_type_reference_annotation.snap b/libs/wingc/src/lsp/snapshots/completions/partial_type_reference_annotation.snap index 85029c605a7..f2a5773dfb8 100644 --- a/libs/wingc/src/lsp/snapshots/completions/partial_type_reference_annotation.snap +++ b/libs/wingc/src/lsp/snapshots/completions/partial_type_reference_annotation.snap @@ -41,7 +41,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 7 documentation: kind: markdown - value: "```wing\nclass OnDeploy\n```\n---\nRun code every time the app is deployed.\n\n### Initializer\n- `handler` — `inflight (): void`\n- `...props` — `OnDeployProps?`\n \n - `concurrency?` — `num?`\n - `env?` — `Map?`\n - `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n - `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n - `logRetentionDays?` — `num?`\n - `memory?` — `num?`\n - `timeout?` — `duration?`\n### Fields\n- `node` — `Node` — The tree node.\n### Methods\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." + value: "```wing\nclass OnDeploy\n```\n---\nRun code every time the app is deployed.\n\n### Initializer\n- `handler` — `inflight (): void`\n- `...props` — `OnDeployProps?`\n \n - `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n - `env?` — `Map?` — Environment variables to pass to the function.\n - `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n - `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n - `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n - `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n - `timeout?` — `duration?` — The maximum amount of time the function can run.\n### Fields\n- `node` — `Node` — The tree node.\n### Methods\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." sortText: gg|OnDeploy - label: Queue kind: 7 @@ -77,7 +77,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 7 documentation: kind: markdown - value: "```wing\nclass Website impl IWebsite\n```\n---\nA cloud static website.\n\n### Initializer\n- `...props` — `WebsiteProps`\n \n - `path` — `str`\n - `domain?` — `Domain?`\n - `errorDocument?` — `str?`\n### Fields\n- `node` — `Node` — The tree node.\n- `path` — `str` — Absolute local path to the website's static files.\n- `url` — `str` — The website's url.\n### Methods\n- `addFile` — `preflight (path: str, data: str, options: AddFileOptions?): str` — Add a file to the website during deployment.\n- `addJson` — `preflight (path: str, data: Json): str` — Add a JSON file with custom values during the website's deployment.\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." + value: "```wing\nclass Website impl IWebsite\n```\n---\nA cloud static website.\n\n### Initializer\n- `...props` — `WebsiteProps`\n \n - `path` — `str` — Local path to the website's static files, relative to the Wing source file or absolute.\n - `domain?` — `Domain?` — The website's custom domain object.\n - `errorDocument?` — `str?` — Name of the error document for the website.\n### Fields\n- `node` — `Node` — The tree node.\n- `path` — `str` — Absolute local path to the website's static files.\n- `url` — `str` — The website's url.\n### Methods\n- `addFile` — `preflight (path: str, data: str, options: AddFileOptions?): str` — Add a file to the website during deployment.\n- `addJson` — `preflight (path: str, data: Json): str` — Add a JSON file with custom values during the website's deployment.\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." sortText: gg|Website - label: AddFileOptions kind: 22 @@ -221,7 +221,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct BucketTryGetOptions extends BucketGetOptions\n```\n---\nOptions for `Bucket.tryGet()`.\n### Fields\n- `endByte?` — `num?`\n- `startByte?` — `num?`" + value: "```wing\nstruct BucketTryGetOptions extends BucketGetOptions\n```\n---\nOptions for `Bucket.tryGet()`.\n### Fields\n- `endByte?` — `num?` — The ending byte to read up to (including).\n- `startByte?` — `num?` — The starting byte to read from." sortText: hh|BucketTryGetOptions - label: CorsHeaders kind: 22 @@ -275,7 +275,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct OnDeployProps extends FunctionProps\n```\n---\nOptions for `OnDeploy`.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n- `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct OnDeployProps extends FunctionProps\n```\n---\nOptions for `OnDeploy`.\n### Fields\n- `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n- `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." sortText: hh|OnDeployProps - label: QueueProps kind: 22 @@ -287,13 +287,13 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct QueueSetConsumerOptions extends FunctionProps\n```\n---\nOptions for Queue.setConsumer.\n### Fields\n- `batchSize?` — `num?` — The maximum number of messages to send to subscribers at once.\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct QueueSetConsumerOptions extends FunctionProps\n```\n---\nOptions for Queue.setConsumer.\n### Fields\n- `batchSize?` — `num?` — The maximum number of messages to send to subscribers at once.\n- `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." sortText: hh|QueueSetConsumerOptions - label: ScheduleOnTickOptions kind: 22 documentation: kind: markdown - value: "```wing\nstruct ScheduleOnTickOptions extends FunctionProps\n```\n---\nOptions for Schedule.onTick.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct ScheduleOnTickOptions extends FunctionProps\n```\n---\nOptions for Schedule.onTick.\n### Fields\n- `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." sortText: hh|ScheduleOnTickOptions - label: ScheduleProps kind: 22 @@ -311,7 +311,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct ServiceOnStartOptions extends FunctionProps\n```\n---\nOptions for Service.onStart.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct ServiceOnStartOptions extends FunctionProps\n```\n---\nOptions for Service.onStart.\n### Fields\n- `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." sortText: hh|ServiceOnStartOptions - label: ServiceProps kind: 22 @@ -323,7 +323,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct TopicOnMessageOptions extends FunctionProps\n```\n---\nOptions for `Topic.onMessage`.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct TopicOnMessageOptions extends FunctionProps\n```\n---\nOptions for `Topic.onMessage`.\n### Fields\n- `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." sortText: hh|TopicOnMessageOptions - label: TopicProps kind: 22 @@ -335,7 +335,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct TopicSubscribeQueueOptions extends QueueProps\n```\n---\nOptions for `Topic.subscribeQueue`.\n### Fields\n- `dlq?` — `DeadLetterQueueProps?`\n- `retentionPeriod?` — `duration?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct TopicSubscribeQueueOptions extends QueueProps\n```\n---\nOptions for `Topic.subscribeQueue`.\n### Fields\n- `dlq?` — `DeadLetterQueueProps?` — A dead-letter queue.\n- `retentionPeriod?` — `duration?` — How long a queue retains a message.\n- `timeout?` — `duration?` — How long a queue's consumers have to process a message." sortText: hh|TopicSubscribeQueueOptions - label: WebsiteDomainOptions kind: 22 @@ -353,7 +353,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct WebsiteProps extends WebsiteOptions, WebsiteDomainOptions\n```\n---\nOptions for `Website`.\n### Fields\n- `path` — `str`\n- `domain?` — `Domain?`\n- `errorDocument?` — `str?`" + value: "```wing\nstruct WebsiteProps extends WebsiteOptions, WebsiteDomainOptions\n```\n---\nOptions for `Website`.\n### Fields\n- `path` — `str` — Local path to the website's static files, relative to the Wing source file or absolute.\n- `domain?` — `Domain?` — The website's custom domain object.\n- `errorDocument?` — `str?` — Name of the error document for the website." sortText: hh|WebsiteProps - label: IApiClient kind: 8 @@ -365,7 +365,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IApiEndpointHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to one of the `Api` request preflight methods.\n### Methods\n- `handle` — `inflight (request: ApiRequest): ApiResponse?` — Inflight that will be called when a request is made to the endpoint.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IApiEndpointHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to one of the `Api` request preflight methods.\n### Methods\n- `handle` — `inflight (request: ApiRequest): ApiResponse?` — Inflight that will be called when a request is made to the endpoint.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IApiEndpointHandler - label: IApiEndpointHandlerClient kind: 8 @@ -383,7 +383,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IBucketEventHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to the bucket events.\n### Methods\n- `handle` — `inflight (key: str, type: BucketEventType): void` — Function that will be called when an event notification is fired.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IBucketEventHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to the bucket events.\n### Methods\n- `handle` — `inflight (key: str, type: BucketEventType): void` — Function that will be called when an event notification is fired.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IBucketEventHandler - label: IBucketEventHandlerClient kind: 8 @@ -419,7 +419,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IFunctionHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be used to create a `cloud.Function`.\n### Methods\n- `handle` — `inflight (event: str?): str?` — Entrypoint function that will be called when the cloud function is invoked.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IFunctionHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be used to create a `cloud.Function`.\n### Methods\n- `handle` — `inflight (event: str?): str?` — Entrypoint function that will be called when the cloud function is invoked.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IFunctionHandler - label: IFunctionHandlerClient kind: 8 @@ -437,7 +437,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IOnDeployHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be used by `cloud.OnDeploy`.\n### Methods\n- `handle` — `inflight (): void` — Entrypoint function that will be called when the app is deployed.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IOnDeployHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be used by `cloud.OnDeploy`.\n### Methods\n- `handle` — `inflight (): void` — Entrypoint function that will be called when the app is deployed.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IOnDeployHandler - label: IOnDeployHandlerClient kind: 8 @@ -455,7 +455,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IQueueSetConsumerHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to `Queue.setConsumer`.\n### Methods\n- `handle` — `inflight (message: str): void` — Function that will be called when a message is received from the queue.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IQueueSetConsumerHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to `Queue.setConsumer`.\n### Methods\n- `handle` — `inflight (message: str): void` — Function that will be called when a message is received from the queue.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IQueueSetConsumerHandler - label: IQueueSetConsumerHandlerClient kind: 8 @@ -473,7 +473,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IScheduleOnTickHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to `Schedule.on_tick`.\n### Methods\n- `handle` — `inflight (): void` — Function that will be called when a message is received from the schedule.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IScheduleOnTickHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to `Schedule.on_tick`.\n### Methods\n- `handle` — `inflight (): void` — Function that will be called when a message is received from the schedule.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IScheduleOnTickHandler - label: IScheduleOnTickHandlerClient kind: 8 @@ -497,7 +497,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IServiceHandler extends IInflight\n```\n---\nExecuted when a `cloud.Service` is started.\n### Methods\n- `handle` — `inflight (): inflight (): void?` — Handler to run when the service starts.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IServiceHandler extends IInflight\n```\n---\nExecuted when a `cloud.Service` is started.\n### Methods\n- `handle` — `inflight (): inflight (): void?` — Handler to run when the service starts.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IServiceHandler - label: IServiceHandlerClient kind: 8 @@ -509,7 +509,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IServiceStopHandler extends IInflight\n```\n---\nExecuted when a `cloud.Service` is stopped.\n### Methods\n- `handle` — `inflight (): void` — Handler to run when the service stops.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IServiceStopHandler extends IInflight\n```\n---\nExecuted when a `cloud.Service` is stopped.\n### Methods\n- `handle` — `inflight (): void` — Handler to run when the service stops.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IServiceStopHandler - label: IServiceStopHandlerClient kind: 8 @@ -527,7 +527,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface ITopicOnMessageHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to `Topic.on_message`.\n### Methods\n- `handle` — `inflight (event: str): void` — Function that will be called when a message is received from the topic.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface ITopicOnMessageHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to `Topic.on_message`.\n### Methods\n- `handle` — `inflight (event: str): void` — Function that will be called when a message is received from the topic.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|ITopicOnMessageHandler - label: ITopicOnMessageHandlerClient kind: 8 @@ -551,18 +551,18 @@ source: libs/wingc/src/lsp/completions.rs kind: 13 documentation: kind: markdown - value: "```wing\nenum BucketEventType\n```\n---\nBucket events to subscribe to.\n- `CREATE`\n- `DELETE`\n- `UPDATE`" + value: "```wing\nenum BucketEventType\n```\n---\nBucket events to subscribe to.\n- `CREATE — Create.`\n- `DELETE — Delete.`\n- `UPDATE — Update.`" sortText: jj|BucketEventType - label: BucketSignedUrlAction kind: 13 documentation: kind: markdown - value: "```wing\nenum BucketSignedUrlAction\n```\n---\nSpecifies the action permitted by a presigned URL for a bucket.\n- `DOWNLOAD`\n- `UPLOAD`" + value: "```wing\nenum BucketSignedUrlAction\n```\n---\nSpecifies the action permitted by a presigned URL for a bucket.\n- `DOWNLOAD — Represents a HTTP GET request for a presigned URL, allowing read access for an object in the bucket.`\n- `UPLOAD — Represents a HTTP PUT request for a presigned URL, allowing write access for an object in the bucket.`" sortText: jj|BucketSignedUrlAction - label: HttpMethod kind: 13 documentation: kind: markdown - value: "```wing\nenum HttpMethod\n```\n---\nAllowed HTTP methods for a endpoint.\n- `GET`\n- `HEAD`\n- `POST`\n- `PUT`\n- `DELETE`\n- `CONNECT`\n- `OPTIONS`\n- `PATCH`" + value: "```wing\nenum HttpMethod\n```\n---\nAllowed HTTP methods for a endpoint.\n- `GET — Get.`\n- `HEAD — Head.`\n- `POST — Post.`\n- `PUT — Put.`\n- `DELETE — Delete.`\n- `CONNECT — Connect.`\n- `OPTIONS — Options.`\n- `PATCH — Patch.`" sortText: jj|HttpMethod diff --git a/libs/wingc/src/lsp/snapshots/completions/util_static_methods.snap b/libs/wingc/src/lsp/snapshots/completions/util_static_methods.snap index 4b419dcee40..e119d06190c 100644 --- a/libs/wingc/src/lsp/snapshots/completions/util_static_methods.snap +++ b/libs/wingc/src/lsp/snapshots/completions/util_static_methods.snap @@ -42,7 +42,7 @@ source: libs/wingc/src/lsp/completions.rs detail: "(program: str, args: Array, opts: ExecOptions?): Output" documentation: kind: markdown - value: "```wing\nstatic exec: (program: str, args: Array, opts: ExecOptions?): Output\n```\n---\nExecute a program with the given arguments, wait for it to finish, and return its outputs.\n### Parameters\n- `program` — `str` — The program to execute.\n- `args` — `Array` — An array of arguments to pass to the program.\n- `...opts` — `ExecOptions?` — `ExecOptions`, such as the working directory and environment variables.\n \n - `cwd?` — `str?`\n - `env?` — `Map?`\n - `inheritEnv?` — `bool?`\n\n### Returns\nA struct containing `stdout`, `stderr` and exit `status` of the executed program." + value: "```wing\nstatic exec: (program: str, args: Array, opts: ExecOptions?): Output\n```\n---\nExecute a program with the given arguments, wait for it to finish, and return its outputs.\n### Parameters\n- `program` — `str` — The program to execute.\n- `args` — `Array` — An array of arguments to pass to the program.\n- `...opts` — `ExecOptions?` — `ExecOptions`, such as the working directory and environment variables.\n \n - `cwd?` — `str?` — Path to a directory to run the command in.\n - `env?` — `Map?` — Environment variables.\n - `inheritEnv?` — `bool?` — Whether to inherit environment variables from the host's environment.\n\n### Returns\nA struct containing `stdout`, `stderr` and exit `status` of the executed program." sortText: ff|exec insertText: exec($1) insertTextFormat: 2 @@ -98,7 +98,7 @@ source: libs/wingc/src/lsp/completions.rs detail: "(command: str, opts: ShellOptions?): str" documentation: kind: markdown - value: "```wing\nstatic shell: (command: str, opts: ShellOptions?): str\n```\n---\nExecutes a command in the shell and returns its standard output.\n### Parameters\n- `command` — `str` — The command string to execute in the shell.\n- `...opts` — `ShellOptions?` — `ShellOptions`, such as the working directory and environment variables.\n \n - `cwd?` — `str?`\n - `env?` — `Map?`\n - `inheritEnv?` — `bool?`\n - `throw?` — `bool?` — Whether to throw an error on command execution failure.\n\n### Returns\nThe standard output of the shell command.\n\n*@throws* *An error if the shell command execution fails or returns a non-zero exit code.*" + value: "```wing\nstatic shell: (command: str, opts: ShellOptions?): str\n```\n---\nExecutes a command in the shell and returns its standard output.\n### Parameters\n- `command` — `str` — The command string to execute in the shell.\n- `...opts` — `ShellOptions?` — `ShellOptions`, such as the working directory and environment variables.\n \n - `cwd?` — `str?` — Path to a directory to run the command in.\n - `env?` — `Map?` — Environment variables.\n - `inheritEnv?` — `bool?` — Whether to inherit environment variables from the host's environment.\n - `throw?` — `bool?` — Whether to throw an error on command execution failure.\n\n### Returns\nThe standard output of the shell command.\n\n*@throws* *An error if the shell command execution fails or returns a non-zero exit code.*" sortText: ff|shell insertText: shell($1) insertTextFormat: 2 @@ -141,7 +141,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 7 documentation: kind: markdown - value: "```wing\nclass ChildProcess\n```\n---\nHandle to a running child process.\n\n### Initializer\n- `program` — `str`\n- `args` — `Array`\n- `...opts` — `SpawnOptions?`\n \n - `cwd?` — `str?`\n - `env?` — `Map?`\n - `inheritEnv?` — `bool?`\n - `stderr?` — `Stdio?` — Configuration for the process's standard error stream.\n - `stdin?` — `Stdio?` — Configuration for the process's standard input stream.\n - `stdout?` — `Stdio?` — Configuration for the process's standard output stream.\n### Fields\n- `pid?` — `num?` — The child's OS-assigned process ID.\n### Methods\n- `kill` — `(signal: num?): void` — Kill the process.\n- `wait` — `(): Output` — Wait for the process to finish and return its output." + value: "```wing\nclass ChildProcess\n```\n---\nHandle to a running child process.\n\n### Initializer\n- `program` — `str`\n- `args` — `Array`\n- `...opts` — `SpawnOptions?`\n \n - `cwd?` — `str?` — Path to a directory to run the command in.\n - `env?` — `Map?` — Environment variables.\n - `inheritEnv?` — `bool?` — Whether to inherit environment variables from the host's environment.\n - `stderr?` — `Stdio?` — Configuration for the process's standard error stream.\n - `stdin?` — `Stdio?` — Configuration for the process's standard input stream.\n - `stdout?` — `Stdio?` — Configuration for the process's standard output stream.\n### Fields\n- `pid?` — `num?` — The child's OS-assigned process ID.\n### Methods\n- `kill` — `(signal: num?): void` — Kill the process.\n- `wait` — `(): Output` — Wait for the process to finish and return its output." sortText: gg|ChildProcess - label: Util kind: 7 @@ -159,7 +159,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct ExecOptions extends CommandOptions\n```\n---\nAdditional options for `util.exec()`.\n### Fields\n- `cwd?` — `str?`\n- `env?` — `Map?`\n- `inheritEnv?` — `bool?`" + value: "```wing\nstruct ExecOptions extends CommandOptions\n```\n---\nAdditional options for `util.exec()`.\n### Fields\n- `cwd?` — `str?` — Path to a directory to run the command in.\n- `env?` — `Map?` — Environment variables.\n- `inheritEnv?` — `bool?` — Whether to inherit environment variables from the host's environment." sortText: hh|ExecOptions - label: NanoidOptions kind: 22 @@ -177,13 +177,13 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct ShellOptions extends CommandOptions\n```\n---\nAdditional options for `util.shell()`.\n### Fields\n- `cwd?` — `str?`\n- `env?` — `Map?`\n- `inheritEnv?` — `bool?`\n- `throw?` — `bool?` — Whether to throw an error on command execution failure." + value: "```wing\nstruct ShellOptions extends CommandOptions\n```\n---\nAdditional options for `util.shell()`.\n### Fields\n- `cwd?` — `str?` — Path to a directory to run the command in.\n- `env?` — `Map?` — Environment variables.\n- `inheritEnv?` — `bool?` — Whether to inherit environment variables from the host's environment.\n- `throw?` — `bool?` — Whether to throw an error on command execution failure." sortText: hh|ShellOptions - label: SpawnOptions kind: 22 documentation: kind: markdown - value: "```wing\nstruct SpawnOptions extends CommandOptions\n```\n---\nAdditional options for `util.spawn()`.\n### Fields\n- `cwd?` — `str?`\n- `env?` — `Map?`\n- `inheritEnv?` — `bool?`\n- `stderr?` — `Stdio?` — Configuration for the process's standard error stream.\n- `stdin?` — `Stdio?` — Configuration for the process's standard input stream.\n- `stdout?` — `Stdio?` — Configuration for the process's standard output stream." + value: "```wing\nstruct SpawnOptions extends CommandOptions\n```\n---\nAdditional options for `util.spawn()`.\n### Fields\n- `cwd?` — `str?` — Path to a directory to run the command in.\n- `env?` — `Map?` — Environment variables.\n- `inheritEnv?` — `bool?` — Whether to inherit environment variables from the host's environment.\n- `stderr?` — `Stdio?` — Configuration for the process's standard error stream.\n- `stdin?` — `Stdio?` — Configuration for the process's standard input stream.\n- `stdout?` — `Stdio?` — Configuration for the process's standard output stream." sortText: hh|SpawnOptions - label: UlidOptions kind: 22 @@ -201,7 +201,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IPredicateHandler extends IInflight\n```\n---\nA predicate with an inflight \"handle\" method that can be passed to `util.busyWait`.\n### Methods\n- `handle` — `inflight (): bool` — The Predicate function that is called.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IPredicateHandler extends IInflight\n```\n---\nA predicate with an inflight \"handle\" method that can be passed to `util.busyWait`.\n### Methods\n- `handle` — `inflight (): bool` — The Predicate function that is called.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IPredicateHandler - label: IPredicateHandlerClient kind: 8 @@ -213,6 +213,6 @@ source: libs/wingc/src/lsp/completions.rs kind: 13 documentation: kind: markdown - value: "```wing\nenum Stdio\n```\n---\nDescribes what to do with a standard I/O stream for a child process.\n- `INHERIT`\n- `PIPED`\n- `NULL`" + value: "```wing\nenum Stdio\n```\n---\nDescribes what to do with a standard I/O stream for a child process.\n- `INHERIT — The child inherits from the corresponding parent descriptor.`\n- `PIPED — A new pipe should be arranged to connect the parent and child processes.`\n- `NULL — This stream will be ignored.`" sortText: jj|Stdio diff --git a/libs/wingc/src/lsp/snapshots/completions/variable_type_annotation_namespace.snap b/libs/wingc/src/lsp/snapshots/completions/variable_type_annotation_namespace.snap index 85029c605a7..f2a5773dfb8 100644 --- a/libs/wingc/src/lsp/snapshots/completions/variable_type_annotation_namespace.snap +++ b/libs/wingc/src/lsp/snapshots/completions/variable_type_annotation_namespace.snap @@ -41,7 +41,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 7 documentation: kind: markdown - value: "```wing\nclass OnDeploy\n```\n---\nRun code every time the app is deployed.\n\n### Initializer\n- `handler` — `inflight (): void`\n- `...props` — `OnDeployProps?`\n \n - `concurrency?` — `num?`\n - `env?` — `Map?`\n - `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n - `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n - `logRetentionDays?` — `num?`\n - `memory?` — `num?`\n - `timeout?` — `duration?`\n### Fields\n- `node` — `Node` — The tree node.\n### Methods\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." + value: "```wing\nclass OnDeploy\n```\n---\nRun code every time the app is deployed.\n\n### Initializer\n- `handler` — `inflight (): void`\n- `...props` — `OnDeployProps?`\n \n - `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n - `env?` — `Map?` — Environment variables to pass to the function.\n - `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n - `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n - `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n - `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n - `timeout?` — `duration?` — The maximum amount of time the function can run.\n### Fields\n- `node` — `Node` — The tree node.\n### Methods\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." sortText: gg|OnDeploy - label: Queue kind: 7 @@ -77,7 +77,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 7 documentation: kind: markdown - value: "```wing\nclass Website impl IWebsite\n```\n---\nA cloud static website.\n\n### Initializer\n- `...props` — `WebsiteProps`\n \n - `path` — `str`\n - `domain?` — `Domain?`\n - `errorDocument?` — `str?`\n### Fields\n- `node` — `Node` — The tree node.\n- `path` — `str` — Absolute local path to the website's static files.\n- `url` — `str` — The website's url.\n### Methods\n- `addFile` — `preflight (path: str, data: str, options: AddFileOptions?): str` — Add a file to the website during deployment.\n- `addJson` — `preflight (path: str, data: Json): str` — Add a JSON file with custom values during the website's deployment.\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." + value: "```wing\nclass Website impl IWebsite\n```\n---\nA cloud static website.\n\n### Initializer\n- `...props` — `WebsiteProps`\n \n - `path` — `str` — Local path to the website's static files, relative to the Wing source file or absolute.\n - `domain?` — `Domain?` — The website's custom domain object.\n - `errorDocument?` — `str?` — Name of the error document for the website.\n### Fields\n- `node` — `Node` — The tree node.\n- `path` — `str` — Absolute local path to the website's static files.\n- `url` — `str` — The website's url.\n### Methods\n- `addFile` — `preflight (path: str, data: str, options: AddFileOptions?): str` — Add a file to the website during deployment.\n- `addJson` — `preflight (path: str, data: Json): str` — Add a JSON file with custom values during the website's deployment.\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." sortText: gg|Website - label: AddFileOptions kind: 22 @@ -221,7 +221,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct BucketTryGetOptions extends BucketGetOptions\n```\n---\nOptions for `Bucket.tryGet()`.\n### Fields\n- `endByte?` — `num?`\n- `startByte?` — `num?`" + value: "```wing\nstruct BucketTryGetOptions extends BucketGetOptions\n```\n---\nOptions for `Bucket.tryGet()`.\n### Fields\n- `endByte?` — `num?` — The ending byte to read up to (including).\n- `startByte?` — `num?` — The starting byte to read from." sortText: hh|BucketTryGetOptions - label: CorsHeaders kind: 22 @@ -275,7 +275,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct OnDeployProps extends FunctionProps\n```\n---\nOptions for `OnDeploy`.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n- `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct OnDeployProps extends FunctionProps\n```\n---\nOptions for `OnDeploy`.\n### Fields\n- `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n- `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." sortText: hh|OnDeployProps - label: QueueProps kind: 22 @@ -287,13 +287,13 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct QueueSetConsumerOptions extends FunctionProps\n```\n---\nOptions for Queue.setConsumer.\n### Fields\n- `batchSize?` — `num?` — The maximum number of messages to send to subscribers at once.\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct QueueSetConsumerOptions extends FunctionProps\n```\n---\nOptions for Queue.setConsumer.\n### Fields\n- `batchSize?` — `num?` — The maximum number of messages to send to subscribers at once.\n- `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." sortText: hh|QueueSetConsumerOptions - label: ScheduleOnTickOptions kind: 22 documentation: kind: markdown - value: "```wing\nstruct ScheduleOnTickOptions extends FunctionProps\n```\n---\nOptions for Schedule.onTick.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct ScheduleOnTickOptions extends FunctionProps\n```\n---\nOptions for Schedule.onTick.\n### Fields\n- `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." sortText: hh|ScheduleOnTickOptions - label: ScheduleProps kind: 22 @@ -311,7 +311,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct ServiceOnStartOptions extends FunctionProps\n```\n---\nOptions for Service.onStart.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct ServiceOnStartOptions extends FunctionProps\n```\n---\nOptions for Service.onStart.\n### Fields\n- `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." sortText: hh|ServiceOnStartOptions - label: ServiceProps kind: 22 @@ -323,7 +323,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct TopicOnMessageOptions extends FunctionProps\n```\n---\nOptions for `Topic.onMessage`.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct TopicOnMessageOptions extends FunctionProps\n```\n---\nOptions for `Topic.onMessage`.\n### Fields\n- `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." sortText: hh|TopicOnMessageOptions - label: TopicProps kind: 22 @@ -335,7 +335,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct TopicSubscribeQueueOptions extends QueueProps\n```\n---\nOptions for `Topic.subscribeQueue`.\n### Fields\n- `dlq?` — `DeadLetterQueueProps?`\n- `retentionPeriod?` — `duration?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct TopicSubscribeQueueOptions extends QueueProps\n```\n---\nOptions for `Topic.subscribeQueue`.\n### Fields\n- `dlq?` — `DeadLetterQueueProps?` — A dead-letter queue.\n- `retentionPeriod?` — `duration?` — How long a queue retains a message.\n- `timeout?` — `duration?` — How long a queue's consumers have to process a message." sortText: hh|TopicSubscribeQueueOptions - label: WebsiteDomainOptions kind: 22 @@ -353,7 +353,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct WebsiteProps extends WebsiteOptions, WebsiteDomainOptions\n```\n---\nOptions for `Website`.\n### Fields\n- `path` — `str`\n- `domain?` — `Domain?`\n- `errorDocument?` — `str?`" + value: "```wing\nstruct WebsiteProps extends WebsiteOptions, WebsiteDomainOptions\n```\n---\nOptions for `Website`.\n### Fields\n- `path` — `str` — Local path to the website's static files, relative to the Wing source file or absolute.\n- `domain?` — `Domain?` — The website's custom domain object.\n- `errorDocument?` — `str?` — Name of the error document for the website." sortText: hh|WebsiteProps - label: IApiClient kind: 8 @@ -365,7 +365,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IApiEndpointHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to one of the `Api` request preflight methods.\n### Methods\n- `handle` — `inflight (request: ApiRequest): ApiResponse?` — Inflight that will be called when a request is made to the endpoint.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IApiEndpointHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to one of the `Api` request preflight methods.\n### Methods\n- `handle` — `inflight (request: ApiRequest): ApiResponse?` — Inflight that will be called when a request is made to the endpoint.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IApiEndpointHandler - label: IApiEndpointHandlerClient kind: 8 @@ -383,7 +383,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IBucketEventHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to the bucket events.\n### Methods\n- `handle` — `inflight (key: str, type: BucketEventType): void` — Function that will be called when an event notification is fired.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IBucketEventHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to the bucket events.\n### Methods\n- `handle` — `inflight (key: str, type: BucketEventType): void` — Function that will be called when an event notification is fired.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IBucketEventHandler - label: IBucketEventHandlerClient kind: 8 @@ -419,7 +419,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IFunctionHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be used to create a `cloud.Function`.\n### Methods\n- `handle` — `inflight (event: str?): str?` — Entrypoint function that will be called when the cloud function is invoked.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IFunctionHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be used to create a `cloud.Function`.\n### Methods\n- `handle` — `inflight (event: str?): str?` — Entrypoint function that will be called when the cloud function is invoked.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IFunctionHandler - label: IFunctionHandlerClient kind: 8 @@ -437,7 +437,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IOnDeployHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be used by `cloud.OnDeploy`.\n### Methods\n- `handle` — `inflight (): void` — Entrypoint function that will be called when the app is deployed.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IOnDeployHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be used by `cloud.OnDeploy`.\n### Methods\n- `handle` — `inflight (): void` — Entrypoint function that will be called when the app is deployed.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IOnDeployHandler - label: IOnDeployHandlerClient kind: 8 @@ -455,7 +455,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IQueueSetConsumerHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to `Queue.setConsumer`.\n### Methods\n- `handle` — `inflight (message: str): void` — Function that will be called when a message is received from the queue.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IQueueSetConsumerHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to `Queue.setConsumer`.\n### Methods\n- `handle` — `inflight (message: str): void` — Function that will be called when a message is received from the queue.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IQueueSetConsumerHandler - label: IQueueSetConsumerHandlerClient kind: 8 @@ -473,7 +473,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IScheduleOnTickHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to `Schedule.on_tick`.\n### Methods\n- `handle` — `inflight (): void` — Function that will be called when a message is received from the schedule.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IScheduleOnTickHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to `Schedule.on_tick`.\n### Methods\n- `handle` — `inflight (): void` — Function that will be called when a message is received from the schedule.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IScheduleOnTickHandler - label: IScheduleOnTickHandlerClient kind: 8 @@ -497,7 +497,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IServiceHandler extends IInflight\n```\n---\nExecuted when a `cloud.Service` is started.\n### Methods\n- `handle` — `inflight (): inflight (): void?` — Handler to run when the service starts.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IServiceHandler extends IInflight\n```\n---\nExecuted when a `cloud.Service` is started.\n### Methods\n- `handle` — `inflight (): inflight (): void?` — Handler to run when the service starts.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IServiceHandler - label: IServiceHandlerClient kind: 8 @@ -509,7 +509,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface IServiceStopHandler extends IInflight\n```\n---\nExecuted when a `cloud.Service` is stopped.\n### Methods\n- `handle` — `inflight (): void` — Handler to run when the service stops.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface IServiceStopHandler extends IInflight\n```\n---\nExecuted when a `cloud.Service` is stopped.\n### Methods\n- `handle` — `inflight (): void` — Handler to run when the service stops.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|IServiceStopHandler - label: IServiceStopHandlerClient kind: 8 @@ -527,7 +527,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 8 documentation: kind: markdown - value: "```wing\ninterface ITopicOnMessageHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to `Topic.on_message`.\n### Methods\n- `handle` — `inflight (event: str): void` — Function that will be called when a message is received from the topic.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void`" + value: "```wing\ninterface ITopicOnMessageHandler extends IInflight\n```\n---\nA resource with an inflight \"handle\" method that can be passed to `Topic.on_message`.\n### Methods\n- `handle` — `inflight (event: str): void` — Function that will be called when a message is received from the topic.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this object inflight." sortText: ii|ITopicOnMessageHandler - label: ITopicOnMessageHandlerClient kind: 8 @@ -551,18 +551,18 @@ source: libs/wingc/src/lsp/completions.rs kind: 13 documentation: kind: markdown - value: "```wing\nenum BucketEventType\n```\n---\nBucket events to subscribe to.\n- `CREATE`\n- `DELETE`\n- `UPDATE`" + value: "```wing\nenum BucketEventType\n```\n---\nBucket events to subscribe to.\n- `CREATE — Create.`\n- `DELETE — Delete.`\n- `UPDATE — Update.`" sortText: jj|BucketEventType - label: BucketSignedUrlAction kind: 13 documentation: kind: markdown - value: "```wing\nenum BucketSignedUrlAction\n```\n---\nSpecifies the action permitted by a presigned URL for a bucket.\n- `DOWNLOAD`\n- `UPLOAD`" + value: "```wing\nenum BucketSignedUrlAction\n```\n---\nSpecifies the action permitted by a presigned URL for a bucket.\n- `DOWNLOAD — Represents a HTTP GET request for a presigned URL, allowing read access for an object in the bucket.`\n- `UPLOAD — Represents a HTTP PUT request for a presigned URL, allowing write access for an object in the bucket.`" sortText: jj|BucketSignedUrlAction - label: HttpMethod kind: 13 documentation: kind: markdown - value: "```wing\nenum HttpMethod\n```\n---\nAllowed HTTP methods for a endpoint.\n- `GET`\n- `HEAD`\n- `POST`\n- `PUT`\n- `DELETE`\n- `CONNECT`\n- `OPTIONS`\n- `PATCH`" + value: "```wing\nenum HttpMethod\n```\n---\nAllowed HTTP methods for a endpoint.\n- `GET — Get.`\n- `HEAD — Head.`\n- `POST — Post.`\n- `PUT — Put.`\n- `DELETE — Delete.`\n- `CONNECT — Connect.`\n- `OPTIONS — Options.`\n- `PATCH — Patch.`" sortText: jj|HttpMethod diff --git a/libs/wingc/src/lsp/snapshots/hovers/class_doc.snap b/libs/wingc/src/lsp/snapshots/hovers/class_doc.snap new file mode 100644 index 00000000000..494004ea07c --- /dev/null +++ b/libs/wingc/src/lsp/snapshots/hovers/class_doc.snap @@ -0,0 +1,14 @@ +--- +source: libs/wingc/src/lsp/hover.rs +--- +contents: + kind: markdown + value: "```wing\nclass Foo\n```\n---\n Class doc\n\n### Fields\n- `node` — `Node` — The tree node.\n### Methods\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." +range: + start: + line: 2 + character: 8 + end: + line: 2 + character: 11 + diff --git a/libs/wingc/src/lsp/snapshots/hovers/class_doc_with_multiline_and_markdown.snap b/libs/wingc/src/lsp/snapshots/hovers/class_doc_with_multiline_and_markdown.snap new file mode 100644 index 00000000000..5f55966946d --- /dev/null +++ b/libs/wingc/src/lsp/snapshots/hovers/class_doc_with_multiline_and_markdown.snap @@ -0,0 +1,14 @@ +--- +source: libs/wingc/src/lsp/hover.rs +--- +contents: + kind: markdown + value: "```wing\nclass Foo\n```\n---\n Class doc\n With multiline\n ## And markdown\n\n### Fields\n- `a` — `num`\n- `node` — `Node` — The tree node.\n### Methods\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." +range: + start: + line: 4 + character: 8 + end: + line: 4 + character: 11 + diff --git a/libs/wingc/src/lsp/snapshots/hovers/class_field_doc.snap b/libs/wingc/src/lsp/snapshots/hovers/class_field_doc.snap new file mode 100644 index 00000000000..99064f04659 --- /dev/null +++ b/libs/wingc/src/lsp/snapshots/hovers/class_field_doc.snap @@ -0,0 +1,14 @@ +--- +source: libs/wingc/src/lsp/hover.rs +--- +contents: + kind: markdown + value: "```wing\npreflight field: num\n```\n---\n Class field doc" +range: + start: + line: 3 + character: 4 + end: + line: 3 + character: 9 + diff --git a/libs/wingc/src/lsp/snapshots/hovers/class_method_doc.snap b/libs/wingc/src/lsp/snapshots/hovers/class_method_doc.snap new file mode 100644 index 00000000000..06b7875059b --- /dev/null +++ b/libs/wingc/src/lsp/snapshots/hovers/class_method_doc.snap @@ -0,0 +1,14 @@ +--- +source: libs/wingc/src/lsp/hover.rs +--- +contents: + kind: markdown + value: "```wing\npreflight do: preflight (): void\n```\n---\n Class method doc" +range: + start: + line: 3 + character: 4 + end: + line: 3 + character: 6 + diff --git a/libs/wingc/src/lsp/snapshots/hovers/ctor_doc.snap b/libs/wingc/src/lsp/snapshots/hovers/ctor_doc.snap new file mode 100644 index 00000000000..6bfb3d1d20d --- /dev/null +++ b/libs/wingc/src/lsp/snapshots/hovers/ctor_doc.snap @@ -0,0 +1,14 @@ +--- +source: libs/wingc/src/lsp/hover.rs +--- +contents: + kind: markdown + value: "```wing\nstatic preflight new: preflight (): Bob\n```\n---\n I'm bob the constructor" +range: + start: + line: 3 + character: 4 + end: + line: 3 + character: 7 + diff --git a/libs/wingc/src/lsp/snapshots/hovers/ctor_doc_from_new_expr.snap b/libs/wingc/src/lsp/snapshots/hovers/ctor_doc_from_new_expr.snap new file mode 100644 index 00000000000..0a64600ae42 --- /dev/null +++ b/libs/wingc/src/lsp/snapshots/hovers/ctor_doc_from_new_expr.snap @@ -0,0 +1,14 @@ +--- +source: libs/wingc/src/lsp/hover.rs +--- +contents: + kind: markdown + value: "```wing\nstatic preflight new: preflight (): Bob\n```\n---\n I'm bob the constructor" +range: + start: + line: 5 + character: 6 + end: + line: 5 + character: 9 + diff --git a/libs/wingc/src/lsp/snapshots/hovers/enum_doc.snap b/libs/wingc/src/lsp/snapshots/hovers/enum_doc.snap new file mode 100644 index 00000000000..7e667ee412b --- /dev/null +++ b/libs/wingc/src/lsp/snapshots/hovers/enum_doc.snap @@ -0,0 +1,14 @@ +--- +source: libs/wingc/src/lsp/hover.rs +--- +contents: + kind: markdown + value: "```wing\nenum Foo\n```\n---\n Enum doc" +range: + start: + line: 2 + character: 7 + end: + line: 2 + character: 10 + diff --git a/libs/wingc/src/lsp/snapshots/hovers/enum_variant_doc.snap b/libs/wingc/src/lsp/snapshots/hovers/enum_variant_doc.snap new file mode 100644 index 00000000000..9c8c8465838 --- /dev/null +++ b/libs/wingc/src/lsp/snapshots/hovers/enum_variant_doc.snap @@ -0,0 +1,14 @@ +--- +source: libs/wingc/src/lsp/hover.rs +--- +contents: + kind: markdown + value: "```wing\nenum Foo\n```\n---\n- `A — Enum variant doc`" +range: + start: + line: 5 + character: 5 + end: + line: 5 + character: 6 + diff --git a/libs/wingc/src/lsp/snapshots/hovers/ignoe_empty_lines_in_doc.snap b/libs/wingc/src/lsp/snapshots/hovers/ignoe_empty_lines_in_doc.snap new file mode 100644 index 00000000000..57102d4b5a1 --- /dev/null +++ b/libs/wingc/src/lsp/snapshots/hovers/ignoe_empty_lines_in_doc.snap @@ -0,0 +1,14 @@ +--- +source: libs/wingc/src/lsp/hover.rs +--- +contents: + kind: markdown + value: "```wing\nclass Foo\n```\n---\n Class doc with empty lines after it\n\n### Fields\n- `node` — `Node` — The tree node.\n### Methods\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." +range: + start: + line: 3 + character: 8 + end: + line: 3 + character: 11 + diff --git a/libs/wingc/src/lsp/snapshots/hovers/inflight_ctor_doc.snap b/libs/wingc/src/lsp/snapshots/hovers/inflight_ctor_doc.snap new file mode 100644 index 00000000000..505d44d4c44 --- /dev/null +++ b/libs/wingc/src/lsp/snapshots/hovers/inflight_ctor_doc.snap @@ -0,0 +1,14 @@ +--- +source: libs/wingc/src/lsp/hover.rs +--- +contents: + kind: markdown + value: "```wing\ninflight $inflight_init: inflight (): Bob\n```\n---\n I'm bob the constructor (inflight)" +range: + start: + line: 3 + character: 13 + end: + line: 3 + character: 16 + diff --git a/libs/wingc/src/lsp/snapshots/hovers/inflight_ctor_doc_from_new_expr.snap b/libs/wingc/src/lsp/snapshots/hovers/inflight_ctor_doc_from_new_expr.snap new file mode 100644 index 00000000000..807d83e9cfe --- /dev/null +++ b/libs/wingc/src/lsp/snapshots/hovers/inflight_ctor_doc_from_new_expr.snap @@ -0,0 +1,14 @@ +--- +source: libs/wingc/src/lsp/hover.rs +--- +contents: + kind: markdown + value: "```wing\ninflight $inflight_init: inflight (): Bob\n```\n---\n I'm bob the constructor (inflight)" +range: + start: + line: 5 + character: 23 + end: + line: 5 + character: 26 + diff --git a/libs/wingc/src/lsp/snapshots/hovers/inherited_interface_method_doc.snap b/libs/wingc/src/lsp/snapshots/hovers/inherited_interface_method_doc.snap new file mode 100644 index 00000000000..2e1e3dbb5d3 --- /dev/null +++ b/libs/wingc/src/lsp/snapshots/hovers/inherited_interface_method_doc.snap @@ -0,0 +1,14 @@ +--- +source: libs/wingc/src/lsp/hover.rs +--- +contents: + kind: markdown + value: "```wing\npreflight do: preflight (): void\n```\n---\n Parent interface method doc" +range: + start: + line: 9 + character: 6 + end: + line: 9 + character: 8 + diff --git a/libs/wingc/src/lsp/snapshots/hovers/inherited_struct_field_doc.snap b/libs/wingc/src/lsp/snapshots/hovers/inherited_struct_field_doc.snap new file mode 100644 index 00000000000..37d05837728 --- /dev/null +++ b/libs/wingc/src/lsp/snapshots/hovers/inherited_struct_field_doc.snap @@ -0,0 +1,14 @@ +--- +source: libs/wingc/src/lsp/hover.rs +--- +contents: + kind: markdown + value: "```wing\nfield: num\n```\n---\n Parent struct field doc" +range: + start: + line: 9 + character: 8 + end: + line: 9 + character: 13 + diff --git a/libs/wingc/src/lsp/snapshots/hovers/interface_doc.snap b/libs/wingc/src/lsp/snapshots/hovers/interface_doc.snap new file mode 100644 index 00000000000..c592b65eac3 --- /dev/null +++ b/libs/wingc/src/lsp/snapshots/hovers/interface_doc.snap @@ -0,0 +1,14 @@ +--- +source: libs/wingc/src/lsp/hover.rs +--- +contents: + kind: markdown + value: "```wing\ninterface Foo extends IResource\n```\n---\n Interface doc" +range: + start: + line: 2 + character: 12 + end: + line: 2 + character: 15 + diff --git a/libs/wingc/src/lsp/snapshots/hovers/interface_method_doc.snap b/libs/wingc/src/lsp/snapshots/hovers/interface_method_doc.snap new file mode 100644 index 00000000000..954448ae875 --- /dev/null +++ b/libs/wingc/src/lsp/snapshots/hovers/interface_method_doc.snap @@ -0,0 +1,14 @@ +--- +source: libs/wingc/src/lsp/hover.rs +--- +contents: + kind: markdown + value: "```wing\npreflight do: preflight (): void\n```\n---\n Interface method doc" +range: + start: + line: 3 + character: 4 + end: + line: 3 + character: 6 + diff --git a/libs/wingc/src/lsp/snapshots/hovers/member_doc_on_same_line_as_something_else.snap b/libs/wingc/src/lsp/snapshots/hovers/member_doc_on_same_line_as_something_else.snap new file mode 100644 index 00000000000..46da7552606 --- /dev/null +++ b/libs/wingc/src/lsp/snapshots/hovers/member_doc_on_same_line_as_something_else.snap @@ -0,0 +1,14 @@ +--- +source: libs/wingc/src/lsp/hover.rs +--- +contents: + kind: markdown + value: "```wing\npreflight field: num\n```\n---\n Member doc in unexpected place" +range: + start: + line: 2 + character: 4 + end: + line: 2 + character: 9 + diff --git a/libs/wingc/src/lsp/snapshots/hovers/new_statement.snap b/libs/wingc/src/lsp/snapshots/hovers/new_statement.snap index e090b2bc0db..f95e3d6aa6c 100644 --- a/libs/wingc/src/lsp/snapshots/hovers/new_statement.snap +++ b/libs/wingc/src/lsp/snapshots/hovers/new_statement.snap @@ -3,7 +3,7 @@ source: libs/wingc/src/lsp/hover.rs --- contents: kind: markdown - value: "```wing\nclass Bucket\n```\n---\nA cloud object store.\n\n### Initializer\n- `...props` — `BucketProps?`\n \n - `public?` — `bool?` — Whether the bucket's objects should be publicly accessible.\n### Fields\n- `node` — `Node` — The tree node.\n### Methods\n- `addFile` — `preflight (key: str, path: str, encoding: str?): void` — Add a file to the bucket from system folder.\n- `addObject` — `preflight (key: str, body: str): void` — Add a file to the bucket that is uploaded when the app is deployed.\n- `copy` — `inflight (srcKey: str, dstKey: str): void` — Copy an object to a new location in the bucket.\n- `delete` — `inflight (key: str, opts: BucketDeleteOptions?): void` — Delete an existing object using a key from the bucket.\n- `exists` — `inflight (key: str): bool` — Check if an object exists in the bucket.\n- `get` — `inflight (key: str, options: BucketGetOptions?): str` — Retrieve an object from the bucket.\n- `getJson` — `inflight (key: str): Json` — Retrieve a Json object from the bucket.\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `list` — `inflight (prefix: str?): Array` — Retrieve existing objects keys from the bucket.\n- `metadata` — `inflight (key: str): ObjectMetadata` — Get the metadata of an object in the bucket.\n- `onCreate` — `preflight (fn: inflight (key: str, type: BucketEventType): void, opts: BucketOnCreateOptions?): void` — Run an inflight whenever a file is uploaded to the bucket.\n- `onDelete` — `preflight (fn: inflight (key: str, type: BucketEventType): void, opts: BucketOnDeleteOptions?): void` — Run an inflight whenever a file is deleted from the bucket.\n- `onEvent` — `preflight (fn: inflight (key: str, type: BucketEventType): void, opts: BucketOnEventOptions?): void` — Run an inflight whenever a file is uploaded, modified, or deleted from the bucket.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `onUpdate` — `preflight (fn: inflight (key: str, type: BucketEventType): void, opts: BucketOnUpdateOptions?): void` — Run an inflight whenever a file is updated in the bucket.\n- `publicUrl` — `inflight (key: str): str` — Returns a url to the given file.\n- `put` — `inflight (key: str, body: str, options: BucketPutOptions?): void` — Put an object in the bucket.\n- `putJson` — `inflight (key: str, body: Json): void` — Put a Json object in the bucket.\n- `rename` — `inflight (srcKey: str, dstKey: str): void` — Move an object to a new location in the bucket.\n- `signedUrl` — `inflight (key: str, options: BucketSignedUrlOptions?): str` — Returns a signed url to the given file.\n- `toString` — `preflight (): str` — Returns a string representation of this construct.\n- `tryDelete` — `inflight (key: str): bool` — Delete an object from the bucket if it exists.\n- `tryGet` — `inflight (key: str, options: BucketTryGetOptions?): str?` — Get an object from the bucket if it exists If the bytes returned are not a valid UTF-8 string, an error is thrown.\n- `tryGetJson` — `inflight (key: str): Json?` — Gets an object from the bucket if it exists, parsing it as Json." + value: "```wing\nstatic preflight new: preflight (props: BucketProps?): Bucket\n```\n---\n### Parameters\n- `...props` — `BucketProps?`\n \n - `public?` — `bool?` — Whether the bucket's objects should be publicly accessible." range: start: line: 2 diff --git a/libs/wingc/src/lsp/snapshots/hovers/struct_doc.snap b/libs/wingc/src/lsp/snapshots/hovers/struct_doc.snap new file mode 100644 index 00000000000..39014c15229 --- /dev/null +++ b/libs/wingc/src/lsp/snapshots/hovers/struct_doc.snap @@ -0,0 +1,14 @@ +--- +source: libs/wingc/src/lsp/hover.rs +--- +contents: + kind: markdown + value: "```wing\nstruct Foo\n```\n---\n Struct doc" +range: + start: + line: 2 + character: 9 + end: + line: 2 + character: 12 + diff --git a/libs/wingc/src/lsp/snapshots/hovers/struct_field_doc.snap b/libs/wingc/src/lsp/snapshots/hovers/struct_field_doc.snap new file mode 100644 index 00000000000..affa401135b --- /dev/null +++ b/libs/wingc/src/lsp/snapshots/hovers/struct_field_doc.snap @@ -0,0 +1,14 @@ +--- +source: libs/wingc/src/lsp/hover.rs +--- +contents: + kind: markdown + value: "```wing\nfield: num\n```\n---\n Struct field doc" +range: + start: + line: 3 + character: 4 + end: + line: 3 + character: 9 + diff --git a/libs/wingc/src/lsp/symbol_locator.rs b/libs/wingc/src/lsp/symbol_locator.rs index cfdfae5d3cd..8d032bb4263 100644 --- a/libs/wingc/src/lsp/symbol_locator.rs +++ b/libs/wingc/src/lsp/symbol_locator.rs @@ -297,7 +297,34 @@ impl<'a> Visit<'a> for SymbolLocator<'a> { self.ctx.push_expr(node.id); match &node.kind { - ExprKind::New(new_expr) => { + ExprKind::New(new_expr) => 'new_expr: { + let class_type = self.types.get_expr_type(node); + let Some(class_type) = class_type.as_class() else { + break 'new_expr; + }; + let Some(class_phase) = self.types.get_expr_phase(node) else { + break 'new_expr; + }; + let init_symb = Symbol::new( + match class_phase { + Phase::Inflight => CLASS_INFLIGHT_INIT_NAME, + Phase::Preflight | Phase::Independent => CLASS_INIT_NAME, + }, + new_expr.class.span(), + ); + + if new_expr.class.span.contains_location(&self.location) { + let class_env = class_type.get_env().get_ref(); + + self.ctx.push_env(class_env); + + self.set_result(SymbolLocatorResult::Symbol(init_symb)); + + self.ctx.pop_env(); + + return; + } + let found_named_arg = new_expr .arg_list .named_args @@ -306,18 +333,7 @@ impl<'a> Visit<'a> for SymbolLocator<'a> { if let Some((arg_name, ..)) = found_named_arg { // we need to get the struct type from the class constructor - let class_type = self.types.get_expr_type(node); - let Some(class_phase) = self.types.get_expr_phase(node) else { - return; - }; - let Some(class_type) = class_type.as_class() else { - return; - }; - let init_info = match class_phase { - Phase::Inflight => class_type.get_method(&Symbol::global(CLASS_INFLIGHT_INIT_NAME)), - Phase::Preflight => class_type.get_method(&Symbol::global(CLASS_INIT_NAME)), - Phase::Independent => panic!("Cannot get hover info for independent class"), - }; + let init_info = class_type.get_method(&init_symb); if let Some(var_info) = init_info { if let Some(func) = var_info.type_.maybe_unwrap_option().as_function_sig() { if let Some(arg) = func.parameters.last() { @@ -401,6 +417,13 @@ impl<'a> Visit<'a> for SymbolLocator<'a> { return; } + // if let Some(name) = &node.name { + // self.visit_symbol(name); + // if self.is_found() { + // return; + // } + // } + if let FunctionBody::Statements(scope) = &node.body { self.push_scope_env(scope); for param in &node.signature.parameters { @@ -430,6 +453,14 @@ impl<'a> Visit<'a> for SymbolLocator<'a> { self.visit_symbol(&method.0); } + if let Some(ctor_name) = &node.initializer.name { + self.visit_symbol(ctor_name); + } + + if let Some(ctor_name) = &node.inflight_initializer.name { + self.visit_symbol(ctor_name); + } + self.ctx.pop_env(); visit_class(self, node); diff --git a/libs/wingc/src/parser.rs b/libs/wingc/src/parser.rs index ea8e4e91d71..d377746214e 100644 --- a/libs/wingc/src/parser.rs +++ b/libs/wingc/src/parser.rs @@ -1,5 +1,5 @@ use camino::{Utf8Component, Utf8Path, Utf8PathBuf}; -use indexmap::{IndexMap, IndexSet}; +use indexmap::IndexMap; use itertools::Itertools; use phf::{phf_map, phf_set}; use regex::Regex; @@ -580,16 +580,31 @@ impl<'s> Parser<'s> { CompilationContext::set(CompilationPhase::Parsing, &span); let mut cursor = scope_node.walk(); - let statements = scope_node - .named_children(&mut cursor) - .filter(|child| !child.is_extra() && child.kind() != "AUTOMATIC_BLOCK") - .enumerate() - .filter_map(|(i, st_node)| self.build_statement(&st_node, i, phase).ok()) - .collect(); + let mut statements = vec![]; + let mut doc_builder = DocBuilder::new(self); + + for child in scope_node.named_children(&mut cursor) { + let DocBuilderResult::Done(doc) = doc_builder.process_node(&child) else { + continue; + }; + if child.kind() == "AUTOMATIC_BLOCK" { + continue; + } + + if let Ok(stmt) = self.build_statement(&child, statements.len(), phase, doc) { + statements.push(stmt); + } + } Scope::new(statements, span) } - fn build_statement(&self, statement_node: &Node, idx: usize, phase: Phase) -> DiagnosticResult { + fn build_statement( + &self, + statement_node: &Node, + idx: usize, + phase: Phase, + doc: Option, + ) -> DiagnosticResult { let span = self.node_span(statement_node); CompilationContext::set(CompilationPhase::Parsing, &span); let stmt_kind = match statement_node.kind() { @@ -634,6 +649,7 @@ impl<'s> Parser<'s> { kind: stmt_kind, span, idx, + doc, }) } @@ -838,12 +854,21 @@ impl<'s> Parser<'s> { let mut cursor = statement_node.walk(); let mut members = vec![]; - for field_node in statement_node.children_by_field_name("field", &mut cursor) { + let mut doc_builder = DocBuilder::new(self); + + for field_node in statement_node.named_children(&mut cursor) { + let DocBuilderResult::Done(doc) = doc_builder.process_node(&field_node) else { + continue; + }; + if field_node.kind() != "struct_field" { + continue; + } let identifier = self.node_symbol(&self.get_child_field(&field_node, "name")?)?; let type_ = self.get_child_field(&field_node, "type").ok(); let f = StructField { name: identifier, member_type: self.build_type_annotation(type_, phase)?, + doc, }; members.push(f); } @@ -1114,8 +1139,13 @@ impl<'s> Parser<'s> { } let mut cursor = statement_node.walk(); - let mut values = IndexSet::::new(); + let mut values = IndexMap::>::new(); + let mut doc_builder = DocBuilder::new(self); + for node in statement_node.named_children(&mut cursor) { + let DocBuilderResult::Done(value_doc) = doc_builder.process_node(&node) else { + continue; + }; if node.kind() != "enum_field" { continue; } @@ -1127,8 +1157,7 @@ impl<'s> Parser<'s> { } let symbol = diagnostic.unwrap(); - let success = values.insert(symbol.clone()); - if !success { + if values.insert(symbol.clone(), value_doc).is_some() { self .with_error::(format!("Duplicated enum value {}", symbol.name), &node) .err(); @@ -1189,14 +1218,17 @@ impl<'s> Parser<'s> { let mut inflight_initializer = None; let name = self.check_reserved_symbol(&statement_node.child_by_field_name("name").unwrap())?; + let mut doc_builder = DocBuilder::new(self); + for class_element in statement_node .child_by_field_name("implementation") .unwrap() .named_children(&mut cursor) { - if class_element.is_extra() { + let DocBuilderResult::Done(doc) = doc_builder.process_node(&class_element) else { continue; - } + }; + match class_element.kind() { "method_definition" => { let Ok(method_name) = self.node_symbol(&class_element.child_by_field_name("name").unwrap()) else { @@ -1204,7 +1236,7 @@ impl<'s> Parser<'s> { }; let Ok(func_def) = - self.build_function_definition(Some(method_name.clone()), &class_element, class_phase, false) + self.build_function_definition(Some(method_name.clone()), &class_element, class_phase, false, doc) else { continue; }; @@ -1219,7 +1251,7 @@ impl<'s> Parser<'s> { methods.push((method_name, func_def)) } "class_field" => { - let Ok(class_field) = self.build_class_field(class_element, class_phase) else { + let Ok(class_field) = self.build_class_field(class_element, class_phase, doc) else { continue; }; @@ -1262,9 +1294,11 @@ impl<'s> Parser<'s> { span: self.node_span(&class_element), }); + let ctor_symb_span = self.node_span(&class_element.child_by_field_name("ctor_name").unwrap()); + if is_inflight { inflight_initializer = Some(FunctionDefinition { - name: Some(CLASS_INFLIGHT_INIT_NAME.into()), + name: Some(Symbol::new(CLASS_INFLIGHT_INIT_NAME, ctor_symb_span)), body: FunctionBody::Statements( self.build_scope(&class_element.child_by_field_name("block").unwrap(), Phase::Inflight), ), @@ -1276,10 +1310,11 @@ impl<'s> Parser<'s> { is_static: false, span: self.node_span(&class_element), access: AccessModifier::Public, + doc, }) } else { initializer = Some(FunctionDefinition { - name: Some(CLASS_INIT_NAME.into()), + name: Some(Symbol::new(CLASS_INIT_NAME, ctor_symb_span)), body: FunctionBody::Statements( self.build_scope(&class_element.child_by_field_name("block").unwrap(), Phase::Preflight), ), @@ -1291,6 +1326,7 @@ impl<'s> Parser<'s> { }, span: self.node_span(&class_element), access: AccessModifier::Public, + doc, }) } } @@ -1336,6 +1372,7 @@ impl<'s> Parser<'s> { is_static: false, span: name.span(), access: AccessModifier::Public, + doc: None, }, }; @@ -1361,6 +1398,7 @@ impl<'s> Parser<'s> { is_static: false, span: name.span(), access: AccessModifier::Public, + doc: None, }, }; @@ -1422,7 +1460,12 @@ impl<'s> Parser<'s> { })) } - fn build_class_field(&self, class_element: Node<'_>, class_phase: Phase) -> Result { + fn build_class_field( + &self, + class_element: Node<'_>, + class_phase: Phase, + doc: Option, + ) -> Result { let modifiers = class_element.child_by_field_name("modifiers"); let is_static = self.get_modifier("static", &modifiers)?.is_some(); if is_static { @@ -1444,6 +1487,7 @@ impl<'s> Parser<'s> { is_static, phase, access: self.get_access_modifier(&class_element.child_by_field_name("modifiers"))?, + doc, }) } @@ -1460,24 +1504,25 @@ impl<'s> Parser<'s> { }; let name = self.check_reserved_symbol(&statement_node.child_by_field_name("name").unwrap())?; + let mut doc_builder = DocBuilder::new(self); for interface_element in statement_node .child_by_field_name("implementation") .unwrap() .named_children(&mut cursor) { - if interface_element.is_extra() { + let DocBuilderResult::Done(doc) = doc_builder.process_node(&interface_element) else { continue; - } + }; match interface_element.kind() { "method_signature" => { if let Ok((method_name, func_sig)) = self.build_interface_method(interface_element, phase) { - methods.push((method_name, func_sig)) + methods.push((method_name, func_sig, doc)) } } "inflight_method_signature" => { if let Ok((method_name, func_sig)) = self.build_interface_method(interface_element, Phase::Inflight) { - methods.push((method_name, func_sig)) + methods.push((method_name, func_sig, doc)) } } "class_field" => { @@ -1595,7 +1640,7 @@ impl<'s> Parser<'s> { } fn build_anonymous_closure(&self, anon_closure_node: &Node, phase: Phase) -> DiagnosticResult { - self.build_function_definition(None, anon_closure_node, phase, false) + self.build_function_definition(None, anon_closure_node, phase, false, None) } fn build_function_definition( @@ -1604,6 +1649,7 @@ impl<'s> Parser<'s> { func_def_node: &Node, phase: Phase, require_annotations: bool, + doc: Option, ) -> DiagnosticResult { let modifiers = func_def_node.child_by_field_name("modifiers"); @@ -1643,6 +1689,7 @@ impl<'s> Parser<'s> { is_static, span: self.node_span(func_def_node), access: self.get_access_modifier(&modifiers)?, + doc, }) } @@ -2604,6 +2651,7 @@ impl<'s> Parser<'s> { is_static: true, span: statements_span.clone(), access: AccessModifier::Public, + doc: None, }), statements_span.clone(), ); @@ -2625,6 +2673,48 @@ impl<'s> Parser<'s> { } } +struct DocBuilder<'a> { + doc_lines: Vec<&'a str>, + parser: &'a Parser<'a>, +} + +enum DocBuilderResult { + Done(Option), + Continue, + Skip, +} + +impl<'a> DocBuilder<'a> { + fn new(parser: &'a Parser) -> Self { + Self { + doc_lines: Vec::new(), + parser, + } + } + + fn process_node(&mut self, node: &Node) -> DocBuilderResult { + if node.kind() == "doc" { + self.doc_lines.push( + self + .parser + .get_child_field(&node, "content") + .map_or("", |n| self.parser.node_text(&n)), + ); + DocBuilderResult::Continue + } else if node.is_extra() { + DocBuilderResult::Skip + } else { + let doc = if self.doc_lines.is_empty() { + DocBuilderResult::Done(None) + } else { + DocBuilderResult::Done(Some(self.doc_lines.join("\n"))) + }; + self.doc_lines.clear(); + doc + } + } +} + /// Get actual child by field name when multiple children exist because of extra nodes. /// It should be safe to use this instead of `node.get_child_by_field_name` /// in cases where there's doubt. diff --git a/libs/wingc/src/type_check.rs b/libs/wingc/src/type_check.rs index 34794a042b3..ea5c40433a3 100644 --- a/libs/wingc/src/type_check.rs +++ b/libs/wingc/src/type_check.rs @@ -33,7 +33,7 @@ use crate::{ use camino::{Utf8Path, Utf8PathBuf}; use derivative::Derivative; use duplicate::duplicate_item; -use indexmap::{IndexMap, IndexSet}; +use indexmap::IndexMap; use itertools::{izip, Itertools}; use jsii_importer::JsiiImporter; @@ -463,7 +463,8 @@ impl Display for Struct { pub struct Enum { pub name: Symbol, pub docs: Docs, - pub values: IndexSet, + /// Variant name and optional documentation + pub values: IndexMap>, } #[derive(Debug)] @@ -3498,9 +3499,9 @@ impl<'a> TypeChecker<'a> { for statement in scope.statements.iter() { match &statement.kind { StmtKind::Bring { source, identifier } => self.hoist_bring_statement(source, identifier, statement, env), - StmtKind::Struct(st) => self.hoist_struct_definition(st, env), - StmtKind::Interface(iface) => self.hoist_interface_definition(iface, env), - StmtKind::Enum(enu) => self.hoist_enum_definition(enu, env), + StmtKind::Struct(st) => self.hoist_struct_definition(st, env, &statement.doc), + StmtKind::Interface(iface) => self.hoist_interface_definition(iface, env, &statement.doc), + StmtKind::Enum(enu) => self.hoist_enum_definition(enu, env, &statement.doc), _ => {} } } @@ -3643,7 +3644,7 @@ impl<'a> TypeChecker<'a> { // alias is the symbol we are giving to the imported library or namespace } - fn hoist_struct_definition(&mut self, st: &AstStruct, env: &mut SymbolEnv) { + fn hoist_struct_definition(&mut self, st: &AstStruct, env: &mut SymbolEnv, doc: &Option) { let AstStruct { name, extends, access, .. } = st; @@ -3681,7 +3682,7 @@ impl<'a> TypeChecker<'a> { fqn: None, extends: extends_types.clone(), env: dummy_env, - docs: Docs::default(), + docs: doc.as_ref().map_or(Docs::default(), |s| Docs::with_summary(s)), })); match env.define(name, SymbolKind::Type(struct_type), *access, StatementIdx::Top) { @@ -3692,7 +3693,7 @@ impl<'a> TypeChecker<'a> { }; } - fn hoist_interface_definition(&mut self, iface: &AstInterface, env: &mut SymbolEnv) { + fn hoist_interface_definition(&mut self, iface: &AstInterface, env: &mut SymbolEnv, doc: &Option) { // Create environment representing this interface, for now it'll be empty just so we can support referencing ourselves // from the interface definition or by other type definitions that come before the interface statement. let dummy_env = SymbolEnv::new( @@ -3726,7 +3727,7 @@ impl<'a> TypeChecker<'a> { let interface_spec = Interface { name: iface.name.clone(), fqn: None, - docs: Docs::default(), + docs: doc.as_ref().map_or(Docs::default(), |s| Docs::with_summary(s)), env: dummy_env, extends: extend_interfaces.clone(), phase: iface.phase, @@ -3746,11 +3747,11 @@ impl<'a> TypeChecker<'a> { }; } - fn hoist_enum_definition(&mut self, enu: &AstEnum, env: &mut SymbolEnv) { + fn hoist_enum_definition(&mut self, enu: &AstEnum, env: &mut SymbolEnv, doc: &Option) { let enum_type_ref = self.types.add_type(Type::Enum(Enum { name: enu.name.clone(), values: enu.values.clone(), - docs: Default::default(), + docs: doc.as_ref().map_or(Docs::default(), |s| Docs::with_summary(s)), })); match env.define( @@ -4103,7 +4104,7 @@ impl<'a> TypeChecker<'a> { false, Phase::Independent, AccessModifier::Public, - None, + field.doc.as_ref().map(|s| Docs::with_summary(s)), ), AccessModifier::Public, StatementIdx::Top, @@ -4145,7 +4146,7 @@ impl<'a> TypeChecker<'a> { ); // Add methods to the interface env - for (method_name, sig) in ast_iface.methods.iter() { + for (method_name, sig, doc) in ast_iface.methods.iter() { let mut method_type = self.resolve_type_annotation(&sig.to_type_annotation(), env); // use the interface type as the function's "this" type if let Type::Function(ref mut f) = *method_type { @@ -4163,7 +4164,7 @@ impl<'a> TypeChecker<'a> { false, sig.phase, AccessModifier::Public, - None, + doc.as_ref().map(|s| Docs::with_summary(s)), ), AccessModifier::Public, StatementIdx::Top, @@ -4269,7 +4270,7 @@ impl<'a> TypeChecker<'a> { implements: impl_interfaces.clone(), is_abstract: false, phase: ast_class.phase, - docs: Docs::default(), + docs: stmt.doc.as_ref().map_or(Docs::default(), |s| Docs::with_summary(s)), std_construct_args: ast_class.phase == Phase::Preflight, lifts: None, }; @@ -4301,7 +4302,7 @@ impl<'a> TypeChecker<'a> { field.is_static, field.phase, field.access, - None, + field.doc.as_ref().map(|s| Docs::with_summary(s)), ), field.access, StatementIdx::Top, @@ -5230,7 +5231,7 @@ impl<'a> TypeChecker<'a> { instance_type.is_none(), method_phase, access, - None, + method_def.doc.as_ref().map(|s| Docs::with_summary(s)), ), access, StatementIdx::Top, @@ -5911,7 +5912,7 @@ impl<'a> TypeChecker<'a> { .unwrap_or_else(|e| self.type_error(e)); match *type_ { Type::Enum(ref e) => { - if e.values.contains(property) { + if e.values.contains_key(property) { ( ResolveReferenceResult::Variable(VariableInfo { name: property.clone(), @@ -6368,7 +6369,7 @@ fn add_parent_members_to_struct_env( false, struct_env.phase, AccessModifier::Public, - None, + parent_member_var.docs.clone(), ), AccessModifier::Public, StatementIdx::Top, @@ -6433,7 +6434,7 @@ fn add_parent_members_to_iface_env( member_var.kind == VariableKind::StaticMember, member_var.phase, AccessModifier::Public, - None, + member_var.docs.clone(), ), AccessModifier::Public, StatementIdx::Top, diff --git a/libs/wingc/src/type_check/jsii_importer.rs b/libs/wingc/src/type_check/jsii_importer.rs index 3c5ae2e1ceb..2a84e19a405 100644 --- a/libs/wingc/src/type_check/jsii_importer.rs +++ b/libs/wingc/src/type_check/jsii_importer.rs @@ -13,6 +13,7 @@ use crate::{ CONSTRUCT_BASE_CLASS, WINGSDK_ASSEMBLY_NAME, WINGSDK_DURATION, WINGSDK_JSON, WINGSDK_MUT_JSON, WINGSDK_RESOURCE, }; use colored::Colorize; +use indexmap::IndexMap; use wingii::{ fqn::FQN, jsii::{self, CollectionKind, PrimitiveType, TypeReference}, @@ -240,14 +241,21 @@ impl<'a> JsiiImporter<'a> { let enum_fqn = FQN::from(jsii_enum.fqn.as_str()); let enum_symbol = Self::jsii_name_to_symbol(enum_name, &jsii_enum.location_in_module); + let values = jsii_enum + .members + .iter() + .map(|m| { + ( + Self::jsii_name_to_symbol(&m.name, &jsii_enum.location_in_module), + m.docs.as_ref().and_then(|d| d.summary.clone()), + ) + }) + .collect::>(); + let enum_type_ref = self.wing_types.add_type(Type::Enum(Enum { name: enum_symbol.clone(), docs: Docs::from(&jsii_enum.docs), - values: jsii_enum - .members - .iter() - .map(|m| Self::jsii_name_to_symbol(&m.name, &jsii_enum.location_in_module)) - .collect(), + values, })); self.register_jsii_type(&enum_fqn, &enum_symbol, enum_type_ref) diff --git a/libs/wingc/src/visit.rs b/libs/wingc/src/visit.rs index 93afabf0f0c..c53672cac4b 100644 --- a/libs/wingc/src/visit.rs +++ b/libs/wingc/src/visit.rs @@ -286,8 +286,9 @@ where V: Visit<'ast> + ?Sized, { v.visit_symbol(&node.name); - for value in &node.values { + for (value, _doc) in &node.values { v.visit_symbol(value); + // TODO: Visit _doc } } diff --git a/tools/hangar/__snapshots__/test_corpus/valid/class.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/class.test.w_compile_tf-aws.md index e77976b76a5..281194d8046 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/class.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/class.test.w_compile_tf-aws.md @@ -410,6 +410,20 @@ module.exports = function({ }) { //# sourceMappingURL=inflight.C5-1.cjs.map ``` +## inflight.DocClass-1.cjs +```cjs +"use strict"; +const $helpers = require("@winglang/sdk/lib/helpers"); +module.exports = function({ }) { + class DocClass { + constructor({ }) { + } + } + return DocClass; +} +//# sourceMappingURL=inflight.DocClass-1.cjs.map +``` + ## inflight.Foo-1.cjs ```cjs "use strict"; @@ -1347,6 +1361,37 @@ class $Root extends $stdlib.std.Resource { }); } } + class DocClass extends $stdlib.std.Resource { + constructor($scope, $id, ) { + super($scope, $id); + this.docField = 0; + } + docMethod() { + } + static _toInflightType() { + return ` + require("${$helpers.normalPath(__dirname)}/inflight.DocClass-1.cjs")({ + }) + `; + } + _toInflight() { + return ` + (await (async () => { + const DocClassClient = ${DocClass._toInflightType()}; + const client = new DocClassClient({ + }); + if (client.$inflight_init) { await client.$inflight_init(); } + return client; + })()) + `; + } + get _liftMap() { + return ({ + "$inflight_init": [ + ], + }); + } + } new C1(this, "C1"); const c2 = new C2(this, "C2"); $helpers.assert($helpers.eq(c2.x, 1), "c2.x == 1"); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/enums.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/enums.test.w_compile_tf-aws.md index 243a4b95503..426be7f4c97 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/enums.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/enums.test.w_compile_tf-aws.md @@ -83,6 +83,12 @@ class $Root extends $stdlib.std.Resource { return tmp; })({}) ; + const DocumentedEnum = + (function (tmp) { + tmp["VARIANT"] = "VARIANT"; + return tmp; + })({}) + ; class $Closure1 extends $stdlib.std.AutoIdResource { _id = $stdlib.core.closureId(); constructor($scope, $id, ) {