emmetio / sublime-text-plugin

The essential toolkit for web-developers
https://emmet.io
MIT License
250 stars 30 forks source link

[ST4] Error when using auto_mark: markup - TypeError: 'NoneType' object is not subscriptable #187

Open ohboylan opened 2 months ago

ohboylan commented 2 months ago

Recently noticed that I would occasionally get a python error when using the "auto_mark": "markup" option.

Forked and added a small fix to check that syntax_info exists: https://github.com/ohboylan/sublime-text-plugin/commit/af081e3f556a7ea502b15de04f9e75f525da521f

I've only tested briefly, but it seems to do the trick.

Full Traceback:

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python38/sublime_plugin.py", line 959, in on_modified
    run_view_callbacks('on_modified', view_id)
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python38/sublime_plugin.py", line 741, in run_view_callbacks
    callback(v, *args)
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python38/sublime_plugin.py", line 162, in profiler
    return event_handler(*args)
  File "~/Library/Application Support/Sublime Text/Installed Packages/Emmet.sublime-package/main.py", line 45, in wrapper
    fn(self, view)
  File "~/Library/Application Support/Sublime Text/Installed Packages/Emmet.sublime-package/main.py", line 464, in on_modified
    abbreviation.handle_change(editor, get_caret(editor))
  File "~/Library/Application Support/Sublime Text/Installed Packages/Emmet.sublime-package/lib/abbreviation.py", line 353, in handle_change
    if editor_last_pos is not None and editor_last_pos == pos - 1 and allow_tracking(editor, pos):
  File "~/Library/Application Support/Sublime Text/Installed Packages/Emmet.sublime-package/lib/abbreviation.py", line 504, in allow_tracking
    if is_enabled(editor, pos) and syntax.in_activation_scope(editor, pos):
  File "~/Library/Application Support/Sublime Text/Installed Packages/Emmet.sublime-package/lib/abbreviation.py", line 524, in is_enabled
    return syntax_info['type'] == auto_mark
TypeError: 'NoneType' object is not subscriptable
sergeche commented 2 months ago

Should be fixed in v.2.4.3