facelessuser / ApplySyntax

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

AttributeError: 'NoneType' object has no attribute 'rfind' #137

Closed clarkewd closed 4 years ago

clarkewd commented 4 years ago

I'm getting an error with ApplySyntax. I don't think it's conflicting with anything since this is with a fresh install. I've only added the SSH Config (syntax highlighting) package and the ApplySyntax, both installed via Package Manager.

In the ApplySyntax user config file I added this to the syntaxes section:

    {
        "name": "SSH Config/SSH Config",
        "rules": [
            {"file_path": ".*?ssh\/config"}
        ]
    },

In the config file I also have reraise_exceptions and debug both set to true.

When I open an SSH config file that matches the path ( eg: ~/.ssh/config ) I get this error:

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/me/Library/Application Support/Sublime Text 3/Installed Packages/ApplySyntax.sublime-package/ApplySyntax.py", line 348, in on_load
    self.detect_syntax(view)
  File "/Users/me/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/me/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'

I really love this plugin so I hope there will be an easy fix. Thank you!

facelessuser commented 4 years ago

For a long time, the name attribute has been deprecated and has posted warnings mentioning that syntax should be used. Documentation says to use syntax as well: http://facelessuser.github.io/ApplySyntax/usage/#syntax.

I finally removed legacy support which is why your rule is failing.

Please use:

    {
        "syntax": "SSH Config/SSH Config",
        "rules": [
            {"file_path": ".*?ssh\/config"}
        ]
    },

You can use the default rules as a references as well.

@gir-bot lgtm @gir-bot add T: support

clarkewd commented 4 years ago

Ah, yes! Thank you!