Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aulemahal opened this issue Nov 16, 2023 · 1 comment
Open

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

aulemahal opened this issue Nov 16, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@aulemahal
Copy link

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.

@aulemahal aulemahal added the bug Something isn't working label Nov 16, 2023
@oliver-sanders
Copy link
Member

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 (9b43c77) 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants