Home Download Buy Blog Forum Support

Highlight code remarks

Highlight code remarks

Postby theblacklion on Sun Feb 27, 2011 7:13 pm

Hi folks,

I've written a plugin which highlights special keywords like TODO, FIXME, WARNING etc. to visually support me at my work. It's also possible to write a simple todo list with these (I'm actually planning to write some keyboard shortcuts, language file etc. like the todo plugin for TM has).
Please see the file header for additional installation informations.

Grab the code here:
https://bitbucket.org/theblacklion/subl ... remarks.py

Hope you find it useful :),
Oktay.
theblacklion
 
Posts: 67
Joined: Sat Feb 05, 2011 10:07 pm
Location: Hannover, Germany

Re: Highlight code remarks

Postby jbrooksuk on Mon Feb 28, 2011 10:35 am

Sweet! I've been wanting to get one of these on the go for a while!

It would be good if the highlighting only occurred if there was a colon after the word, since I tend to type comments in capitals, this highlights it regardless.
jbrooksuk
 
Posts: 772
Joined: Sun Apr 11, 2010 10:37 am
Location: England

Re: Highlight code remarks

Postby theblacklion on Mon Feb 28, 2011 11:03 pm

jbrooksuk wrote:Sweet! I've been wanting to get one of these on the go for a while!


Yeah - me too :).
Do you know http://orgmode.org/ ? I'm currently wondering if I should try a shot...

It would be good if the highlighting only occurred if there was a colon after the word, since I tend to type comments in capitals, this highlights it regardless.


I'm continuously thinking about improving this plugin. It would be nice if you could give me some examples on how you would like it to behave. I'll try to make it more flexible to support your use case.
As for me I wanted to highlight just those capitalized words. But I could try to provide different regex patterns for starters and make it configurable.
theblacklion
 
Posts: 67
Joined: Sat Feb 05, 2011 10:07 pm
Location: Hannover, Germany

Re: Highlight code remarks

Postby jbrooksuk on Tue Mar 01, 2011 8:57 am

theblacklion wrote:Do you know http://orgmode.org/ ? I'm currently wondering if I should try a shot...

That could be fun! "Headers" at the beginning of a file...
theblacklion wrote:I'm continuously thinking about improving this plugin. It would be nice if you could give me some examples on how you would like it to behave. I'll try to make it more flexible to support your use case.
As for me I wanted to highlight just those capitalized words. But I could try to provide different regex patterns for starters and make it configurable.


Sure;
Code: Select all
DONE:

Code: Select all
DONE: Blah blah blah because I'm awesome

But then an option not to highlight if there is a colon, so:
Code: Select all
DONE

Would not highlight :)
jbrooksuk
 
Posts: 772
Joined: Sun Apr 11, 2010 10:37 am
Location: England

Re: Highlight code remarks

Postby theblacklion on Fri Mar 04, 2011 9:41 pm

I've updated the plugin. New are:
* Several states are now grouped within "queues".
* You can switch between states via key binding.
theblacklion
 
Posts: 67
Joined: Sat Feb 05, 2011 10:07 pm
Location: Hannover, Germany

Re: Highlight code remarks

Postby theblacklion on Fri Mar 04, 2011 9:43 pm

jbrooksuk wrote:Sure;
Code: Select all
DONE:

Code: Select all
DONE: Blah blah blah because I'm awesome

But then an option not to highlight if there is a colon, so:
Code: Select all
DONE

Would not highlight :)


Hmm.. plz take a look at the new code. Where could we change the regex to match your requirement? On a per "queue" level?
theblacklion
 
Posts: 67
Joined: Sat Feb 05, 2011 10:07 pm
Location: Hannover, Germany

Re: Highlight code remarks

Postby EarMaster on Fri Jul 06, 2012 8:16 am

I'm unsure how to install this plugin. I copied the .py file into my User directory (on Windows %AppData%\Sublime Text 2\Packages\User) where it was automatically compiled to an .pyc file. I also added the Shortcuts into my user-shortcut file and edited my color scheme by adding the code you provided in the file. Do I have to do anything else to enable highlighting (e.g. in JavaScript code)?
EarMaster
 
Posts: 2
Joined: Fri Jul 06, 2012 7:59 am

Re: Highlight code remarks

Postby agibsonsw on Fri Jul 06, 2012 10:03 pm

Check if there is any error message in the Console using Ctrl ' (apostrophe).
Does the plug-in work for languages other than JavaScript?
Try changing the key-bindings to something else temporarily, as perhaps another plug-in is using alt-down/up.

There are commands you can enter into the console to log commands, and/or key-strokes.

Code: Select all
sublime.log_input(True)
sublime.log_commands(True)
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: Highlight code remarks

Postby EarMaster on Mon Jul 09, 2012 7:26 am

Okay. The key bindings seem to be binded correctly:
Code: Select all
key evt: alt+up
command: highlight_code_remarks_switch {"direction": -1}
key evt: alt+down
command: highlight_code_remarks_switch {"direction": 1}

Unfortunately there seems to be an error in the script during startup:
Code: Select all
Reloading plugin C:\Users\visionsbox\AppData\Roaming\Sublime Text 2\Packages\User\highlight_code_remarks.py
Traceback (most recent call last):
  File ".\sublime_plugin.py", line 62, in reload_plugin
  File ".\highlight_code_remarks.py", line 143, in <module>
    from support.view import DeferedViewListener
ImportError: No module named support.view

May I have missed any dependencies apart from the obvious ones (I'm currently using Sublime Text 2 Build 2210)?

Edit:
Is it necessary to define how comments are written in my coding language? In JavaScript you open a single line comment with double slashes (// comment) and a multi line comment with a slash-star (/* comment */).

As you requested, I also tried to add a remark to your Python file to ensure it is no problem only appearing in JavaScript code. I'm not common to Python code, but I think something like
Code: Select all
# TODO: I'm just testing
should have been highlighted as a code remark. Unfortunately it didn't.
EarMaster
 
Posts: 2
Joined: Fri Jul 06, 2012 7:59 am

Re: Highlight code remarks

Postby trefmanic on Tue Aug 21, 2012 1:18 pm

EarMaster wrote:Okay. The key bindings seem to be binded correctly:

Unfortunately there seems to be an error in the script during startup:
Code: Select all
Reloading plugin C:\Users\visionsbox\AppData\Roaming\Sublime Text 2\Packages\User\highlight_code_remarks.py
Traceback (most recent call last):
  File ".\sublime_plugin.py", line 62, in reload_plugin
  File ".\highlight_code_remarks.py", line 143, in <module>
    from support.view import DeferedViewListener
ImportError: No module named support.view

May I have missed any dependencies apart from the obvious ones (I'm currently using Sublime Text 2 Build 2210)?


This is not an error, you have to copy the "support" directory from author's repository into your plugins directory. It worked for me.
This question answered at the author's bitbucket repo.
[Si non Confectus non Reficiat]
trefmanic
 
Posts: 1
Joined: Tue Aug 21, 2012 1:08 pm
Location: Siberia

Next

Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 19 guests