atg / chocolat-public

Public bug tracker for the private chocolat project
http://chocolatapp.com
180 stars 4 forks source link

[change "HTML" in the status bar to "PHP" if the file has a .php extension] PHP Continuously identified as HTML #215

Closed shnhrrsn closed 12 years ago

shnhrrsn commented 13 years ago

Regardless of how many times I switch the language to PHP when opening a .php file, whenever I open a new .php file, it auto detects to .html. This is incredibly frustrating.

alanhogan commented 13 years ago

(Duplicate of #189.)

atg commented 13 years ago

If I'm not mistaken, you want to use the "HTML" language for PHP code. I should probably take the PHP language out of the list.

shnhrrsn commented 13 years ago

I'm actually trying to do it the other way around, use PHP language for PHP code. For some reason Chocolat keeps setting the HTML language for .php files. Sorry for any confusion!

tarnfeld commented 13 years ago

I think .php should be PHP and .html should be HTML however, each should be able to syntax highlight each other because depending on your configuration PHP is valid in both.

OscarGodson commented 13 years ago

@alahogan this isn't a duplicate of #189 at all. This is a bug. .php should open as PHP by default. It's a totally different language. C++ for Java

Also, please don't remove PHP from the language list. The bug is simply that PHP should be the syntax highlighting

alanhogan commented 13 years ago

It seems to me that this bug was half a duplicate of #189 and half, apparently, a misconception that PHP and HTML were different in Chocolat as shipped today. Hence the removal of PHP as an option. If there really is a difference in practice, then pointing it out would definitely help define why this should still be an open bug.

The C++ / Java analogy doesn't help because you can't really embed Java on C++ or vice versa, but every .html doc could be a valid (if lame) .php script.

On Aug 14, 2011, at 10:19 AM, OscarGodsonreply@reply.github.com wrote:

@alahogan this isn't a duplicate of #189 at all. This is a bug. .php should open as PHP by default. It's a totally different language. C++ for Java

Also, please don't remove PHP from the language list. The bug is simply that PHP should be the syntax highlighting

Reply to this email directly or view it on GitHub: https://github.com/fileability/chocolat-public/issues/215#issuecomment-1802368

OscarGodson commented 13 years ago

PHP is a programming language. HTML is a coding language. I have a lot of PHP files that do not include HTML whatsoever, as should move of your code if you program in an MVC way. Look at: http://codeigniter.com/ this is basically all PHP and no HTML (except to spit out some server error pages). It's also extremely confusing opening a fully PHP file and getting HTML then going to change the HTML type to PHP only to find only PHP-Smarty.

tarnfeld commented 13 years ago

PHP is a scripting language, HTML is a markup language. In any case PHP can contain HTML and HTML can contain PHP. Thats how I think it should be, text mate allows them both in each other.

Though in terms of file extension, a .html/htm file should be classes as HTML and a .php file should be PHP but the highlighting shouldn't be any different between the two.

alanhogan commented 13 years ago

My last comment: I do understand MVC / templating languages (used Kohana + mustache for a while) but still don't see how this is actively causing problems.

On Aug 14, 2011, at 11:08 AM, OscarGodsonreply@reply.github.com wrote:

PHP is a programming language. HTML is a coding language. I have a lot of PHP files that do not include HTML whatsoever, as should move of your code if you program in an MVC way. Look at: http://codeigniter.com/ this is basically all PHP and no HTML (except to spit out some server error pages). It's also extremely confusing opening a fully PHP file and getting HTML then going to change the HTML type to PHP only to find only PHP-Smarty.

Reply to this email directly or view it on GitHub: https://github.com/fileability/chocolat-public/issues/215#issuecomment-1802585

OscarGodson commented 13 years ago

It's not necessarily causing problems where the syntax is wrong, it just doesn't make any sense. So, your example is that you can embed it, then why do you have CSS or JS as different? Those could technically be HTML too then.

shnhrrsn commented 13 years ago

HTML can not contain PHP, that's just flat out wrong.

PHP can contain HTML, but it can also contain, JS, CSS, XML and pretty much anything... You could make PHP output C++ and then compile that file. The default behavior of PHP is to send a text/html content type header when you first output something, if you haven't already set the content type. Java can output HTML too, does that mean Java should be identified as HTML?

.php files should open as PHP, .html files should open as HTML, it's really that simple. This discussion is ridiculous.

alanhogan commented 13 years ago

Apparently no one has it in mind that PHP code requires an opening PHP tag. Not true of CSS, JS.

Let's not get too bent out of shape here.

I am merely suggesting that from a pragmatic standpoint there isn't really a problem. You can certainly argue it feels wrong though.

On Aug 14, 2011, at 11:33 AM, shnhrrsnreply@reply.github.com wrote:

HTML can not contain PHP, that's just flat out wrong.

PHP can contain HTML, but it can also contain, JS, CSS, XML and pretty much anything... You could make PHP output C++ and then compile that file. The default behavior of PHP is to send a text/html content type header when you first output something, if you haven't already set the content type. Java can output HTML too, does that mean Java should be identified as HTML?

.php files should open as PHP, .html files should open as HTML, it's really that simple. This discussion is ridiculous.

Reply to this email directly or view it on GitHub: https://github.com/fileability/chocolat-public/issues/215#issuecomment-1802716

OscarGodson commented 13 years ago

PHP doesn't have an "opening tag" like HTML. It's not HTML. It's telling apache to start reading PHP so you can mix any languages. This is a feature of PHP and has nothing to do with HTML. You can mix PHP with .css and .js, or hell, even .chocolat if you wanted.

Have you ever written a PHP application?

PHP being marked as HTML is a bug. Pure and simple. Name one other editor, ever, that does this.

OscarGodson commented 13 years ago

Just so you know, I personally HAVE mixed PHP with CSS to set variables and do some dynamic stuff with stylesheets and JavaScript for all JavaScript applications except for authentication in which PHP outputs some user keys/hashes, so, why do you pick HTML?

atg commented 13 years ago

It works this way, because this is how the tmbundles work. It's exactly the same in textmate.

It's not a philosophical issue, it's a technical one.

shnhrrsn commented 13 years ago

I don't think anyone is arguing the php bundle shouldnt support HTML, the issue is that chocolat insists that .php uses the HTML bundle where as TextMate opens .php in the PHP bundle.

OscarGodson commented 13 years ago

@fileability Yeah, what @shnhrrsn said. The difference is you can't choose PHP and PHP is not set as PHP when you open a PHP file.

bnvk commented 13 years ago

WHOA! This thread is ridiculously outta control. @AlanHogan based on the private email you just sent my friend Oscar... take a chill pill man. Oscar is none of the obscenities you just called him.

tarnfeld commented 13 years ago

Haha, what's going on in here?! Can't we just use what text mate used to do?

On 14 Aug 2011, at 21:29, brennannovakreply@reply.github.com wrote:

WHOA! This thread is ridiculously outta control. @AlanHogan based on the private email you just sent my friend Oscar... take a chill pill man. Oscar is none of the obscenities you just called him.

Reply to this email directly or view it on GitHub: https://github.com/fileability/chocolat-public/issues/215#issuecomment-1803183

atg commented 13 years ago

Look, I just installed TextMate onto a VM. Completely fresh install. TextMate uses the HTML bundle, not the PHP one.

The PHP bundle is included by the HTML bundle. It has to work that way, because the outside of a PHP file is HTML tags.

atg commented 13 years ago

BTW, if you really want the PHP bundle to show in the list, you can do

defaults write com.chocolatapp.Chocolat "Show Hidden Languages" -bool YES

But you should only be doing this if you have PHP code without <?php ... ?> tags (which I don't think is possible... )

OscarGodson commented 13 years ago

I haven't used TM in years. I just figured it did. I use Komodo these days. And just because TM does that wrong doesn't mean chocolat has to also :)

bnvk commented 13 years ago

Coda from Panic handles the issue of scripting languages (which allow HTML in the code) quite well. It has the wrapper types

PHP-HTML ASP-HTML JSP-HTML

But they used to have just PHP in addition to PHP-HTML... which was confusing when doing custom syntax coloring now it is just the later, which does simplify things.

Currently if I open a file extension that is .php that contains HTML inside it renders that HTML according to my preferred HTML syntax... but if a .php file contains no HTML then the whole issue is moot.

@alanhogan if you want to be pedantic or argue semantics, you managed to use the "F word" four times in one message- as a simile, an adjective, an adverb, and a noun- respectively. Additionally you called Oscar "annoying" and "self-important" which shifts (and intensifies) the context with each recurring use- I, personally, classify that as obscene behavior when communicating with a complete stranger. Please, keep it classy.

command-tab commented 13 years ago

I'll add my 2 cents, because I code and I'm a nitpicker :-)

For my daily work, I work with PHP files that are pure PHP, with no other languages wrapping or embedded. It's templating systems all the way to separate concerns as best as possible. Therefore, I'm in agreement with @shnhrrsn that .php files should open as "PHP", and .html files should open as "HTML". Coda PHP-HTML mode is a decent compromise, and I wouldn't mind seeing that in Chocolat if that's how it had to be. But showing .php files as being colored by the "HTML" highlighter appears incorrect to me, and I suspect it would to Chocolat newcomers as well.

It seems reasonable that the PHP syntax highlighter should support common embedded types like HTML, CSS, and JS. Whether it says so in the "PHP" file type doesn't much matter to me, since it's a given that PHP was designed from the outset to support such things. Is it possible to combine bundles in this way, so that there's no duplication of highlighting code?

atg commented 13 years ago

Well, I can make Chocolat lie, and have it report .php files as 'PHP'. But it would be purely cosmetic, because the HTML/PHP bundles simply don't work like that.

I'm loathe to actually modify the bundles, since then we don't get upstream changes.

command-tab commented 13 years ago

I'd be okay with a little code lie here and there, for the sake of reducing confusion. Would it have to happen in the bundle? Your comment makes it sound like that's the case.

OscarGodson commented 13 years ago

When you say bundles do you mean the TM bundles? If so, here's my thoughts, if they're something else and I'm misunderstanding you can ignore this:

One of the largest reasons why people are so excited about Chocolat (and they are! when I post about your changes on Twitter or G+ I always get replies and invite requests) is that it's not TM. They make jokes that it's TM2, but the reason why people want TM2 is because it'll be a major upgrade of TM. TM is majorly out of date and this is why I use Komodo. Komodo has jQuery support, HTML5 support (including the actual HTML5 JS APIs), CSS3 (including browser specific extensions like -moz, -webkit, etc), live shared doc editing (like Google Docs), and soon to be Node support.

People don't like Komodo because it's ugly and bulky and while it works on a Mac you can tell it wasn't designed by Mac people. This is where Chocolat comes in. It's sexy and built by Mac lovers. It's designed for a Mac and it's built from "the ground up" in the current time. TM is nearing a decade old. It's like saying IE6 rocks because at the time it kicked ass, which it did.

You guys have a huge opportunity here. You have the buzz and you have loyal customers already. I'm psyched about it and that's why I participate in here and why I try so hard to work on it in production. TM bundles are great for a prototype and this alpha, but honestly, you guys should really think about making your own "bundles". Don't be stuck with some 3rd party software that is such a large part of your software. If making a change like changing the file type for files with .php that nearly everyone here wants except one, it seems like you're doing something very wrong.

We don't want a new wrapper for TM, we want a new editor that looks sexy, is up to date with the times, and is powerful. You have such a massive chance becoming the next TM, so don't become just a "nicer looking TM" :)

We all <3 Chocolat!

atg commented 13 years ago

You know, I swear I'm spending more time writing comments here than it would take to actually make the change, so I'll reopen this issue and fix it when I get around to fixing the other cosmetic issues.

timhatch commented 13 years ago

I thinks its mildly bizarre that such a peripheral issue has gathered so much attention - it's not as though the syntax is wrong. Plenty of other stuff to do...

OscarGodson commented 13 years ago

I think it's because it's basically making PHP a second class citizen.

alanhogan commented 13 years ago

Rewrite:

I would wager this issue only gained a lot of attention because certain person(s)' persistence in arguing the issue kept it on top of issue lists / dashboard streams, gaining further visibility and inviting further contributions.

OscarGodson commented 13 years ago

Wow @alanhogan that's one hell of a rewrite. You do realize tho it already sent to everyone in this thread though, right? I was never angry by the way, I was just completely dumbfounded at your take on it, that's all. Based on your opinion .rb files and many other languages you can embed, with tags, in HTML should be marked as HTML like:

Ruby

<ul>
<%(1..10).each do|i|%>
  <li>number <%=i%></li>
<%end%>
</ul>

Python

<ul>
<%
  for item in items:
    %>
      <li><%= item.name %></li>
    <%
  %>
</ul>

ColdFusion

<ul>
<cfloop index="x" from="1" to="10" step="1">
  <li><cfoutput>#x#</cfoutput></li>
</cfloop>
</ul>

If you go an reread what I wrote it was never angry, ever. You got angry and sent me a nasty email and then got more pissed when I shared it on Twitter and G+. What I said was basically exactly what everyone above said also.

alanhogan commented 13 years ago

I rewrote it to be more civil. But I guess you don’t give a shit about civility.

Cool bro, thanks for posting private communication to two social networks. I didn’t even know.* I have apologized for my email (privately!) and expunged off-topic comments in this thread (yet, here’s this), but if you need to keep publicly raking me over the coals for privately calling you "annoying" and "self-important", boy, you’ll sure show me how wrong I was!

https://twitter.com/oscargodson/status/102835012772167680 ← Nice job calling Chocolat’s developers "flat out stupid" in public.** As your friend @brennannovak says, “keep it classy.”

* But it proves you were "never angry, ever." ** Are we still wondering why this issue got so much attention, when you tweet a call to arms that implies “anyone who has ever done work in PHP” will agree this behavior (standard in TextMate for 6 years, where I and many others did PHP development for years – I still use TM but am over PHP) is obviously broken?

OscarGodson commented 13 years ago

Uh, you never apologized. Here's all I have:

screenshot

and yeah, i wasn't angry at the time. I thought it was funny how pissed you got over this thread when I posted the picture, and the link you sent I was sorta annoyed, but not angry still (hence the "ugh")

Also, I made a mistake, and acknowledged it (i assumed [wrongly] you were a developer for it because you got so angry and so defensive about this thread):

Mistake: http://twitter.com/#!/oscargodson/status/102836970169962496
Public Apology: http://twitter.com/#!/oscargodson/status/102837458617630720
Personal Apology: http://twitter.com/#!/oscargodson/status/102838579348258819

And again, I haven't used TextMate in probably 5 years. Only one out of the dozen or so developers I work with on a daily basis still use TextMate. I totally get many loved TextMate, but as you even said, that was years ago. As i said earlier: "It's like saying IE6 rocks because at the time it kicked ass, which it did."

alanhogan commented 13 years ago

For the last time. Communicate with me privately if you have issues with me. http://alanhogan.com/contact. This is incredibly off topic, and rude to everyone else involved.

Trollface Trollface Trollface Trollface Trollface Trollface Trollface Trollface Trollface Trollface PHP has no opening tag

OscarGodson commented 13 years ago

Jesus dude. Calm down. How the hell are you getting so angry about this?

devjj commented 13 years ago

http://xkcd.com/386/ <-- Pertinent.

mogui commented 12 years ago

LOL very pertinent... Anyway this issue is annoying me too can it be at least HTML / PHP

ghost commented 12 years ago

It sounds like I am yet another person in the please keep HTML for HTML files and PHP for PHP code files.... PHP as a language can do and is used for more than just spitting out HTML.

It would be great if we could add a dedicated PHP bundle.

atg commented 12 years ago

Added an item called "PHP" which redirects to HTML so that it's more obvious to newcomers where the PHP support is located.

And with that, this issue is closed.

fuzzy76 commented 11 years ago

Apart from being the bikeshed-issue of the year, there are some quirks with this implementation. A .module file I have selected PHP for will consistently open as HTML no matter if I change it to PHP and reopen. But a .php file will consistently open as PHP no matter if I change it to HTML and reopen. And I have a nagging feeling that this might affect the missing symbol list I'm experiencing as it seems to happen for .php files in HTML mode but not .module files in PHP mode. Sorry if this is the wrong place to air this...