diff --git a/Cargo.lock b/Cargo.lock index c19c2357..eafd9c45 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -420,9 +420,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.30" +version = "1.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945" +checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" dependencies = [ "shlex", ] @@ -3894,7 +3894,7 @@ dependencies = [ [[package]] name = "sync-lsp" -version = "0.11.34-rc1" +version = "0.12.0-rc1" dependencies = [ "anyhow", "clap", @@ -4043,7 +4043,7 @@ dependencies = [ [[package]] name = "tests" -version = "0.11.34-rc1" +version = "0.12.0-rc1" dependencies = [ "insta", "lsp-server", @@ -4146,7 +4146,7 @@ dependencies = [ [[package]] name = "tinymist" -version = "0.11.34-rc1" +version = "0.12.0-rc1" dependencies = [ "anyhow", "async-trait", @@ -4186,7 +4186,7 @@ dependencies = [ "serde_json", "serde_yaml", "sync-lsp", - "tinymist-assets 0.11.34-rc1 (registry+https://github.com/rust-lang/crates.io-index)", + "tinymist-assets 0.12.0-rc1 (registry+https://github.com/rust-lang/crates.io-index)", "tinymist-query", "tinymist-render", "tinymist-world", @@ -4212,7 +4212,7 @@ dependencies = [ [[package]] name = "tinymist-analysis" -version = "0.11.34-rc1" +version = "0.12.0-rc1" dependencies = [ "base64 0.22.1", "comemo 0.4.0", @@ -4229,17 +4229,17 @@ dependencies = [ [[package]] name = "tinymist-assets" -version = "0.11.34-rc1" +version = "0.12.0-rc1" [[package]] name = "tinymist-assets" -version = "0.11.34-rc1" +version = "0.12.0-rc1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6789da5ff45413ee8e72cfc6b250eb38a1ab377e62279e991abe4f5d8ceebe2d" +checksum = "4ed4c8b11b22ae4d2d371262d6eb41a1e021c97c1f49eb32fbf17fbf0ac01a70" [[package]] name = "tinymist-derive" -version = "0.11.34-rc1" +version = "0.12.0-rc1" dependencies = [ "quote", "syn 2.0.79", @@ -4247,7 +4247,7 @@ dependencies = [ [[package]] name = "tinymist-query" -version = "0.11.34-rc1" +version = "0.12.0-rc1" dependencies = [ "anyhow", "base64 0.22.1", @@ -4299,7 +4299,7 @@ dependencies = [ [[package]] name = "tinymist-render" -version = "0.11.34-rc1" +version = "0.12.0-rc1" dependencies = [ "base64 0.22.1", "log", @@ -4310,7 +4310,7 @@ dependencies = [ [[package]] name = "tinymist-world" -version = "0.11.34-rc1" +version = "0.12.0-rc1" dependencies = [ "anyhow", "chrono", @@ -4326,7 +4326,7 @@ dependencies = [ "serde", "serde_json", "tar", - "tinymist-assets 0.11.34-rc1 (registry+https://github.com/rust-lang/crates.io-index)", + "tinymist-assets 0.12.0-rc1 (registry+https://github.com/rust-lang/crates.io-index)", "typst", "typst-assets", ] @@ -4620,7 +4620,7 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "typlite" -version = "0.11.34-rc1" +version = "0.12.0-rc1" dependencies = [ "base64 0.22.1", "comemo 0.4.0", @@ -4773,7 +4773,7 @@ dependencies = [ [[package]] name = "typst-preview" -version = "0.11.34-rc1" +version = "0.12.0-rc1" dependencies = [ "clap", "comemo 0.4.0", @@ -4786,7 +4786,7 @@ dependencies = [ "reflexo-vec2svg", "serde", "serde_json", - "tinymist-assets 0.11.34-rc1 (registry+https://github.com/rust-lang/crates.io-index)", + "tinymist-assets 0.12.0-rc1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio", "typst", "typst-assets", @@ -4813,7 +4813,7 @@ dependencies = [ [[package]] name = "typst-shim" -version = "0.11.34-rc1" +version = "0.12.0-rc1" dependencies = [ "cfg-if", "typst", diff --git a/Cargo.toml b/Cargo.toml index 694ff2cb..47cf48be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [workspace.package] description = "An integrated language service for Typst." authors = ["Myriad-Dreamin ", "Nathan Varner"] -version = "0.11.34-rc1" +version = "0.12.0-rc1" edition = "2021" readme = "README.md" license = "Apache-2.0" @@ -143,7 +143,7 @@ insta = { version = "1.39", features = ["glob"] } # Our Own Crates typst-preview = { path = "./crates/typst-preview" } -tinymist-assets = { version = "0.11.34-rc1" } +tinymist-assets = { version = "0.12.0-rc1" } tinymist = { path = "./crates/tinymist/" } tinymist-derive = { path = "./crates/tinymist-derive/" } tinymist-analysis = { path = "./crates/tinymist-analysis/" } diff --git a/crates/tinymist-query/src/fixtures/hover/snaps/test@builtin.typ.snap b/crates/tinymist-query/src/fixtures/hover/snaps/test@builtin.typ.snap index bfd9793d..55b89c04 100644 --- a/crates/tinymist-query/src/fixtures/hover/snaps/test@builtin.typ.snap +++ b/crates/tinymist-query/src/fixtures/hover/snaps/test@builtin.typ.snap @@ -4,6 +4,6 @@ expression: "JsonRepr::new_redacted(result, &REDACT_LOC)" input_file: crates/tinymist-query/src/fixtures/hover/builtin.typ --- { - "contents": "```typc\nlet table(..children: content, align: alignment | array | auto | function = auto, column-gutter: array | auto | integer | length = (), columns: array | auto | integer | length = (), fill: color = none, gutter: array | auto | integer | length = (), inset: inset = 5pt, row-gutter: array | auto | integer | length = (), rows: array | auto | integer | length = (), stroke: stroke = 1pt + black);\n```\n\n---\nA table of items.\n\nTables are used to arrange content in cells. Cells can contain arbitrary\ncontent, including multiple paragraphs and are specified in row-major order.\nFor a hands-on explanation of all the ways you can use and customize tables\nin Typst, check out the [table guide](https://typst.app/docs/guides/table-guide/).\n\nBecause tables are just grids with different defaults for some cell\nproperties (notably `stroke` and `inset`), refer to the [grid\ndocumentation](https://typst.app/docs/reference/layout/grid/) for more information on how to size the table tracks\nand specify the cell appearance properties.\n\nIf you are unsure whether you should be using a table or a grid, consider\nwhether the content you are arranging semantically belongs together as a set\nof related data points or similar or whether you are just want to enhance\nyour presentation by arranging unrelated content in a grid. In the former\ncase, a table is the right choice, while in the latter case, a grid is more\nappropriate. Furthermore, Typst will annotate its output in the future such\nthat screenreaders will annouce content in `table` as tabular while a grid's\ncontent will be announced no different than multiple content blocks in the\ndocument flow.\n\nNote that, to override a particular cell's properties or apply show rules on\ntable cells, you can use the [`table.cell`](https://typst.app/docs/reference/model/table/#definitions-cell) element. See its\ndocumentation for more information.\n\nAlthough the `table` and the `grid` share most properties, set and show\nrules on one of them do not affect the other.\n\nTo give a table a caption and make it [referenceable](https://typst.app/docs/reference/model/ref/), put it into a\n[figure].\n\n# Example\n\nThe example below demonstrates some of the most common table options.\n```typ\n#table(\n columns: (1fr, auto, auto),\n inset: 10pt,\n align: horizon,\n table.header(\n [], [*Area*], [*Parameters*],\n ),\n image(\"cylinder.svg\"),\n $ pi h (D^2 - d^2) / 4 $,\n [\n $h$: height \\\n $D$: outer radius \\\n $d$: inner radius\n ],\n image(\"tetrahedron.svg\"),\n $ sqrt(2) / 12 a^3 $,\n [$a$: edge length]\n)\n```\n\nMuch like with grids, you can use [`table.cell`](https://typst.app/docs/reference/model/table/#definitions-cell) to customize\nthe appearance and the position of each cell.\n\n```typ\n>>> #set page(width: auto)\n>>> #set text(font: \"IBM Plex Sans\")\n>>> #let gray = rgb(\"#565565\")\n>>>\n#set table(\n stroke: none,\n gutter: 0.2em,\n fill: (x, y) =>\n if x == 0 or y == 0 { gray },\n inset: (right: 1.5em),\n)\n\n#show table.cell: it => {\n if it.x == 0 or it.y == 0 {\n set text(white)\n strong(it)\n } else if it.body == [] {\n // Replace empty cells with 'N/A'\n pad(..it.inset)[_N/A_]\n } else {\n it\n }\n}\n\n#let a = table.cell(\n fill: green.lighten(60%),\n)[A]\n#let b = table.cell(\n fill: aqua.lighten(60%),\n)[B]\n\n#table(\n columns: 4,\n [], [Exam 1], [Exam 2], [Exam 3],\n\n [John], [], a, [],\n [Mary], [], a, a,\n [Robert], b, a, b,\n)\n```\n\n## Parameters\n\n@named `align` — How to align the cells' content.\n\nThis can either be a single alignment, an array of alignments\n(corresponding to each column) or a function that returns an alignment.\nThe function receives the cells' column and row indices, starting from\nzero. If set to `auto`, the outer alignment is used.\n\n```typ\n#table(\n columns: 3,\n align: (left, center, right),\n [Hello], [Hello], [Hello],\n [A], [B], [C],\n)\n```\n\n@named `column-gutter` — The gaps between columns. Takes precedence over `gutter`. See the\n[grid documentation](https://typst.app/docs/reference/layout/grid/) for more information on gutters.\n\n@named `columns` — The column sizes. See the [grid documentation](https://typst.app/docs/reference/layout/grid/) for more\ninformation on track sizing.\n\n@named `fill` — How to fill the cells.\n\nThis can be a color or a function that returns a color. The function\nreceives the cells' column and row indices, starting from zero. This can\nbe used to implement striped tables.\n\n```typ\n#table(\n fill: (x, _) =>\n if calc.odd(x) { luma(240) }\n else { white },\n align: (x, y) =>\n if y == 0 { center }\n else if x == 0 { left }\n else { right },\n columns: 4,\n [], [*Q1*], [*Q2*], [*Q3*],\n [Revenue:], [1000 €], [2000 €], [3000 €],\n [Expenses:], [500 €], [1000 €], [1500 €],\n [Profit:], [500 €], [1000 €], [1500 €],\n)\n```\n\n@named `gutter` — The gaps between rows and columns. See the [grid documentation](https://typst.app/docs/reference/layout/grid/)\nfor more information on gutters.\n\n@named `inset` — How much to pad the cells' content.\n\n```typ\n#table(\n inset: 10pt,\n [Hello],\n [World],\n)\n\n#table(\n columns: 2,\n inset: (\n x: 20pt,\n y: 10pt,\n ),\n [Hello],\n [World],\n)\n```\n\n@named `row-gutter` — The gaps between rows. Takes precedence over `gutter`. See the\n[grid documentation](https://typst.app/docs/reference/layout/grid/) for more information on gutters.\n\n@named `rows` — The row sizes. See the [grid documentation](https://typst.app/docs/reference/layout/grid/) for more information\non track sizing.\n\n@named `stroke` — How to [stroke] the cells.\n\nStrokes can be disabled by setting this to `none`.\n\nIf it is necessary to place lines which can cross spacing between cells\nproduced by the `gutter` option, or to override the stroke between\nmultiple specific cells, consider specifying one or more of\n[`table.hline`](https://typst.app/docs/reference/model/table/#definitions-hline) and [`table.vline`](https://typst.app/docs/reference/model/table/#definitions-vline)\nalongside your table cells.\n\nSee the [grid documentation](https://typst.app/docs/reference/layout/grid/#parameters-stroke) for more information on\nstrokes.\n\n@rest `children` — The contents of the table cells, plus any extra table lines specified\nwith the [`table.hline`](https://typst.app/docs/reference/model/table/#definitions-hline) and\n[`table.vline`](https://typst.app/docs/reference/model/table/#definitions-vline) elements.\n\n---\n[Open docs](https://typst.app/docs/reference/model/table/)", + "contents": "```typc\nlet table(..children: content, align: alignment | array | auto | function = auto, column-gutter: array | auto | integer | length = (), columns: array | auto | integer | length = (), fill: color = none, gutter: array | auto | integer | length = (), inset: inset = 0% + 5pt, row-gutter: array | auto | integer | length = (), rows: array | auto | integer | length = (), stroke: stroke = 1pt + black);\n```\n\n---\nA table of items.\n\nTables are used to arrange content in cells. Cells can contain arbitrary\ncontent, including multiple paragraphs and are specified in row-major order.\nFor a hands-on explanation of all the ways you can use and customize tables\nin Typst, check out the [table guide](https://typst.app/docs/guides/table-guide/).\n\nBecause tables are just grids with different defaults for some cell\nproperties (notably `stroke` and `inset`), refer to the [grid\ndocumentation](https://typst.app/docs/reference/layout/grid/) for more information on how to size the table tracks\nand specify the cell appearance properties.\n\nIf you are unsure whether you should be using a table or a grid, consider\nwhether the content you are arranging semantically belongs together as a set\nof related data points or similar or whether you are just want to enhance\nyour presentation by arranging unrelated content in a grid. In the former\ncase, a table is the right choice, while in the latter case, a grid is more\nappropriate. Furthermore, Typst will annotate its output in the future such\nthat screenreaders will announce content in `table` as tabular while a\ngrid's content will be announced no different than multiple content blocks\nin the document flow.\n\nNote that, to override a particular cell's properties or apply show rules on\ntable cells, you can use the [`table.cell`](https://typst.app/docs/reference/model/table/#definitions-cell) element. See its\ndocumentation for more information.\n\nAlthough the `table` and the `grid` share most properties, set and show\nrules on one of them do not affect the other.\n\nTo give a table a caption and make it [referenceable](https://typst.app/docs/reference/model/ref/), put it into a\n[figure].\n\n# Example\n\nThe example below demonstrates some of the most common table options.\n```typ\n#table(\n columns: (1fr, auto, auto),\n inset: 10pt,\n align: horizon,\n table.header(\n [], [*Volume*], [*Parameters*],\n ),\n image(\"cylinder.svg\"),\n $ pi h (D^2 - d^2) / 4 $,\n [\n $h$: height \\\n $D$: outer radius \\\n $d$: inner radius\n ],\n image(\"tetrahedron.svg\"),\n $ sqrt(2) / 12 a^3 $,\n [$a$: edge length]\n)\n```\n\nMuch like with grids, you can use [`table.cell`](https://typst.app/docs/reference/model/table/#definitions-cell) to customize\nthe appearance and the position of each cell.\n\n```typ\n>>> #set page(width: auto)\n>>> #set text(font: \"IBM Plex Sans\")\n>>> #let gray = rgb(\"#565565\")\n>>>\n#set table(\n stroke: none,\n gutter: 0.2em,\n fill: (x, y) =>\n if x == 0 or y == 0 { gray },\n inset: (right: 1.5em),\n)\n\n#show table.cell: it => {\n if it.x == 0 or it.y == 0 {\n set text(white)\n strong(it)\n } else if it.body == [] {\n // Replace empty cells with 'N/A'\n pad(..it.inset)[_N/A_]\n } else {\n it\n }\n}\n\n#let a = table.cell(\n fill: green.lighten(60%),\n)[A]\n#let b = table.cell(\n fill: aqua.lighten(60%),\n)[B]\n\n#table(\n columns: 4,\n [], [Exam 1], [Exam 2], [Exam 3],\n\n [John], [], a, [],\n [Mary], [], a, a,\n [Robert], b, a, b,\n)\n```\n\n## Parameters\n\n@named `align` — How to align the cells' content.\n\nThis can either be a single alignment, an array of alignments\n(corresponding to each column) or a function that returns an alignment.\nThe function receives the cells' column and row indices, starting from\nzero. If set to `auto`, the outer alignment is used.\n\n```typ\n#table(\n columns: 3,\n align: (left, center, right),\n [Hello], [Hello], [Hello],\n [A], [B], [C],\n)\n```\n\n@named `column-gutter` — The gaps between columns. Takes precedence over `gutter`. See the\n[grid documentation](https://typst.app/docs/reference/layout/grid/) for more information on gutters.\n\n@named `columns` — The column sizes. See the [grid documentation](https://typst.app/docs/reference/layout/grid/) for more\ninformation on track sizing.\n\n@named `fill` — How to fill the cells.\n\nThis can be a color or a function that returns a color. The function\nreceives the cells' column and row indices, starting from zero. This can\nbe used to implement striped tables.\n\n```typ\n#table(\n fill: (x, _) =>\n if calc.odd(x) { luma(240) }\n else { white },\n align: (x, y) =>\n if y == 0 { center }\n else if x == 0 { left }\n else { right },\n columns: 4,\n [], [*Q1*], [*Q2*], [*Q3*],\n [Revenue:], [1000 €], [2000 €], [3000 €],\n [Expenses:], [500 €], [1000 €], [1500 €],\n [Profit:], [500 €], [1000 €], [1500 €],\n)\n```\n\n@named `gutter` — The gaps between rows and columns. This is a shorthand for setting\n`column-gutter` and `row-gutter` to the same value. See the [grid\ndocumentation](https://typst.app/docs/reference/layout/grid/) for more information on gutters.\n\n@named `inset` — How much to pad the cells' content.\n\n```typ\n#table(\n inset: 10pt,\n [Hello],\n [World],\n)\n\n#table(\n columns: 2,\n inset: (\n x: 20pt,\n y: 10pt,\n ),\n [Hello],\n [World],\n)\n```\n\n@named `row-gutter` — The gaps between rows. Takes precedence over `gutter`. See the\n[grid documentation](https://typst.app/docs/reference/layout/grid/) for more information on gutters.\n\n@named `rows` — The row sizes. See the [grid documentation](https://typst.app/docs/reference/layout/grid/) for more information\non track sizing.\n\n@named `stroke` — How to [stroke] the cells.\n\nStrokes can be disabled by setting this to `none`.\n\nIf it is necessary to place lines which can cross spacing between cells\nproduced by the `gutter` option, or to override the stroke between\nmultiple specific cells, consider specifying one or more of\n[`table.hline`](https://typst.app/docs/reference/model/table/#definitions-hline) and [`table.vline`](https://typst.app/docs/reference/model/table/#definitions-vline)\nalongside your table cells.\n\nSee the [grid documentation](https://typst.app/docs/reference/layout/grid/#parameters-stroke) for more information on\nstrokes.\n\n@rest `children` — The contents of the table cells, plus any extra table lines specified\nwith the [`table.hline`](https://typst.app/docs/reference/model/table/#definitions-hline) and\n[`table.vline`](https://typst.app/docs/reference/model/table/#definitions-vline) elements.\n\n---\n[Open docs](https://typst.app/docs/reference/model/table/)", "range": "0:20:0:25" } diff --git a/crates/tinymist-query/src/fixtures/type_check/snaps/test@annotation_var.typ.snap b/crates/tinymist-query/src/fixtures/type_check/snaps/test@annotation_var.typ.snap index 00dbe7fa..25f28150 100644 --- a/crates/tinymist-query/src/fixtures/type_check/snaps/test@annotation_var.typ.snap +++ b/crates/tinymist-query/src/fixtures/type_check/snaps/test@annotation_var.typ.snap @@ -3,8 +3,15 @@ source: crates/tinymist-query/src/analysis.rs expression: result input_file: crates/tinymist-query/src/fixtures/type_check/annotation_var.typ --- +"f" = Any "mapper" = (Type(function) | (Any, Any) => Any) "x" = Any +"x" = Any "y" = Any --- 56..62 -> @mapper +66..67 -> @x +69..70 -> @f +75..76 -> @x +75..83 -> Any +81..82 -> @f diff --git a/crates/tinymist-query/src/fixtures/type_check/snaps/test@tuple_map.typ.snap b/crates/tinymist-query/src/fixtures/type_check/snaps/test@tuple_map.typ.snap index 5df1db06..89e16d79 100644 --- a/crates/tinymist-query/src/fixtures/type_check/snaps/test@tuple_map.typ.snap +++ b/crates/tinymist-query/src/fixtures/type_check/snaps/test@tuple_map.typ.snap @@ -4,12 +4,17 @@ expression: result input_file: crates/tinymist-query/src/fixtures/type_check/tuple_map.typ --- "a" = (1, ) -"b" = (Any, ) -"f" = Undef +"b" = (Type(string), ) +"f" = (( ⪯ (Type(bytes) | Type(decimal) | Type(float) | Type(integer) | Type(label) | Type(string) | Type(type) | Type(version)))) => Type(string) +"x" = Any --- 5..6 -> @a 20..21 -> @f +24..25 -> @x +29..32 -> Type(string) +29..35 -> Type(string) +33..34 -> @x 42..43 -> @b 46..47 -> @a -46..54 -> (Any, ) +46..54 -> (Type(string), ) 52..53 -> @f diff --git a/editors/vscode/CHANGELOG.md b/editors/vscode/CHANGELOG.md index 2e54d687..41512f20 100644 --- a/editors/vscode/CHANGELOG.md +++ b/editors/vscode/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to the "tinymist" extension will be documented in this file. Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. -## v0.11.34 - [2024-10-19] +## v0.12.0 - [2024-10-19] ### Document Link diff --git a/editors/vscode/package.json b/editors/vscode/package.json index 89205260..72de8fa6 100644 --- a/editors/vscode/package.json +++ b/editors/vscode/package.json @@ -1,6 +1,6 @@ { "name": "tinymist", - "version": "0.11.34-rc1", + "version": "0.12.0-rc1", "description": "An integrated language service for Typst", "categories": [ "Programming Languages", diff --git a/syntaxes/textmate/package.json b/syntaxes/textmate/package.json index f1d0f590..6a69eeb3 100644 --- a/syntaxes/textmate/package.json +++ b/syntaxes/textmate/package.json @@ -1,6 +1,6 @@ { "name": "typst-textmate", - "version": "0.11.34-rc1", + "version": "0.12.0-rc1", "private": true, "scripts": { "compile": "npx tsc && node ./dist/main.mjs",