AntonShuvaev / elasticsearch4idea

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

Requests should be source code #109

Closed lookingcloudy closed 1 year ago

lookingcloudy commented 1 year ago

Is your feature request related to a problem?

Just in trial mode - after a couple hours I generally like what you have.

My first problem is that saved requests don't work quite right. The location should be able to be changed so that they can be included in source control (current git project). I'm copying queries/requests to/from my source project to your console, which is irritating and not efficient.

My second problem is that the saved request does not behave like a "file" as expected. For example, when opening a request I would expect it to work like a source code file, where I can add additional requests, comments, or data that is saved with the request. However, that additional data is simply lost and not saved when the request is closed. Your tool seems to be patterned after data grip, which is a good idea. The request should behave as a SQL script file in data grip that can be attached to different connections and include any additional data or requests.

Describe the solution you'd like

A saved request or query should be a simple file on the file system, with the location user configurable. That way the file can be automatically tracked in source control and contain additional requests/queries/comments/data - similar to a .sql file in data grip. If you want to be fancy, recognize the "GO" keyword as a separator between requests so the file can be automatically run.

Additional context

As a bonus, support parameterized queries/requests just like data grip does with SQL statements.

AntonShuvaev commented 1 year ago

You already can save requests to files. Just create a new file with .es extension and save it to any location you want. Also, you can create a new file from the context menu New -> Elasticsearch or New Scratch File -> Elasticsearch. This file is actually a plain text file, so it can be tracked by any version control system.

lookingcloudy commented 1 year ago

Ok - thanks. It isn't obvious what the intended value for the read-only saved requests and queries are.