cylc / Cylc.tmbundle

TextMate bundle for the Cylc language (for TextMate, PyCharm, WebStorm, Sublime)
BSD 3-Clause "New" or "Revised" License
1 stars 2 forks source link

tmLanguage file doesn't work with Sublime Text 4 #10

Open aulemahal opened 10 months ago

aulemahal commented 10 months ago

Description

Hi! It seems the tmLanguage file is not compatible with Sublime Text. At least, not with the version 4, the latest build (4152).

Following the instructions to install the package doesn't do anything, the Cylc syntax doesn't get added to the list.

Reproducible Example

I dug deeper and opened the Cylc.tmLanguage file. In Sublime, I did Tools > Developers > New syntax from Cylc.tmLanguage. This is supposed to convert the file to a sublime-syntax file.

In Sublime's console I got:

patterns and includes are not supported within captures: {'0': {'patterns': [{'include': '#headers'}]}}
patterns and includes are not supported within captures: {'1': {'patterns': [{'include': '#jinja2'}, {'match': '[\\w\\+\\^\\$][\\w\\+\\-\\^\\$\\/\\t ,:]*', 'name': 'keyword.graph.cylc'}]}, '2': {'name': 'keyword.operator.assignment.cylc'}}
patterns and includes are not supported within captures: {'0': {'patterns': [{'include': '#graphSyntax'}]}}
Traceback (most recent call last):
  File "/opt/sublime_text/Lib/python38/sublime_plugin.py", line 1659, in run_
    return self.run()
  File "/opt/sublime_text/Packages/Default.sublime-package/convert_syntax.py", line 433, in run
  File "/opt/sublime_text/Packages/Default.sublime-package/convert_syntax.py", line 358, in convert
  File "/opt/sublime_text/Packages/Default.sublime-package/convert_syntax.py", line 269, in make_context
  File "/opt/sublime_text/Packages/Default.sublime-package/convert_syntax.py", line 328, in make_context
Exception: unknown pattern type: dict_keys(['name', 'patterns'])

Maybe the latest Sublime has gone incompatible ? Or maybe that the tmLanguage has changed in ways incompatible with Sublime's implementation ?

It's not a major problem. If the solution isn't easy, it could at least be helpful to indicate on the README that some versions of Sublime are not supported.

I am running Sublime on a Fedora 38 Linux machine.

oliver-sanders commented 5 months ago

Apologies for not spotting this issue sooner.

Unfortunately, none of us have access to Sublime Text at present. The underlying TextMate grammar has not changed in a year (https://github.com/cylc/Cylc.tmbundle/commit/9b43c77297e23f61c2c1d20639a3b922a188d9cd) so this is probably due to changes in Sublime rather than changes in the TextMate grammar which we also use in other text editors. There are a few mentions of syntax highlighting improvements in the v4 changelog, but no mention of compatibility breaking changes.

The issue appears similar to this unanswered question: https://forum.sublimetext.com/t/convert-syntax-py-exception-unknown-pattern-type/15076

I'm not sure what to make of that error unfortunately (it's coming from within the Sublime Python code). We're trying to use this grammar in a new context at the moment which means passing it through another validator, will see if it flags anything.