Giter Club home page Giter Club logo

jq-mode's People

Contributors

david-ongaro avatar epost avatar fuco1 avatar gvol avatar ljos avatar nagy avatar nverno avatar purcell avatar rickyson96 avatar sachac avatar syohex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jq-mode's Issues

indent doesn't work with nested if

indentation seems to be lost when there are 3 or more nested ifs

#!/usr/bin/env jq -Mf
if .x == null then
  if .y == null then
  if .z == null then
  .
else
  .
end
else
  .
end
else
  .
end

I'd like to see

#!/usr/bin/env jq -Mf
if .x == null then
  if .y == null then
    if .z == null then
      .
    else
      .
    end
  else
    .
  end
else
  .
end

Feature request: Incremental completion for jq-interactively

It would be great to be able to see the buffer narrowing as you type (and perhaps have tab-completion). Wrapping calls to jq in something like this would get you part of the way there, but you'd then need to reconstruct the original query:

.|with_entries(select(.key|match("^foo.*")))

*Of course, this breaks lists

lost indent level after blank line?

It seems a blank line resets the indent level.

#!/usr/bin/env jq -Mf
def x:
  # first comment

# second comment after blank line
.
;

I'd like to see

#!/usr/bin/env jq -Mf
def x:
  # first comment

  # second comment after blank line
.
;

Ability to have raw output with jq-interactively

I wanted to convert a bunch of log lines to a csv. jq-interactively worked amazingly well, but I ultimately wanted to be able to use the -r option to jq so that I would just print out the result instead of a json string with the result in it.

I was thinking you could use C-r or M-r or toggle raw output.

If you're not opposed to the idea, I might even try to throw together a PR.

retain indent level after top level comments inside of def

It seems the indent level is reset to 0 after the top level comments inside of def.

This is what I got

def func():
  # top level comment
{
 # inner comment
 {}
 }

The curly bracket should be aligned with the top level comment.

def func():
  # top level comment
  {
   # inner comment
   {}
   }

The indent after the inner comments work as I expected.

Feature request: header argument for --slurpfile

As far as I can see, it's not currently possible to get input from more than one file in a jq block.

I propose adding a new header argument, which can appear more than once, to allow for several files to be read into variables. Something like this:

#+header: :slurpfile file1=file1.json :slurpfile file2=file2.json

csv output isn't formatted as a table

When the jq block ends with @csv, somehow the results aren't converted into a table in org-mode, but returned as quoted and comma-separated strings. Adding :results table doesn't help. Is this just me?

Using: Emacs 29.1 on Windows, org 9.6.10, jq-mode-20230823.1003.

Option to push the values entered in the jq-interactive minibuffer into the kill-ring?

Great package, thanks!

I was searching for a way to get at the value of the jq expression I last typed in...

I ended up binding a key in json-mode to do this

(kill-new (car minibuffer-history))

and that more or less does what I want, but I have to press that key after finishing jq-interactively. Perhaps it would be useful to add an option to jq-mode that would cause the last interactive jq expression to be pushed to the kill-ring automatically.

Enhancement: support yaml using yq

Hi,

What do you think about adding yaml support using https://github.com/kislyuk/yq ? Since it's a wrapper around jq it uses the same filter language, so it wouldn't take a lot of work to support in your project.

I deal with yaml all day long as an SRE in Kubernetes land, so it would be excellent to have a yq babel source block and a yq-interactively function.

*Note: there are unfortunately two different projects named yq, don't mix them up. The other one (written in go) doesn't use jq and has significant breakage between major versions... I think it would be a much bigger headache to integrate with.

Make font-locking of json work when using jq-interactively

See code from 305ead8#L168 and onwards.

We are trying to use the same buffer as the json file that we are editing, but we don't want to change the content of the file before the user commits. We use an overlay to hide the original text and show the edited text. The problem is that we don't get font-locking for the edited text. It would be nice if this was possible.

Bad indentation of objects

Hi, thanks for this package!

I noticed that indentation rules sometimes don't behave well. One case I noticed today is object literals:

{
"foo":1,
"bar":2,
"baz":3
}

Currently, this gets formatted as:

{
  "foo":1,
	 "bar":2,
		"baz":3
}

which isn't very useful.

Indented JSON

Hi,

Thanks very much for a great mode, I was using jq from the command line and this is much better! One small question though: when I use jq-interactively on a indented buffer, the output buffer appears to be un-indented. Is there some option I can set for the output to become indented?

Thanks for your time.

Marco

nested def resets the indent level

It seems the nested def resets the indent level

#!/usr/bin/env jq -Mf
def x:
  def y:
  {
   "abc": 123
  };
. |= y     # this line lost the indent level
;

I'd like to see

#!/usr/bin/env jq -Mf
def x:
  def y:
  {
   "abc": 123
  };
  . |= y
;

MELPA link in README

Hi!

Great work! I was really pleased to find this package on MELPA. Can you add a add a comment to the README to show that this is available from the MELPA repository? Maybe add one of the badges they provide to the "Getting Started" section.

Ability to scroll the buffer during jq-interactively?

Seems like the overlay prevents any scrolling... is there something I'm missing? Sometimes the thing I want to drill down on is both off screen and out of (my) memory and I need to go look, preferably without cancelling out the interactive session.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.