mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-07-24 13:13:43 +00:00
feat: post check element types of array and dict (#1417)
This commit is contained in:
parent
a191b7c852
commit
ebfc93c104
10 changed files with 23 additions and 16 deletions
|
@ -87,9 +87,8 @@ fn check_signature<'a>(
|
|||
}
|
||||
|
||||
// names
|
||||
for (name, _) in sig_ins.named_params() {
|
||||
// todo: reduce fields, fields ty
|
||||
let field = ParamTy::new_untyped(name.clone(), ParamAttrs::named());
|
||||
for (name, ty) in sig_ins.named_params() {
|
||||
let field = ParamTy::new(ty.clone(), name.clone(), ParamAttrs::named());
|
||||
receiver.insert(Ty::Param(field), !pol);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ source: crates/tinymist-query/src/completion.rs
|
|||
description: Completion on ) (63..64)
|
||||
expression: "JsonRepr::new_pure(results)"
|
||||
input_file: crates/tinymist-query/src/fixtures/completion/sig_dict.typ
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
@ -12,6 +11,9 @@ snapshot_kind: text
|
|||
{
|
||||
"kind": 5,
|
||||
"label": "cap",
|
||||
"labelDetails": {
|
||||
"description": "\"butt\" | \"round\" | \"square\""
|
||||
},
|
||||
"sortText": "000",
|
||||
"textEdit": {
|
||||
"newText": "cap: ${1:}",
|
||||
|
@ -30,6 +32,9 @@ snapshot_kind: text
|
|||
{
|
||||
"kind": 5,
|
||||
"label": "paint",
|
||||
"labelDetails": {
|
||||
"description": "color"
|
||||
},
|
||||
"sortText": "004",
|
||||
"textEdit": {
|
||||
"newText": "paint: ${1:}",
|
||||
|
|
|
@ -3,7 +3,6 @@ source: crates/tinymist-query/src/completion.rs
|
|||
description: Completion on ) (75..76)
|
||||
expression: "JsonRepr::new_pure(results)"
|
||||
input_file: crates/tinymist-query/src/fixtures/completion/sig_dict_rest.typ
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
@ -12,6 +11,9 @@ snapshot_kind: text
|
|||
{
|
||||
"kind": 5,
|
||||
"label": "cap",
|
||||
"labelDetails": {
|
||||
"description": "\"butt\" | \"round\" | \"square\""
|
||||
},
|
||||
"sortText": "000",
|
||||
"textEdit": {
|
||||
"newText": "cap: ${1:}",
|
||||
|
|
|
@ -4,4 +4,4 @@ description: "Check on \"\\\"Test\\\"\" (34)"
|
|||
expression: post_ty
|
||||
input_file: crates/tinymist-query/src/fixtures/post_type_check/text_font_element.typ
|
||||
---
|
||||
( ⪰ TextFont | "covers": Any | "name": Any | (TextFont | Array<TextFont>))
|
||||
( ⪰ TextFont | "covers": (Type(regex) | "latin-in-cjk") | "name": TextFont | (TextFont | Array<TextFont>))
|
||||
|
|
|
@ -4,4 +4,4 @@ description: "Check on \"\\\"Test\\\"\" (31)"
|
|||
expression: post_ty
|
||||
input_file: crates/tinymist-query/src/fixtures/post_type_check/text_font_element2.typ
|
||||
---
|
||||
( ⪰ ( ⪰ "Test" ⪯ (TextFont | Array<TextFont>)) ⪯ TextFont & "covers": Any & "name": Any)
|
||||
( ⪰ ( ⪰ "Test" ⪯ (TextFont | Array<TextFont>)) ⪯ TextFont & "covers": (Type(regex) | "latin-in-cjk") & "name": TextFont)
|
||||
|
|
|
@ -3,6 +3,5 @@ source: crates/tinymist-query/src/analysis.rs
|
|||
description: "Check on \")\" (82)"
|
||||
expression: post_ty
|
||||
input_file: crates/tinymist-query/src/fixtures/post_type_check/text_stroke.typ
|
||||
snapshot_kind: text
|
||||
---
|
||||
( ⪰ "cap": Any | "dash": Any | "join": Any | "miter-limit": Any | "paint": Any | "thickness": Any)
|
||||
( ⪰ "cap": ("butt" | "round" | "square") | "dash": ("dash-dotted" | "dashed" | "densely-dash-dotted" | "densely-dashed" | "densely-dotted" | "dotted" | "loosely-dash-dotted" | "loosely-dashed" | "loosely-dotted" | "solid" | {"array": Array<(Float | "dot")>, "phase": Length} | Array<(Float | "dot")>) | "join": ("bevel" | "miter" | "round") | "miter-limit": Float | "paint": Color | "thickness": Length)
|
||||
|
|
|
@ -3,6 +3,5 @@ source: crates/tinymist-query/src/analysis.rs
|
|||
description: "Check on \"(\" (61)"
|
||||
expression: post_ty
|
||||
input_file: crates/tinymist-query/src/fixtures/post_type_check/text_stroke1.typ
|
||||
snapshot_kind: text
|
||||
---
|
||||
( ⪰ "cap": Any | "dash": Any | "join": Any | "miter-limit": Any | "paint": Any | "thickness": Any)
|
||||
( ⪰ "cap": ("butt" | "round" | "square") | "dash": ("dash-dotted" | "dashed" | "densely-dash-dotted" | "densely-dashed" | "densely-dotted" | "dotted" | "loosely-dash-dotted" | "loosely-dashed" | "loosely-dotted" | "solid" | {"array": Array<(Float | "dot")>, "phase": Length} | Array<(Float | "dot")>) | "join": ("bevel" | "miter" | "round") | "miter-limit": Float | "paint": Color | "thickness": Length)
|
||||
|
|
|
@ -3,6 +3,5 @@ source: crates/tinymist-query/src/analysis.rs
|
|||
description: "Check on \"(\" (49)"
|
||||
expression: post_ty
|
||||
input_file: crates/tinymist-query/src/fixtures/post_type_check/text_stroke3.typ
|
||||
snapshot_kind: text
|
||||
---
|
||||
( ⪰ "cap": Any | "dash": Any | "join": Any | "miter-limit": Any | "paint": Any | "thickness": Any)
|
||||
( ⪰ "cap": ("butt" | "round" | "square") | "dash": ("dash-dotted" | "dashed" | "densely-dash-dotted" | "densely-dashed" | "densely-dotted" | "dotted" | "loosely-dash-dotted" | "loosely-dashed" | "loosely-dotted" | "solid" | {"array": Array<(Float | "dot")>, "phase": Length} | Array<(Float | "dot")>) | "join": ("bevel" | "miter" | "round") | "miter-limit": Float | "paint": Color | "thickness": Length)
|
||||
|
|
|
@ -3,6 +3,5 @@ source: crates/tinymist-query/src/analysis.rs
|
|||
description: "Check on \"(\" (85)"
|
||||
expression: post_ty
|
||||
input_file: crates/tinymist-query/src/fixtures/post_type_check/user_func_pos2.typ
|
||||
snapshot_kind: text
|
||||
---
|
||||
( ⪰ "cap": Any | "dash": Any | "join": Any | "miter-limit": Any | "paint": Any | "thickness": Any)
|
||||
( ⪰ "cap": ("butt" | "round" | "square") | "dash": ("dash-dotted" | "dashed" | "densely-dash-dotted" | "densely-dashed" | "densely-dotted" | "dotted" | "loosely-dash-dotted" | "loosely-dashed" | "loosely-dotted" | "solid" | {"array": Array<(Float | "dot")>, "phase": Length} | Array<(Float | "dot")>) | "join": ("bevel" | "miter" | "round") | "miter-limit": Float | "paint": Color | "thickness": Length)
|
||||
|
|
|
@ -620,9 +620,14 @@ pub struct ParamTy {
|
|||
impl ParamTy {
|
||||
/// Create an untyped field type
|
||||
pub fn new_untyped(name: StrRef, attrs: ParamAttrs) -> Interned<Self> {
|
||||
Self::new(Ty::Any, name, attrs)
|
||||
}
|
||||
|
||||
/// Create a typed field type
|
||||
pub fn new(ty: Ty, name: StrRef, attrs: ParamAttrs) -> Interned<Self> {
|
||||
Interned::new(Self {
|
||||
name,
|
||||
ty: Ty::Any,
|
||||
ty,
|
||||
docs: None,
|
||||
default: None,
|
||||
attrs,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue