dakrone / es-mode

An Emacs major mode for interacting with Elasticsearch
GNU General Public License v3.0
195 stars 34 forks source link

Support comments #51

Closed drewr closed 7 years ago

drewr commented 7 years ago

Here at Elastic HQ we have some training material that has a bunch of requests in one file with comments scattered about. It mainly causes a problem with determining the end of a request's payload which currently es-mode does by looking for the next request verb or the end of a JSON doc. We should also stop on leading #. Maybe even get fancy and support # in other places, but that would require some parsing of the payload etc.

Example:

# comment 1
GET /foo/_search    <======= C-c C-c here

# comment 2
GET /bar/_search
{
  "query": {
    "match": {
      "f": 1
    }
  }
}

This fails because es-mode can't determine where the body for GET /foo/_search ends. This works though:

# comment 1
GET /foo/_search    <======= C-c C-c here
{}

# comment 2
...
dakrone commented 7 years ago

es-mode does already support comments, it just uses the javascript-like // as the comment character.

There's an issue open to change it to # to match Kibana's behavior: https://github.com/dakrone/es-mode/issues/40

drewr commented 7 years ago

Whoops, missed that. We don't need this one then!