AntonShuvaev / elasticsearch4idea

Elasticsearch Plugin for JetBrains IDEs
https://plugins.jetbrains.com/plugin/14512-elasticsearch
59 stars 8 forks source link

Add Support for Inline Comments in JSON Queries within Elasticsearch Plugin #143

Closed getsolaris closed 6 months ago

getsolaris commented 7 months ago

Is your feature request related to a problem?

Yes, my feature request is related to an existing problem. While using the Elasticsearch query plugin, I've noticed that it's not possible to add comments directly within the JSON queries. This limitation makes it challenging to document the purpose or logic behind specific sections of a query, especially when sharing these queries with team members or revisiting them after some time. The inability to annotate directly impacts the ease of collaboration and maintainability of query scripts.

Describe the solution you'd like

I would like to propose the addition of a feature that enables users to insert comments directly into their JSON-based Elasticsearch queries within the plugin interface. This enhancement would ideally support both single-line (// comment) and multi-line (/* comment */) comment styles, similar to standard JSON with comments (JSONC) support in various code editors.

By introducing comment functionality, users can annotate their queries for better documentation, explanation of complex logic, or even temporarily disable certain parts of a query during testing and development. This feature would significantly improve the usability and readability of Elasticsearch queries, facilitating better collaboration and understanding among developers and teams working on search-related projects.

Additional context

Improved Documentation: Comments allow for inline documentation of queries, making it easier to understand the purpose and functionality of various parts of a query at a glance. This is particularly useful in complex queries where the rationale behind certain conditions or filters might not be immediately apparent.

Enhanced Debugging and Testing: Comments can be used to temporarily disable parts of a query without deleting them, making it easier to isolate and identify issues or to test the impact of certain conditions.

Historical Context: Comments can provide historical context, such as why a particular approach was chosen or why certain conditions are necessary. This can be invaluable for future reference and for new team members trying to understand existing queries.

AntonShuvaev commented 7 months ago

Thank you for the suggestion! I'll implement this feature. For now, you can use comments between separate requests as a workaround.

getsolaris commented 7 months ago

Thank you !

How can I use it ?

AntonShuvaev commented 7 months ago

Image

getsolaris commented 7 months ago

Oh, this is it. I'll be waiting for the release of my proposed features.

I'm always using it well. Thank you.