Custom comment tag snippet and syntax highlighting


#1

Hi all,

First of all, thank you for developing an awesome editor like Atom! I am using Atom to develop websites in ExpressionEngine (CMS), and there is this one little thing that annoys me s bit. ExpressionEngine has it’s own way for commenting, which is the use of brackets. Example below:

{!-- This is an ExpressionEngine comment --}

Now I have added a snippet for this to the snippets.cson file, see below:

'.text.html.basic':
    'Comment ExpressionEngine':
        'prefix': 'eecomment'
        'body': '{!-- $1 --}$0'

Now this works as expected, but syntax highlighting is not working yet. Does someone know how te add some highlighting to the core HTML highlighting? I did find the the grammars/html.cson file on Github, but can’t locate the file on my local system.

Hope someone can help me out.

Many thanks,
MSN


#2

If you want to create a permanent change to the built-in HTML syntax highlighting, you would need to submit a pull request to the language-html package. On the other hand, since this is not standard HTML, I would personally be against adding such a change to the language-html package.

What you could do instead is fork the language-html package to create your own version. From there you could add the feature you want to your personal copy of the language-html package and use that. You can use the apm develop command to start that process.


#3

Thanks for your quick response. I already thought it would be a core hack. Like you said, not the best solution as the change will be gone after an update. Think I will just have to accept it :slight_smile: Thank you anyway!


#4

That’s not what @leedohm said and is also untrue if you do what he did say. However, I think that apm develop is the wrong answer because it leaves you with the package only available in developer mode. If you navigate (in your terminal) to somewhere you want to keep the code folder and type git clone https://github.com/atom/language-html.git, it will download the code to that folder (as a git repo) and then you can enter the repo and use apm link to create a symbolic link in .atom/packages that refers to the repo. You can then edit your repo to change the grammar and your repo will override the core package. This will mean that you don’t receive updates automatically, but the package is unlikely to change much, because it’s HTML.


#5

Thanks, will check this out.