From b635f066199f5fb441bff164645dd70450f363df Mon Sep 17 00:00:00 2001 From: Myriad-Dreamin <35292584+Myriad-Dreamin@users.noreply.github.com> Date: Sat, 30 Mar 2024 23:02:43 +0800 Subject: [PATCH] build: bump version to 0.11.2 (#136) * docs: update documents * fix: correct order of building binaries * build: bump version to 0.11.2 * docs: redirect changelog * docs: update document tips * docs: update insert template in place tips * build: bump typstyle version to 0.11.7 --- .github/workflows/release.yml | 32 +++++++++++------------ CHANGELOG.md | 1 + Cargo.lock | 10 ++++---- Cargo.toml | 4 +-- crates/tinymist/README.md | 6 ++--- crates/tinymist/src/lib.rs | 4 +-- crates/tinymist/src/server/lsp.rs | 28 +-------------------- editors/helix/README.md | 21 +++++++++++++--- editors/neovim/Configuration.md | 7 +++--- editors/vscode/CHANGELOG.md | 42 +++++++++++++++++++++++++++++++ editors/vscode/Configuration.md | 7 +++--- editors/vscode/README.md | 32 ++++++++++++++++++++--- editors/vscode/package.json | 2 +- syntaxes/textmate/package.json | 2 +- 14 files changed, 129 insertions(+), 69 deletions(-) create mode 100644 CHANGELOG.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4a0d36565..52c84e251 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -116,6 +116,22 @@ jobs: run: | cargo build --release -p tinymist --target ${{ matrix.rust-target }} if: startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true' + - name: Rename debug symbols for windows + if: matrix.platform == 'win32' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') + run: | + cd target/${{ matrix.rust-target }}/release + cp tinymist.pdb tinymist-${{ env.target }}.pdb + - name: Split debug symbols for linux + if: matrix.platform == 'linux' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') + run: | + cd target/${{ matrix.rust-target }}/release + llvm-objcopy --compress-debug-sections --only-keep-debug "tinymist" "tinymist-${{ env.target }}.debug" + llvm-objcopy --strip-debug --add-gnu-debuglink="tinymist-${{ env.target }}.debug" "tinymist" + - name: Collect debug symbols for mac + if: matrix.platform == 'darwin' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') + run: | + dsymutil -f "target/${{ matrix.rust-target }}/release/tinymist" + mv "target/${{ matrix.rust-target }}/release/tinymist.dwarf" "target/${{ matrix.rust-target }}/release/tinymist-${{ env.target }}.dwarf" - name: Copy binary to output directory if: (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') shell: pwsh @@ -126,23 +142,12 @@ jobs: run: | cargo test --release --workspace --target ${{ matrix.rust-target }} if: (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') && (matrix.platform == 'linux') && (matrix.arch == 'x64') - - name: Rename debug symbols for windows - if: matrix.platform == 'win32' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') - run: | - cd target/${{ matrix.rust-target }}/release - cp tinymist.pdb tinymist-${{ env.target }}.pdb - name: Upload split debug symbols for windows if: matrix.platform == 'win32' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') uses: actions/upload-artifact@v4 with: name: tinymist-${{ env.target }}.pdb path: target/${{ matrix.rust-target }}/release/tinymist-${{ env.target }}.pdb - - name: Split debug symbols for linux - if: matrix.platform == 'linux' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') - run: | - cd target/${{ matrix.rust-target }}/release - llvm-objcopy --compress-debug-sections --only-keep-debug "tinymist" "tinymist-${{ env.target }}.debug" - llvm-objcopy --strip-debug --add-gnu-debuglink="tinymist-${{ env.target }}.debug" "tinymist" - name: Upload split debug symbols for linux if: matrix.platform == 'linux' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') uses: actions/upload-artifact@v4 @@ -150,11 +155,6 @@ jobs: name: tinymist-${{ env.target }}.debug path: target/${{ matrix.rust-target }}/release/tinymist-${{ env.target }}.debug compression-level: 0 - - name: Collect debug symbols for mac - if: matrix.platform == 'darwin' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') - run: | - dsymutil -f "target/${{ matrix.rust-target }}/release/tinymist" - mv "target/${{ matrix.rust-target }}/release/tinymist.dwarf" "target/${{ matrix.rust-target }}/release/tinymist-${{ env.target }}.dwarf" - name: Upload split debug symbols for mac if: matrix.platform == 'darwin' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') uses: actions/upload-artifact@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..5ef631b94 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1 @@ +[CHANGELOG.md](./editors/vscode/CHANGELOG.md) \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index d2f96ad22..53f62d6a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3595,7 +3595,7 @@ dependencies = [ [[package]] name = "tests" -version = "0.11.1" +version = "0.11.2" dependencies = [ "insta", "lsp-server", @@ -3692,7 +3692,7 @@ dependencies = [ [[package]] name = "tinymist" -version = "0.11.1" +version = "0.11.2" dependencies = [ "anyhow", "async-trait", @@ -3739,7 +3739,7 @@ dependencies = [ [[package]] name = "tinymist-query" -version = "0.11.1" +version = "0.11.2" dependencies = [ "anyhow", "comemo 0.4.0", @@ -4371,9 +4371,9 @@ dependencies = [ [[package]] name = "typstyle" -version = "0.11.5" +version = "0.11.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c988471bb18b9f743fed9bd2be724c872c442e58c213025bfe63e96b76cd18" +checksum = "fccb2f17f77e44b1ab91257f51c817ec357d768456cc1d07ba84bcb030d55ed9" dependencies = [ "anyhow", "clap", diff --git a/Cargo.toml b/Cargo.toml index 4f70ed75c..28a37d6ec 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.1" +version = "0.11.2" edition = "2021" readme = "README.md" license = "Apache-2.0" @@ -52,7 +52,7 @@ reflexo = { version = "0.5.0-rc2", default-features = false, features = [ typst-ts-core = { version = "0.5.0-rc2", default-features = false } typst-ts-compiler = { version = "0.5.0-rc2" } typst-preview = { version = "0.11.3" } -typstyle = "0.11.5" +typstyle = "0.11.7" typstfmt_lib = { git = "https://github.com/astrale-sharp/typstfmt", tag = "0.2.7" } lsp-server = "0.7.6" diff --git a/crates/tinymist/README.md b/crates/tinymist/README.md index 85fe4621c..e8081055c 100644 --- a/crates/tinymist/README.md +++ b/crates/tinymist/README.md @@ -18,9 +18,9 @@ You can record the input during running the editors with Tinymist. You can then ```sh # Record the input -tinymist --mirror input.txt +tinymist lsp --mirror input.txt # Replay the input -tinymist --replay input.txt +tinymist lsp --replay input.txt ``` ## Analyze memory usage with DHAT @@ -34,7 +34,7 @@ cargo build --release --bin tinymist --features dhat-heap The instrumented program is nothing different from the normal program, so you can mine the specific memory usage with a lsp session (recorded with `--mirror`) by replaying the input. ```sh -./target/release/tinymist --replay input.txt +./target/release/tinymist lsp --replay input.txt ... dhat: Total: 740,668,176 bytes in 1,646,987 blocks dhat: At t-gmax: 264,604,009 bytes in 317,241 blocks diff --git a/crates/tinymist/src/lib.rs b/crates/tinymist/src/lib.rs index d89e7eaa0..1d3a11233 100644 --- a/crates/tinymist/src/lib.rs +++ b/crates/tinymist/src/lib.rs @@ -21,9 +21,9 @@ //! //! ```sh //! # Record the input -//! tinymist --mirror input.txt +//! tinymist lsp --mirror input.txt //! # Replay the input -//! tinymist --replay input.txt +//! tinymist lsp --replay input.txt //! ``` // pub mod formatting; diff --git a/crates/tinymist/src/server/lsp.rs b/crates/tinymist/src/server/lsp.rs index 793195485..a49738908 100644 --- a/crates/tinymist/src/server/lsp.rs +++ b/crates/tinymist/src/server/lsp.rs @@ -1,30 +1,4 @@ -//! # tinymist -//! -//! This crate provides an integrated service for [Typst](https://typst.app/) [taɪpst]. It provides: -//! + A language server following the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/). -//! -//! ## Architecture -//! -//! Tinymist binary has multiple modes, and it may runs multiple actors in -//! background. The actors could run as an async task, in a single thread, or in -//! an isolated process. -//! -//! The main process of tinymist runs the program as a language server, through -//! stdin and stdout. A main process will fork: -//! - rendering actors to provide PDF export with watching. -//! - compiler actors to provide language APIs. -//! -//! ## Debugging with input mirroring -//! -//! You can record the input during running the editors with Tinymist. You can -//! then replay the input to debug the language server. -//! -//! ```sh -//! # Record the input -//! tinymist --mirror input.txt -//! # Replay the input -//! tinymist --replay input.txt -//! ``` +//! tinymist LSP mode use core::fmt; use std::path::Path; diff --git a/editors/helix/README.md b/editors/helix/README.md index 71545fba1..4f7c184e0 100644 --- a/editors/helix/README.md +++ b/editors/helix/README.md @@ -36,10 +36,25 @@ language-servers = ["tinymist"] ### Working with Multiple-File Projects -There is a way in [Neovim](../neovim/README.md#multiple-file-project-support), and you can invoke related commands similarly by [:lsp-workspace-command](https://docs.helix-editor.com/commands.html) in helix. +There is a way in [Neovim](../neovim/README.md#multiple-file-project-support), but you cannot invoke related commands with arguments by [:lsp-workspace-command](https://docs.helix-editor.com/commands.html) in helix. As a candidate solution, assuming your having following directory layout: -+ You can bind `:lsp-workspace-command` to a keymap for ease of use. -+ When multiple language servers are configured for a file, using `:lsp-workspace-command` will only show the commands for one of the servers, that means the tinymist commands may be overriden by other language servers, e.g. `ltex`. See [Issue: helix#9017](https://github.com/helix-editor/helix/issues/9017). +```plain +├── .helix +│ └── languages.toml +└── main.typ +``` + + +You could create .helix/languages.toml in the project folder with the following contents: + +```toml +[language-server.tinymist.config] +typstExtraArgs = ["main.typ"] +``` + +Then all diagnostics and autocompletion will be computed according to the `main.typ`. + +Note: With that configuration, if you're seeing a file that is not reachable by `main.typ`, you will not get diagnostics and autocompletion correctly in that file. ## Extra Settings diff --git a/editors/neovim/Configuration.md b/editors/neovim/Configuration.md index 69a072f3c..1008bbda0 100644 --- a/editors/neovim/Configuration.md +++ b/editors/neovim/Configuration.md @@ -72,12 +72,13 @@ Traces the communication between VS Code and the language server. - `verbose` - **Default**: `"off"` -## `experimentalFormatterMode` +## `formatterMode` -The extension can format Typst files using typstfmt (experimental). +The extension can format Typst files using typstfmt or typstyle. - **Type**: `string` - **Enum**: - `disable`: Formatter is not activated. - - `enable`: Experimental formatter is activated. + - `typstyle`: Use typstyle formatter. + - `typstfmt`: Use typstfmt formatter. - **Default**: `"disable"` diff --git a/editors/vscode/CHANGELOG.md b/editors/vscode/CHANGELOG.md index 362d28044..7148e0fab 100644 --- a/editors/vscode/CHANGELOG.md +++ b/editors/vscode/CHANGELOG.md @@ -4,6 +4,48 @@ 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.2 - [2024-03-30] + +### Editor + +* (Fix) Passed correct arguments to editor tools in https://github.com/Myriad-Dreamin/tinymist/pull/111 +* (Fix) exposed pin/unpin commands for vscode in https://github.com/Myriad-Dreamin/tinymist/pull/121 + +### Compiler + +* (Fix) Converting out of bounds offsets again in https://github.com/Myriad-Dreamin/tinymist/pull/115 +* Supported entry configuration in https://github.com/Myriad-Dreamin/tinymist/pull/122 +* Supported untitled url scheme for unsaved text buffer in https://github.com/Myriad-Dreamin/tinymist/pull/120 and https://github.com/Myriad-Dreamin/tinymist/pull/130 + +### Commands/Tools + +* Allowed tracing typst programs in subprocess in https://github.com/Myriad-Dreamin/tinymist/pull/112 + * This is part of backend for tracing tool, and we may finish a tracing tool in next week. + +### Formatting + +* Supported formatters in https://github.com/Myriad-Dreamin/tinymist/pull/113 + * Use `"formatterMode": "typstyle"` for `typstyle 0.11.7` + * Use `"formatterMode": "typstfmt"` for `typstfmt 0.2.9` +* feat: minimal diff algorithm for source formatting in https://github.com/Myriad-Dreamin/tinymist/pull/123 + +### Completion + +* Fixed wrong completion kind in https://github.com/Myriad-Dreamin/tinymist/pull/124 and https://github.com/Myriad-Dreamin/tinymist/pull/127 +* Supported import path completion in https://github.com/Myriad-Dreamin/tinymist/pull/134 +* Not completing on definition itself anymore in https://github.com/Myriad-Dreamin/tinymist/pull/135 + +### Syntax/Semantic Highlighting + +* (Fix) Corrected identifier/keyword boundaries in https://github.com/Myriad-Dreamin/tinymist/pull/128 +* Improved punctuation and keyword token kinds in https://github.com/Myriad-Dreamin/tinymist/pull/133 + +### Hover (Tooltip) + +* fix: parse docstring dedents correctly in https://github.com/Myriad-Dreamin/tinymist/pull/132 + +**Full Changelog**: https://github.com/Myriad-Dreamin/tinymist/compare/v0.11.1...v0.11.2 + ## v0.11.1 - [2024-03-26] ### Editor diff --git a/editors/vscode/Configuration.md b/editors/vscode/Configuration.md index 0bd71a59e..69ba1b9c1 100644 --- a/editors/vscode/Configuration.md +++ b/editors/vscode/Configuration.md @@ -72,12 +72,13 @@ Traces the communication between VS Code and the language server. - `verbose` - **Default**: `"off"` -## `tinymist.experimentalFormatterMode` +## `tinymist.formatterMode` -The extension can format Typst files using typstfmt (experimental). +The extension can format Typst files using typstfmt or typstyle. - **Type**: `string` - **Enum**: - `disable`: Formatter is not activated. - - `enable`: Experimental formatter is activated. + - `typstyle`: Use typstyle formatter. + - `typstfmt`: Use typstfmt formatter. - **Default**: `"disable"` diff --git a/editors/vscode/README.md b/editors/vscode/README.md index bd2e6bcb9..62730d1ee 100644 --- a/editors/vscode/README.md +++ b/editors/vscode/README.md @@ -15,8 +15,28 @@ See [Tinymist Features](https://github.com/Myriad-Dreamin/tinymist#features) for ### Initializing with a Template To initialize a Typst project: -- Use command `Typst Init Template` (tinymist.initTemplate) to initialize a new Typst project based on a template. -- Use command `Typst Show Template` (tinymist.showTemplateGallery) to show available Typst templates for picking up a template to initialize. +- Use command `Typst init template` (tinymist.initTemplate) to initialize a new Typst project based on a template. +- Use command `Typst show template` (tinymist.showTemplateGallery) to show available Typst templates for picking up a template to initialize. + +🎉 If your template contains only a single file, you can also insert the template content in place with command: +- Use command `Typst template in place` (tinymist.initTemplateInPlace) and input a template specifier for initialization. + +### Configuring LSP-enhanced formatters + +1. Open settings. +2. Search for "Tinymist Formatter" and modify the value. + - Use `"formatterMode": "typstyle"` for [typstyle](https://github.com/Enter-tainer/typstyle). + - Use `"formatterMode": "typstfmt"` for [typstfmt](https://github.com/astrale-sharp/typstfmt). + +Tips: to enable formatting on save, you should add extra settings for typst language: + +```json +{ + "[typst]": { + "editor.formatOnSave": true + } +} +``` ### Configuring path to search fonts @@ -74,7 +94,13 @@ You can pin a main file by command. ### Passing Extra CLI Arguments -There is a **global** configuration `tinymist.typstExtraArgs` to pass extra arguments to tinymist LSP, like what you usually do with `typst-cli` CLI. For example, you can set it to `["--input=awa=1", "--input=abaaba=2"]` to configure `sys.inputs`. +There is a **global** configuration `tinymist.typstExtraArgs` to pass extra arguments to tinymist LSP, like what you usually do with `typst-cli` CLI. For example, you can set it to `["--input=awa=1", "--input=abaaba=2", "main.typ"]` to configure `sys.inputs` and entry for compiler, which is equivalent to make LSP run like a `typst-cli` with such arguments: + +``` +typst watch --input=awa=1 --input=abaaba=2 main.typ +``` + +**Note:** Fix entry to `main.typ` may help multiple-file projects but you may loss diagnostics and autocompletions in unrelated files. Note: the arguments has quite low priority, and that may be overridden by other settings. diff --git a/editors/vscode/package.json b/editors/vscode/package.json index f40c5d0c0..537f996eb 100644 --- a/editors/vscode/package.json +++ b/editors/vscode/package.json @@ -1,6 +1,6 @@ { "name": "tinymist", - "version": "0.11.1", + "version": "0.11.2", "description": "An integrated language service for Typst", "categories": [ "Programming Languages", diff --git a/syntaxes/textmate/package.json b/syntaxes/textmate/package.json index 8aea3f65a..eb68799d0 100644 --- a/syntaxes/textmate/package.json +++ b/syntaxes/textmate/package.json @@ -1,6 +1,6 @@ { "name": "typst-textmate", - "version": "0.11.1", + "version": "0.11.2", "private": true, "scripts": { "compile": "npx tsc && node ./dist/main.js",