SublimeLinter: Highlights refactoring broke "highlight.ERROR/WARNING"

This refactoring of the highlight module broken the SublimeLinter-annotations linter. I was going to send a pull-request to the other repository but figured it’s better to report the issue here since the code is still under development (for version 4.0.0).

reloading plugin SublimeLinter-annotations.linter
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 109, in reload_plugin
    m = importlib.import_module(modulename)
  File "./python3.3/importlib/__init__.py", line 90, in import_module
  File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
  File "<frozen importlib._bootstrap>", line 1022, in load_module
  File "<frozen importlib._bootstrap>", line 1003, in load_module
  File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper
  File "<frozen importlib._bootstrap>", line 868, in _load_module
  File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
  File "/Users/root/Library/Application Support/Sublime Text 3/Packages/SublimeLinter-annotations/linter.py", line 15, in <module>
    from SublimeLinter.lint import highlight, Linter
ImportError: cannot import name highlight

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 26 (25 by maintainers)

Most upvoted comments

I think we should do

from SublimeLinter import Linter, ERROR, WARNING, STDOUT

Everything a normal plugin could use.

I don’t like const.py so I don’t necessarily want to expose that.

PROTECTED_REGIONS_KEY = "sublime_linter.protected_regions"
STATUS_KEY = "sublime_linter_status"
STATUS_BUSY_KEY = "sublime_linter_status_busy"

WARNING = "warning"
ERROR = "error"
WARN_ERR = (WARNING, ERROR)
INBUILT_ICONS = ("circle", "dot", "bookmark", "none")

Everything in there except ERROR, WARNING should go to the appropriate view modules. We don’t really share these consts. E.g. STATUS_KEY is private to our status_bar_view. INBUILT_ICONS is either private to highlights or style.py, don’t remember. WARN_ERR is basically unused.

highlight.ERROR/WARNING is now const.ERROR/WARNING, breaking:

  • SublimeLinter-contrib-golint
  • SublimeLinter-contrib-gometalinter
  • SublimeLinter-contrib-gosimple
  • SublimeLinter-contrib-mlint
  • SublimeLinter-contrib-mypy
  • SublimeLinter-contrib-protoc-gen-lint
  • SublimeLinter-contrib-pug-lint
  • SublimeLinter-contrib-write-good
  • SublimeLinter-foodcritic
  • SublimeLinter-jsdebugmarkers
  • SublimeLinter-annotations
  • SublimeLinter-phpmd
  • SublimeLinter-pydocstyle
  • SublimeLinter-rst (deprecated)