surrealdb / surrealist

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

Bug: Format Query action removes commented queries #436

Open teddy-otieno opened 1 month ago

teddy-otieno commented 1 month ago

Describe the bug

Format Query action removes commented queries Before image

After image

Steps to reproduce

Steps

  1. Write two queries
  2. Comment out the first query
  3. Format the query

Expected behaviour

I expect the comments to be preserved

Surrealist Environment

Version: 3.0.0-beta.2 Flags: feature_flags: false, query_view: true, explorer_view: true, graphql_view: true, designer_view: true, auth_view: true, functions_view: true, models_view: true, apidocs_view: true, cloud_view: true, themes: true, newsfeed: true, database_version_check: false, highlight_tool: false, legacy_serve: false, cloud_endpoints: production, cloud_access: false, cloud_killswitch: true, changelog: hidden

Contact Details

tedd.juma@outlook.com

Is there an existing issue for this?

Code of Conduct

macjuul commented 1 month ago

This is currently expected behaviour since we use the internal SurrealDB parser for formatting queries which strips out any encountered comments. We are planning on expanding editor functionality with a custom language server and eventually create a formatter which doesn't strip comments.

For now, a workaround is to select only the part of the editor that you want to format, as formatting will be limited to an active selection when present