surrealdb / surrealist

Surrealist is the ultimate way to visually manage your SurrealDB database
https://surrealist.app/
MIT License
1.04k stars 74 forks source link

`Format Query` removes the commented queries #222

Closed AyushChothe closed 3 months ago

AyushChothe commented 3 months ago

Describe the bug Format Query removes the commented queries

To Reproduce Steps to reproduce the behavior:

  1. Write a query
  2. Comment it
  3. Write another query
  4. Press Format Query

Expected behavior Format Query should not remove commented queries

Environment:

Surrealist: Version 2.0.2 (20240424.110210)
macjuul commented 3 months ago

This is an unfortunate limitation of how the formatter works, as we parse the queries into surrealdb and use the built-in formatter as result.

I have changed the formatter so when a selection is active, only the highlighted text will be processed. This means you can format individual queries without losing all your comments