sanity-io / vscode-sanity

Visual Studio Code extension for developing applications powered by Sanity.io
MIT License
51 stars 9 forks source link

feat: add pretty formatting for groq queries [WIP] #26

Open runeb opened 3 months ago

runeb commented 3 months ago

Uses wasm for groq formatting, inspired by groq.app by @juice49 . Currently only works for inlined queries, not standalone files.

Modified lens provider to calculate a range for the query instead of just a start position, so that replacement is easier. There is currently a bug where the range is not recalculated after edits are made or formatter has replaced the query. Most easily reproduced by replacing a query multiple times.

runeb commented 3 months ago

Feature requested in #8

socket-security[bot] commented 3 months ago

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@groqfmt/wasm@1.2.2 None 0 3.8 MB ash

View full report↗︎

runeb commented 3 months ago

Ideally we move the new dependency into the org before publishing this and not rely on @groqfmt/wasm