feat: support doc comments for functions args and validator params

- Add support to the formatter for these doc comments
- Add a new field to `Arg` `doc: Option<String>`
- Don't attach docs immediately after typechecking a module
  - instead we should do it on demand in docs, build, and lsp
  - the check command doesn't need to have any docs attached
  - doing it more lazily defers the computation until later making
    typechecking feedback a bit faster
- Add support for function arg and validator param docs in
  `attach_module_docs` methods
- Update some snapshots
- Add put_doc to Arg

closes #685
This commit is contained in:
rvcas
2023-10-16 13:33:14 -04:00
parent 10b9dc2042
commit e5801f9c19
16 changed files with 205 additions and 34 deletions

View File

@@ -82,6 +82,7 @@ pub fn param(is_validator_param: bool) -> impl Parser<Token, ast::UntypedArg, Er
.map_with_span(|(arg_name, annotation), span| ast::Arg {
location: span,
annotation,
doc: None,
tipo: (),
arg_name,
})

View File

@@ -17,6 +17,7 @@ Validator(
},
location: 21..26,
annotation: None,
doc: None,
tipo: (),
},
Arg {
@@ -28,6 +29,7 @@ Validator(
},
location: 28..32,
annotation: None,
doc: None,
tipo: (),
},
Arg {
@@ -39,6 +41,7 @@ Validator(
},
location: 34..37,
annotation: None,
doc: None,
tipo: (),
},
],
@@ -67,6 +70,7 @@ Validator(
},
location: 64..68,
annotation: None,
doc: None,
tipo: (),
},
Arg {
@@ -78,6 +82,7 @@ Validator(
},
location: 70..73,
annotation: None,
doc: None,
tipo: (),
},
],

View File

@@ -17,6 +17,7 @@ Validator(
},
location: 21..26,
annotation: None,
doc: None,
tipo: (),
},
Arg {
@@ -28,6 +29,7 @@ Validator(
},
location: 28..32,
annotation: None,
doc: None,
tipo: (),
},
Arg {
@@ -39,6 +41,7 @@ Validator(
},
location: 34..37,
annotation: None,
doc: None,
tipo: (),
},
],