24 Commits

Author SHA1 Message Date
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