Sublime Forum

Best practices for linter: bg tasks and notifications

#1

Hi,

I’d like to develop a linting plug-in for Sublime (please see this post https://github.com/Kronuz/SublimeLinter/issues/145)

As I am new to Sublime Text development I was hoping to find answers for

  • What is the best practice to run background tasks which do not block UI (I have found this example https://github.com/Kronuz/SublimeLinter/blob/master/SublimeLinter.py#L411)

  • Is it possible to insert markers in the scroll preview or scrollbar to mark the warnings?

  • Are there any way of having pop-up notification style messages as statusbar is suboptimal and crowded for giving out this kind of information? How about opening a dialog window containing a quick list where you can jump around in the warnings?

Cheers,
Mikko

0 Likes

#2
  1. i found non blocking threading realization in some plugin (dont remember what exactly), and realize it in my little plugin, maybe it help
  2. don’t know what you exactly mean, but maybe you mean something like break point in line numbers column (gutter), you find example in Packages/Default/mark.py
  3. statusbar or open dialog (sublime.message_dialog, sublime.ok_cancel_dialog) or open panel with text (see below), maybe i’m wrong but you cant do click’and’go from panel (or you can try, i see some click’and’go action from code in SublimeRope plugin for ‘Go To Definition’ function)

v = self.window.get_output_panel("test") self.window.run_command("show_panel", dict(panel="output.test")) e = v.begin_edit() v.insert(e, 0, "test") v.end_edit(e)

hope it help

sry for my bad english

0 Likes

#3

See popup_error_list() in SublimeLinter.py.

0 Likes

#4

[quote=“kutu”]1. i found non blocking threading realization in some plugin (dont remember what exactly), and realize it in my little plugin, maybe it help
[/quote]

What are the threading rules of the underlying (which?) UI framework? Am I allowed to call UI code from all threads or do I need to signal the async result of the worker thread to main UI somehow?

0 Likes

#5

More info on threading:
http://net.tutsplus.com/tutorials/python-tutorials/how-to-create-a-sublime-text-2-plugin/

0 Likes