Home Download Buy Blog Forum Support

Best practices for linter: bg tasks and notifications

Best practices for linter: bg tasks and notifications

Postby miohtama3 on Fri Apr 27, 2012 1:53 pm

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
miohtama3
 
Posts: 33
Joined: Fri Apr 27, 2012 1:46 pm

Re: Best practices for linter: bg tasks and notifications

Postby kutu on Fri Apr 27, 2012 3:54 pm

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)
Code: Select all
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
kutu
 
Posts: 4
Joined: Sun Dec 11, 2011 9:04 pm

Re: Best practices for linter: bg tasks and notifications

Postby aparajita on Fri Apr 27, 2012 9:01 pm

miohtama3 wrote:* 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?


See popup_error_list() in SublimeLinter.py.
aparajita
 
Posts: 177
Joined: Sun Jul 24, 2011 10:42 pm

Re: Best practices for linter: bg tasks and notifications

Postby miohtama3 on Thu May 03, 2012 9:10 am

kutu wrote:1. i found non blocking threading realization in some plugin (dont remember what exactly), and realize it in my little plugin, maybe it help


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?
miohtama3
 
Posts: 33
Joined: Fri Apr 27, 2012 1:46 pm

Re: Best practices for linter: bg tasks and notifications

Postby senzo on Thu May 03, 2012 9:36 am

senzo
 
Posts: 106
Joined: Tue May 24, 2011 9:17 am


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 2 guests