Sublime Forum

Latest v2 (b2051) broken?

#1

Hi,

ST2 asked me to update a few days ago, which I have done. Now I no longer see the character encoding or line termination type in the status bar. I swear this was there before the update (or am I crazy and it wasn’t?), but now all I see is line and column numbers on the left hand side.

Also, when I start a new document and paste in some PHP the syntax highlighting is correct but the selected syntax in the View->Syntax menu is wrong. It will either remain Plain Text or become HTML (??), for example:

[code]<?php

echo ‘hello’;[/code]
…results in no change to the Plain Text syntax selection, but the colors are properly applied.

[code]<?php

class MyClass {

}[/code]
Syntax = HTML

[code]<?php

class MyClass {

}

?>[/code]
Syntax = Plain Text

[code]<?php

function poop() { return null; }[/code]
Syntax = Plain Text

[code]<?php
namespace \myns;

use \Exception;

try {

throw new Exception('ಠ_ಠ');

}
catch (Exception $e) {

throw $e;

}[/code]
Syntax = Plain Text

Actually, it almost seems to depend on the source of the paste? Even though the syntax highlighting always works properly, I can never get it to identify the syntax type as PHP.

Thanks!

0 Likes

#2

I can’t speak to the encoding and LT issues you’re seeing, but it appears 2051 broke column select on the Mac. Instead of control + left click selecting in column mode, it inherits the OSX default of a secondary click (context menu). I rolled back to 2047 temporarily… None of the mouse methods outlined in the link below allow column selection:
sublimetext.com/docs/2/column_selection.html

0 Likes

#3

aguenter: that’s all working as designed.

The status bar has never shown encoding nor line endings in Sublime Text 2, that’s from Sublime Text 1. It is on the todo list though.

When you paste source code into an empty file, it will attempt to automatically detect the syntax of what was pasted in. HTML is the correct syntax to use for .php files (as it’s the ‘outer’ syntax if you like). When you select PHP from the menu it’s just acting as an alias for HTML.

benforr: Column select on mac is now option+left click, so that ctrl+click can show the context menu. I’ve updated the documentation to reflect this now.

0 Likes

#4

Thanks for the reply!

Regarding the syntax issue, I don’t quite understand the purpose of the syntax menu, then. Does this not change which package is used?

Personally, I pretty much never write PHP blocks within markup, and as HTML is only the “outer syntax” when PHP is being interpreted for Apache/IIS/whatever this seems incorrect to me. I’m sure you’re aware that PHP is a scripting language with a standalone interpreter that, although often used via CGI or as a webserver module, is much more than that.

Also, there still seems to be an issue with detection regardless of the semantics, as sometimes it never changes from Plain Text to HTML (as evidenced in my examples).

One more thing, if I may. This one might be in the wrong forum section, but I’m not sure that it deserves a new post as I don’t know if it is a feature request or bug report:
I’m using tab indentation and I’ve noticed that when I’m within a nested block and insert a linefeed/carriage return it will properly indent the new line to the current indentation level, but if I don’t type anything and insert another LF, the blank line I had created does not preserve its indentation. Rather, it truncates it completely and only the LF remains.

For example:

{<LF>
    <cursor is here>blahblah<LF>
    <cursor is here, previous line preserved indentation><LF>
    <cursor is here, previous line lost indentation>

Is this expected behavior (to reduce file size maybe)? If so, would you mind making this a boolean toggle in the config? I know in order to add something to a blank line you can just move the cursor to the beginning of it, press TAB once, and it will return to the proper indentation level…but, I’m using adzenith’s Indent Guides plugin and it causes broken indentation guide lines which looks horrible. Line wrapping also breaks them too, obviously, but this is expected behavior as it’s still the same line. Here’s a screencap:

Regardless of these few small gripes (of which the last bothers me the most), so far ST2 is the best all-purpose editor I’ve ever used. It just feels…right, it’s hard to explain. The DX/GL rendering is definitely part of it. :smiley: I’ve turned a few friends on to it since I discovered it last week and they all agree and love it as well. Thank you and keep up the great work!

0 Likes

#5

The syntax detection is not sophisticated, and will generally not detect HTML. It’s mostly there to detect the blindingly obvious cases, such as when a file starts with “#!/usr/bin/python”. The syntax menu is used to explicitly set the syntax, for new files, or when the syntax detection doesn’t do what you want.

Wtih regards to your indentation question, it sounds like turning off the trim_automatic_white_space setting will do what you want.

0 Likes

#6

Brilliant, that did it. Thanks.

0 Likes

#7

Thanks jps, option works as advertised for column selection. I tried shift, command, not sure why I didn’t try option, it is the ‘magic’ button in OSX, makes sense :-S

0 Likes