vmware-archive / atom-salt

Modified YAML package for Atom for SaltStack states
Other
19 stars 8 forks source link

Syntax hilighting problem with salt pillar.get and colons #5

Open twellspring opened 7 years ago

twellspring commented 7 years ago

Syntax highlighting has a problem with pillar.get lines with a colon in them. Any idea how to update this package to fix this? Atom 1.13.1 language-salt 0.4.0

{% set bind_address = salt'pillar.get' %} incorrect-hilighting

There is no problem if the colons are not there correct-highlighting

Current workaround is to add #' after these lines fix using pound single quote

iggy commented 7 years ago

Want to try this? It doesn't quite highlight inside the double brackets right, but to me it's an improvement. I'm still working on it (yes, this has annoyed me for ages as well).


index e94e9e5..6b932be 100644
--- a/grammars/yaml.cson
+++ b/grammars/yaml.cson
@@ -6,6 +6,16 @@
     'include': 'source.jinja'
   }
   {
+    'begin': '\{([%#])'
+    'end': '([%#])\}'
+    'name': 'jinja'
+    'patterns': [
+      {
+        'include': 'source.jinja'
+      }
+    ]
+  }
+  {
     'begin': '^(\\s*)(?:(-)|(?:(-\\s*)?(\\w+\\s*(:))))\\s*(\\||>)'
     'beginCaptures':
       '2':```
bennabiy commented 7 years ago

In my version, it does not have 'include': 'source.jinja' but

'patterns': [
  {
    'include': '#jinja-control'
  }
  {
    'include': '#jinja-value'
  }
  {
    'begin': '^(\\s*)(?:(-)|(?:(-\\s*)?(\\w+\\s*(:))))\\s*(\\||>)'
    'beginCaptures':
      '2':

Where would the patch go?

iggy commented 7 years ago

I just realized that my above patch was against a different fork of this: https://github.com/nevins-b/atom-salt