sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
811 stars 39 forks source link

Add support for whitesmiths indentation #112

Open chlab opened 11 years ago

chlab commented 11 years ago

As discussed in this forum thread, it is the opinion of several users and myself that the whitesmiths coding style should be supported by default.

Whitesmiths style is still used commonly enough for it to be supported by any major editor. In my case, I have no say in this matter, it's the coding style my company has chosen. Day-to-day work with SublimeText is difficult in Whitesmiths when SublimeText enforces a different style.

Example:

function foo()
  {
    | <- this is where cursor is placed by auto indentation
| <- clicking an empty line within the function places the cursor here
  | <- but this is where it should be in both cases (for Whitesmiths)
  }

I think an option along the lines of tab_size_within_structures would pretty much do the trick. The default would be 0, as it is now. Setting it to 2 in the example above would result in the expected behavior.

References:

chlab commented 11 years ago

It seems only contributors can add labels. This issue is a feature request and/or enhancement.

chlab commented 11 years ago

Is it ok to bump this? This would be a huge improvement for me and any other Whitesmiths coders. Thanks.

FichteFoll commented 11 years ago

Bumping doesn't mean anything since the developer is probably not even looking at this. He did fix a few things reported here already but we do not know if he actually saw it here or it just happend to have been reported on the forum.

Maybe some day he will appreciate our efforts ...

chlab commented 11 years ago

Fair enough, thanks. I'll just suffer in silence from now on :):

grigorescu commented 11 years ago

+1

sethhall commented 11 years ago

+1

ghost commented 10 years ago

Reference on how to do this in plugins (per own language or whatever):

https://github.com/makopo/sublime-text-lsl/blob/master/changestyle.py

chlab commented 10 years ago

Thanks for this. Would you mind adding some more information on how to achieve this standalone for some who has no idea how these plugins work? You would do me a huge favor!

ghost commented 10 years ago

The plugin copies the contents of style-settings.tmPreferences.stylea (in plugin folder) or style-settings.tmPreferences.styleb (in plugin folder) to style-settings.tmPreferences (in user).

In style-settings.tmPreferences then is defined the value for a variable used in the *.sublime-snippet files of the plugin.

Checking against the value plugin knows whether the option to change the style has been toggled or not.

chlab commented 10 years ago

Thanks for your reply. As far as I can tell, the plugin only changes the newline/space style though, which isn't quite enough to get whitesmith's working. I don't know how to go about changing the indentation level of the closing brackets for example.

FichteFoll commented 10 years ago

Oh wow, I didn't even know snippets could use the meta variables and expand them as defined by tmPreferences files. Sounds pretty useful.

harperic commented 10 years ago

+1

chlab commented 10 years ago

Well, I have a new job and thankfully, finally, no longer have to code in Whitesmiths. I am therefore abonding this thread. I wish the best of the luck to the rest of you.

FichteFoll commented 10 years ago

Reopening since the feature/enhancement request is still a valid concern and has not been solved. It might probably never be implemented, but keeping track of all the things is still useful.

sethhall commented 10 years ago

I have a script in my Bro (a domain specific programming language for network traffic monitoring) support bundle that kind of implements whitesmith style. We use something very similar to whitesmith in our core and in our Bro scripts. Perhaps this is something that could be made more generic?

https://github.com/sethhall/bro.tmbundle/blob/master/BroIndent.py

ghost commented 10 years ago

Leaving a reference note here for issues regarding the use of meta variables:

Makopo/sublime-text-lsl#33

titoBouzout commented 9 years ago

This issue was moved to SublimeTextBugs/DefaultPackages#61

FichteFoll commented 8 years ago

@jsiwek commented on 25 Oct 2015:

Here's a plugin I wrote that attempts to add support for Whitesmiths indent style: https://github.com/jsiwek/WhitesmithsIndentStyle

jrappen commented 7 years ago

sublimehq/Packages#131 shows a possible fix