samholmes / EJS.tmLanguage

An EJS syntax definition specifically for sublime text
47 stars 28 forks source link

detection of <% vs <? is off #7

Closed sanderhouttekier closed 8 years ago

sanderhouttekier commented 10 years ago

when opening files with <%%> notation It detects the syntax highlighting as EJS <??>...

i can switch it over manually but that gets tedious after doing that for every template time and time again.

either I'm looking for an option to force <%%> syntax highlighting, or a fix to detect the syntax type.

onlymejosh commented 10 years ago

+1

tomibennett commented 10 years ago

+1

zhigang1992 commented 10 years ago

+1

sotch-pr35mac commented 10 years ago

+1

gumb0 commented 10 years ago

+1

jamespantalones commented 10 years ago

+1

ilanbiala commented 10 years ago

+1 please fix this.

zhigang1992 commented 10 years ago

screen shot 2014-02-11 at 18 02 32

shuhankuang commented 10 years ago

I got it.

Find Packages/EJS/insert_ejs_tags.sublime-snippet

just change ? to % :+1:

$0 ]]> <%(=) 'insert ejs tags' %> = text.html

ilanbiala commented 10 years ago

@samholmes is there an option that will change this, or just that? Not sure that's the best idea because I think it gets overwritten if the package is updated, no?

samholmes commented 10 years ago

I thought I created two formats to switch between as @zhigang1992 illustrated with the screenshot. What is this issue about exactly?

diegoesp commented 10 years ago

I think that the issue is that some of the guys did not understand @zhigang1992 answer that in fact showed how to solve the problem.

For anyone that comes here: a simple way to do this:

  1. you pick an EJS file and display it in the editor
  2. From the window menu pick View => Syntax => "Open all with current extension as" => EJS => Pick <% %>

That's it. Whenever you open another file it should use the alternative syntax.

Thanks @zhigang1992 for the answer and @samholmes for this great package.

ilanbiala commented 10 years ago

But it should automatically detect which syntax I'm using, I shouldn't have to do anything, and what if I use both syntaxes when I'm working on different teams. Auto-detect is the only way to go and @samholmes should fix it.

diegoesp commented 10 years ago

Sounds like a tailoring for your special scenario. Remember that you can do it yourself. Code is there for you to do it, and you can issue him a pull request afterwards. It doesn't seem fair to me that you require @samholmes to tailor it for your needs; even more when he was kind enough to take the trouble to bring this to us. Just my opinion anyway :)

Best !

On Sun, Mar 16, 2014 at 11:41 AM, Ilan Biala notifications@github.comwrote:

But it should automatically detect which syntax I'm using, I shouldn't have to do anything, and what if I use both syntaxes when I'm working on different teams. Auto-detect is the only way to go and @samholmeshttps://github.com/samholmesshould fix it.

Reply to this email directly or view it on GitHubhttps://github.com/samholmes/EJS.tmLanguage/issues/7#issuecomment-37758785 .

ilanbiala commented 10 years ago

It's not for me, the point of syntax-highlighting is that it automatically detects the right syntax for a language and highlights the proper stuff, so it's really for everyone who uses it. No one should be forced to use only one syntax or have to set stuff to be drilled in to Sublime.

samholmes commented 10 years ago

@ilanbiala No one is forcing you to use any syntax because you can switch between them easily with a few keystrokes. If you'd like to take the time to figure out how to automatically detect which syntax to use, I'm more than open to a pull request with this feature as @diegoesp suggested. I unfortunately do not have the time.

However, what I should do is make it remember the last selected template, so that way you don't have to switch for every file you open.

diegoesp commented 10 years ago

Stockr

          Hi, Samholmes:

          I would like you to join my investing network.

        Diego Espada

          Site Manager at Devspark

        ACCEPT »

          You are receiving invitation emails.
          Unsubscribe.

          © 2013 Stockr, Inc.
          137 Bay Street,
          Santa Monica, CA 90405,
          USA
samholmes commented 8 years ago

Like I said in 2014, I'm open to a PR on this one. As of right now the plugin supports you choosing between the two EJS styles of code. It would be cool if my plugin could detect between the two styles, but I'm not too familiar as to how this would be done (so a PR would be greatly appreciated).