facelessuser / ApplySyntax

Syntax detector for Sublime Text
https://facelessuser.github.io/ApplySyntax/
343 stars 48 forks source link

It looks like this got broken with a Sublime update #138

Closed davidkrider closed 4 years ago

davidkrider commented 4 years ago

I was using this plugin to force Rails HAML files to use the TextMate HAML syntax format instead of the built-in Rails one. It broke for me a couple months ago, and I've been trying another editor, but today I thought I'd open the console, and this is the traceback I got:

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 478, in run_callback
    expr()
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 517, in <lambda>
    run_callback('on_load', callback, lambda: callback.on_load(v))
  File "/Users/davidkrider/Library/Application Support/Sublime Text 3/Installed Packages/ApplySyntax.sublime-package/ApplySyntax.py", line 348, in on_load
    self.detect_syntax(view)
  File "/Users/davidkrider/Library/Application Support/Sublime Text 3/Installed Packages/ApplySyntax.sublime-package/ApplySyntax.py", line 382, in detect_syntax
    self.set_syntax(syntax.get("syntax"))
  File "/Users/davidkrider/Library/Application Support/Sublime Text 3/Installed Packages/ApplySyntax.sublime-package/ApplySyntax.py", line 448, in set_syntax
    path = os.path.dirname(n)
  File "./python3.3/posixpath.py", line 151, in dirname
AttributeError: 'NoneType' object has no attribute 'rfind'
facelessuser commented 4 years ago

Can you run the "Support Info" command from the Preferences/ Package Settings/ApplySyntax menu?

I believe this issue is already fixed.

davidkrider commented 4 years ago
facelessuser commented 4 years ago

Ugh, okay we somehow have another case of this. I'll probably have a fix for it sometime today. I'll track it down.

facelessuser commented 4 years ago

@girbot add T: bug, S: confirmed @girbot remove S: triage

facelessuser commented 4 years ago

@gir-bot add T: bug, S: confirmed @gir-bot remove S: triage

Whoops, have to call the right name...

facelessuser commented 4 years ago

3.0.1 will fix your issue once it's available in package control.

davidkrider commented 4 years ago

I've updated now. Thanks for fixing the bug. The new "feature" in ST3 for "Open all with current extension as..." absolutely will not work to select a different HAML syntax file over the default, which is why I'm trying this. I thought this plugin forced it. I can't find the spot where I got the original snippet to make sure that my config is correct. Here's what I have. Does it look right?

 "syntaxes":
    [
        {
            "extensions":
            [
                "haml"
            ],
            "name": "Haml/Syntaxes/Ruby Haml",
            "rules":
            [
                {
                    "file_name": ".*\\.haml$"
                }
            ]
        }
    ]
facelessuser commented 4 years ago

Did you mean to use file_path: http://facelessuser.github.io/ApplySyntax/usage/#file-path-rule?

On a side note, please open a new issue for separate problems.