33 Commits

Author SHA1 Message Date
Cam Hutchison
4ebc6619dd
syntax: Update syntax elements for jsonnet v0.19.1 (#33)
Update the standard library names and add the `importbin` statement to
update the syntax highlighting to jsonnet v0.19.1.

The standard library names have been automatically generated with the
following command:

    PROG='std.lines(["syn match Constant \"std.%s\"" % fn for fn in std.objectFieldsAll(std) if fn[0] >= "a" && fn[0] <= "z"])''
    go run github.com/google/go-jsonnet/cmd/jsonnet@v0.19.1 --string - <<<"${PROG}"

This should make it easier to keep up-to-date with additions to the
standard library, as it was missing some rather old additions. Seems to
have been rather adhoc.

As part of this automation, the builtins and `std.jsonnet` have been
combined as there is no way to determine which names are builtin and
which come from `std.jsonnet`. Manually maintaining the distinction is
pointless busywork, and that fell behind anyway as a bunch of
`std.jsonnet` functions have been migrated to builtins for performance
reasons.

The automation script lists the names in the `std` object, ignoring all
names that do not start with a lower-case letter. This removes some
internal names that should not be added to the syntax highlighting.

The `importbin` statement was manually added.
2023-02-20 14:34:00 +00:00
Jeroen Op 't Eynde
c2a3e8ca00
fix: maintain view/folds when formatting on save (#31) 2023-02-20 14:33:42 +00:00
Jeroen Op 't Eynde
6ac3486c47
refactor: Reduce complexity of jsonnet#Eval (#32) 2023-02-20 14:33:14 +00:00
Luke Bond
f27e1d67df
docs: added instructions for neovim w/ no package manager (#21) 2022-10-25 14:15:08 +01:00
Andrea Scarpino
ca93789140
Add more functions (#23)
* Add more functions

* Add splitLimitR
2022-10-25 13:51:48 +01:00
John Carlyle-Clarke
108fb6fff4
Add spell check markers to comments (#27) 2022-10-25 13:51:27 +01:00
Jeroen Op 't Eynde
d07c3c9cca
feat: format visual selections (#26)
* feat: format visual selections

* cleanup

* add eval function

* ingore doc/tags

* fold () and =;
2022-10-25 13:51:12 +01:00
Trevor Stone
aa1fcdeaff
Fix documentation typo: s/fotmat/format/ (#28) 2022-10-25 13:47:22 +01:00
IK
f3b4ae76ee
Add dein section in README.md (#20) 2022-10-24 20:08:47 +01:00
IK
650d5cabbb
add check Duplicate (#19) 2022-10-24 20:07:52 +01:00
Mike Lang
b7459b36e5 Tighten definition of multiline strings (#16)
so that a `|||` in the middle of a multiline string does not end the string
according to the syntax highlighter unless it actually ends it
according to the language.

From the jsonnet spec:

> Text block, beginning with `|||`, followed by optional
  whitespace and a new-line. The next non-blank line must be prefixed
  with some non-zero length whitespace *W*. The block ends at the first
  subsequent line that does not begin with *W*, and it is an error if this
  line does not contain some optional whitespace followed by `|||`.

Prior to this change, the syntax highlighter looked for any sequence `|||`
as the end-of-string marker. This causes problems in multiline strings that
contain this sequence (this mostly comes up when providing example usage).

Example:

```
{
  help: |||
    To use this foo, you should specify a description like so:
      {
        description: |||
          Your description here.
        |||,
      }
  |||,
  ...
}
```

In this example, the line `Your description here.` would be considered outside
any string, with the part before it and the part after it being considered
two distinct strings.

We make the syntax highlighter use the same rules as the spec by making the
start pattern match `|||` followed by any amount of whitespace, then any number
of newlines (blank lines), then an amount of whitespace (*W* in the spec).

It uses the `\z( \)` construct to make this a subgroup accessible to the end pattern.

The end pattern uses lookaround to say that the start of the line must not match
the *W* from the start token, while still being any amount of whitespace then `|||`.
2019-07-29 12:31:24 -04:00
Kris Hicks
b4d56c9024 Update JsonnetFmt for jsonnet v0.13.0 (#15)
In jsonnet v0.13.0 `jsonnet fmt` was split out into its own executable,
`jsonnetfmt`.  See [google/jsonnet](https://github.com/google/jsonnet/releases/tag/v0.13.0)
for more.
2019-06-18 22:43:07 +01:00
ppodjames
824dcfe765 Update syntax/jsonnet.vim (#12)
Add missing std lib functions.
2018-10-08 20:39:25 +01:00
Luke Jolly
1425166887 Remove indentation setting that overrides jsonnet defaults (#10) 2018-04-10 22:44:05 -04:00
Gustaf Lindstedt
007ee85746 Update stdlib highlighting and add folding of objects (#9) 2018-04-10 22:42:10 -04:00
Trevor Hartman
9838a60394 Add commentstring (#8) 2018-04-10 22:41:24 -04:00
ppodjames
2637e27371 Update jsonnet.vim (#7)
* Update jsonnet.vim

Add missing standard libraries to syntax highlighting.

Add special syntax highlighting to python style string formatting inside of strings.

* Update jsonnet.vim
2017-04-06 12:19:50 -04:00
Michael Hackner
bea5d6a935 Fix typo in README (#6) 2017-04-05 23:56:12 -07:00
Dave Cunningham
ff255a3ac4 Merge pull request #5 from ahakanbaba/master
Fix a E121: Undefined variable:  error
2016-12-16 05:23:19 -05:00
Hakan Baba
1e2f99cab4 Fix a E121: Undefined variable: error
If the exists('*exepath') evaluates to false vim was returning this
error:
Error detected while processing function
<SNR>10_fmtAutosave..jsonnet#Format..jsonnet#CheckBinPath:
line    6:
E121: Undefined variable: binPath
2016-12-14 15:47:37 -08:00
Dave Cunningham
bf1997a560 Merge pull request #4 from ahakanbaba/jsonnetFmtAtSave
Added automatic jsonnet execution at save time.
2016-10-11 11:53:57 -04:00
Hakan Baba
5c07e8e8fa Added automatic jsonned execution at save time.
Added documentation, a vim command, a user callable function and an
autocommand that gets executed at every save.

The defaults are hight configurable with options that are also
documented in this change.
2016-10-07 23:14:11 -07:00
Dave Cunningham
fb99d65bb4 Merge pull request #1 from benley/master
Add syntastic integration
2016-10-01 13:31:49 -04:00
Dave Cunningham
9cde81ff3f Add .gitignore 2016-05-10 13:26:30 -04:00
Dave Cunningham
5d44943e4b Add libsonnet extension 2016-05-10 13:26:12 -04:00
Benjamin Staffin
54c5881773 Add syntastic integration 2016-04-18 20:19:25 -07:00
Dave Cunningham
5d59d0ba6a Add '' strings 2016-01-21 21:15:50 -05:00
David Z. Chen
163da2e3ce Update README with new Jsonnet website URL. 2015-12-17 14:02:43 -08:00
David Z. Chen
f81ca790e7 Add More Info links to README. 2015-09-30 17:52:32 -07:00
David Z. Chen
d56f12d915 Fix screenshot link. 2015-09-30 17:44:02 -07:00
David Z. Chen
c49b26a33f Add screenshot. 2015-09-30 17:43:16 -07:00
David Z. Chen
cc2927a243 Write README and add ftdetect. 2015-09-30 17:38:01 -07:00
David Z. Chen
5e40b8957f Initial import. 2015-09-30 17:23:57 -07:00