11 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
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
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
ppodjames
824dcfe765 Update syntax/jsonnet.vim (#12)
Add missing std lib functions.
2018-10-08 20:39:25 +01:00
Gustaf Lindstedt
007ee85746 Update stdlib highlighting and add folding of objects (#9) 2018-04-10 22:42:10 -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
Dave Cunningham
5d59d0ba6a Add '' strings 2016-01-21 21:15:50 -05: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