mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-13 12:50:33 +01:00
[PR #128] [MERGED] Custom JSON formatter that works with template syntax #63
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/mountain-loop/yaak/pull/128
Author: @gschier
Created: 10/22/2024
Status: ✅ Merged
Merged: 10/22/2024
Merged by: @gschier
Base:
master← Head:custom-json-formatter📝 Commits (1)
9b40d1eCustom JSON formatter that works with template syntax📊 Changes
17 files changed (+414 additions, -117 deletions)
View changed files
📝
package-lock.json(+44 -44)📝
package.json(+1 -1)📝
src-tauri/Cargo.lock(+66 -33)📝
src-tauri/Cargo.toml(+5 -5)📝
src-tauri/gen/schemas/desktop-schema.json(+1 -1)📝
src-tauri/gen/schemas/macOS-schema.json(+1 -1)📝
src-tauri/src/lib.rs(+11 -4)➕
src-tauri/yaak_templates/src/format.rs(+230 -0)📝
src-tauri/yaak_templates/src/lib.rs(+1 -0)📝
src-web/components/core/Editor/Editor.tsx(+3 -3)📝
src-web/components/responseViewers/EventStreamViewer.tsx(+9 -6)📝
src-web/components/responseViewers/HTMLOrTextViewer.tsx(+1 -1)📝
src-web/components/responseViewers/TextViewer.tsx(+7 -8)➕
src-web/hooks/useFormatText.ts(+28 -0)📝
src-web/hooks/useSyncWorkspaceChildModels.ts(+1 -0)📝
src-web/lib/formatters.ts(+4 -10)📝
src-web/lib/tauri.ts(+1 -0)📄 Description
Before, the JSON formatter would simply do
JSON.stringify(JSON.parse(text, null, 2)). However, that meant it could only parse valid JSON, and would do things like round floats when they contained trailing zeros like1.000.This new formatter is implemented in Rust and is implemented as a simple string iterator. This means:
${[ ...]}1.000instead of rounding to1Summary by CodeRabbit
Release Notes
New Features
FormattedEditorcomponent for improved text formatting in event streams.useFormatText, for handling text formatting based on language.Improvements
Editorcomponent to support asynchronous formatting operations.Bug Fixes
Chores
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.