Sublime Forum

PlainTasks: More priorities

#1

If there is anyone that uses PlainTasks, I would love to throw a few questions at you. I have searched the internet, but really, cannot find any answers on changing some of it’s behaviors.

ie
With the priorities, I would like to create more ‘types’ of them. Currently there are:
@high
@low
@critical
@today

Anyhow, I check the PlainTasks.py, but found nothing related.

Cheers!

  • np
0 Likes

#2

I believe that these are not in the code because they’re just “regular” tags; You can make any tag you want by typing any text following an @ character. What makes some of them “special” is the syntax highlighting, which makes @critical appear with a red background, for example.

So, depending on what you want to do with your priorities, you may be able to get away fairly simply here. For example:

{
 "scope": "text.todo",
 "completions": [
  { "trigger": "u\t@ultracritical", "contents": "@ultracritical"}
 ]
}

If you save this text as Packages\User\PlainTasks.sublime-completions you gain the ability to press UTab to insert @ultracritical as a priority on your task. There is some documentation on completions you can read, but in short the bit before \t is what you need to type to expand the completion, the part after it is the “hint” that you see to the right of the completion in the list, and the “contents” is what gets inserted.

If you would like them to also display differently in the document (like @critical does, for example) you would also need to fiddle around the PlainTasks.sublime-syntax at a minimum to get the tags recognized there so that custom colors could be applied.

The only thing to be careful of is your placement of the file you create;make sure you put it into your User package so that you don’t accidentally override the file provided by the package itself.

1 Like

#3

Thanks for the fat info – this will help a lot. Seems though, that the color coding is hard coded. No colors listed in the syntax file. I will dig through more of the files in the …\Sublime Text 3\Packages\PlainTasks folder to see if I can find anything.

0 Likes

#4

Colors are defined in the accompanying color scheme file.

1 Like

#5

The colors used are several things going on. The syntax highlighting specifies source scopes for various items, and then the color theme maps source scopes to the actual colors used. The idea is that all things of a certain type should always be styled the same, although what that style actually is can be controlled.

For example, in the case of the @critical tag, the PlainTasks.sublime-syntax contains the rule that matches the tag and assigns it a syntax scope:

  critical:
    - match: (?<=\s)\@critical|✭critical
      scope: string.other.tag.todo.critical

PlainTasks also includes some theme files which indicate what colors to use. This is a small excerpt from tasks-monomai.hidden-tmTheme:

<dict>
    <key>name</key>
    <string>Critical</string>
    <key>scope</key>
    <string>string.other.tag.todo.critical</string>
    <key>settings</key>
    <dict>
        <key>background</key>
        <string>#FF0000</string>
        <key>foreground</key>
        <string>#000000</string>
        <key>fontStyle</key>
        <string>bold</string>
    </dict>
</dict>

So in this theme, the @critical tag is displayed with bold text that is black on a red background.

1 Like

#6

Ok, so basically I have to modify the following three files to change/edit the priorities:
xx.hidden-thTheme
PlainTasks.sublime-syntax
PlainTasks.sublime-completions

Giving it a whirl now, I’ll start with something simple. The syntax file will be my opportunity.

1 Like

#7

@noahphense PlainTasks is developed and maintained by @aziz. He is pretty busy at the moment with family. You can find the plug-in source code at https://github.com/aziz/PlainTasks and if you’ve got anything to add to it, pull requests are always welcome.

Happy coding!

0 Likes

#8

Thanks rppn, for the info about aziz. I will do a pull-req and check things out. I do have great ideas for this plugin, but I’ll leave the coding to aziz. It’s a great plugin.

Cheers!

  • np
0 Likes