Skip to content

Use jq syntax from atom jq support#4

Open
wader wants to merge 1 commit into
orentrutner:masterfrom
wader:use-syntax-from-atom-jq
Open

Use jq syntax from atom jq support#4
wader wants to merge 1 commit into
orentrutner:masterfrom
wader:use-syntax-from-atom-jq

Conversation

@wader

@wader wader commented Feb 28, 2021

Copy link
Copy Markdown

Difference to current syntax:
Supports string interpolation highlighting
Add foreach keyword
def name and function highlighting the same

Additional to atom syntax:
Better array/pattern support
Add //? operator

Was convert using:
cson2json < language-jq/grammars/jq.cson > jq.tmLanguage.json

Related PR to update CSON grammar wader/language-jq#5

@wader

wader commented Feb 28, 2021

Copy link
Copy Markdown
Author

Sorry if messed up something, i'm very new to vscode syntax highlighting and exensions

Comparison:
Screen Shot 2021-02-28 at 13 15 26
Screen Shot 2021-02-28 at 13 14 29

@wader

wader commented Feb 28, 2021

Copy link
Copy Markdown
Author

I noticed that there is something wrong with handling of .. as {$var}, looking into it.

@wader wader force-pushed the use-syntax-from-atom-jq branch 2 times, most recently from 4976046 to 711b58e Compare February 28, 2021 19:13
@wader

wader commented Feb 28, 2021

Copy link
Copy Markdown
Author

Think i've fixed it, added pattern "#variable" for object which allows .. as {$var} like in current syntax. In both the plain object literal {$var} is ok highlight-wise but not correct jq syntax. But maybe difficult to describe a syntax where {$var} is only allowed for as but not otherwise, have to have "pattern" and "object" i guess?

@wader

wader commented Mar 1, 2021

Copy link
Copy Markdown
Author

Also issue with array literals inside object literals {abc: [123, 123]} it seems, will look into it.

@wader wader force-pushed the use-syntax-from-atom-jq branch from 711b58e to d41469f Compare March 1, 2021 22:29
@wader

wader commented Mar 1, 2021

Copy link
Copy Markdown
Author

Think i've fixed issue with arrays inside objects

@orentrutner

Copy link
Copy Markdown
Owner

Hey wader, thank you for taking the time to improve this extension. I'd love to just accept this change as-is. I like that it adds support for string interpolation and the foreach keyword. I also appreciate the idea of consolidating the syntax with another project that is perhaps better maintained than this one.

But I'd like to hear your thoughts about these issues:
(1) The new syntax is quite longer than the one we had. It will take me some time to read and respond.
(2) The new syntax seems to just replace the old one as-is. It might be objectively superior to the old one on all fronts. But it's not obvious from the change if some capabilities were lost when the new ones were added.
(3) The github project that the syntax was copied from doesn't appear to have a LICENSE file. We can't just copy and reuse their content (https://opensource.stackexchange.com/questions/1720/what-can-i-assume-if-a-publicly-published-project-has-no-license). Unless I'm missing the presence of a license elsewhere there, or unless the author is willing to add a license file, we can't accept the copied content.

If we can't overcome the license barrier, maybe you or I can take a look at just adding the missing features to the current syntax.

Thanks!
-Oren

@wader

wader commented Mar 2, 2021

Copy link
Copy Markdown
Author

Hi,

  1. No worries the original CSON syntax can be found at https://github.com/bencampion/language-jq/blob/master/grammars/jq.cson
  2. Yes sorry for the messy diff :( as i commented above the CSON syntax had lot of nice things but i had to re-add some things, and i have a feeling i probably missed something. Have tried it with quite a lot of code and it seems ok.
  3. As i understand the CSON syntax is under MIT https://github.com/bencampion/language-jq/blob/master/package.json#L9 but maybe it should be made clearer somehow?

@wader

wader commented Mar 3, 2021

Copy link
Copy Markdown
Author

What do you think about the possibility to merge this repo and https://github.com/bencampion/language-jq somehow? not sure if it's easy to share a repo for a vscode and atom extension but would mean less work to sync syntax corrections between linguist, atom and vscode extensions.

Difference to current syntax:
Supports string interpolation highlighting
Add foreach keyword
def name and function highlighting the same

Additional to atom syntax:
Better array/pattern support
Add //? operator

Was convert using:
cson2json < language-jq/grammars/jq.cson > jq.tmLanguage.json

Related PR to update CSON grammar wader/language-jq#5
@wader wader force-pushed the use-syntax-from-atom-jq branch from d41469f to 78d1c81 Compare March 9, 2021 10:18
@wader

wader commented Mar 9, 2021

Copy link
Copy Markdown
Author

Hi, i've updated the syntax to use latest from https://github.com/wader/language-jq same grammar has now been merged into github linguist github-linguist/linguist#5233

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants