-
Notifications
You must be signed in to change notification settings - Fork 22
Description
I have a few code conventions that I'm sure nobody else needs in their definitions, but wanted to be able to extend the definitions to add them. I also see several language requests here; I'm sure that having the ability to add your own definitions would help some folks out.
I hacked out my own solution to this, which basically involves merging a user-defined regex set onto the base regex set. In my solution, I also converted the regex files to CSON as I believe they don't need the ability to execute any arbitrary code as full blown coffeescript.
Note: This would add an extensions folder to the package, which should not be tracked by git. Also, adding styles for new list items would be up to the user in styles.less, but perhaps a default style could be given.
Excerpt of lib/symbols-list.coffee:
{$} = require('atom-space-pen-views')
CSON = require('cson')
path = require 'path'
# Load System and User regex
RegexListBase = CSON.load(path.join(__dirname, ".", "symbols-list-regex.cson"))
try RegexListExt = CSON.load(path.join(__dirname, "..", "extensions", "symbols-list-regex.cson")) catch e then RegexListExt = {}
RegexList = $.extend(true, {}, RegexListBase, RegexListExt)Example overrides file extensions/symbols-list-regex.cson:
#Removes todo and fixme; Adds a custom item used to denote sections in code
text:
html:
php:
regex:
todo: false
fixme: false
comment_heading: /\/\/[ ]![ ]*(.+?)(?:[\r\n])/gmiI'm happy to submit a pull request for this, if interested.