Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Add support for whitesmiths indentation #112

Open
chlab opened this Issue Jul 25, 2013 · 19 comments

Comments

7 participants

chlab commented Jul 25, 2013

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 Jul 25, 2013

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

chlab commented Sep 19, 2013

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

Owner

FichteFoll commented Sep 19, 2013

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 Sep 19, 2013

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

+1

@ghost

ghost commented Feb 17, 2014

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 Feb 17, 2014

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

ghost commented Feb 17, 2014

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 Feb 17, 2014

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.

Owner

FichteFoll commented Feb 17, 2014

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

+1

chlab commented Oct 28, 2014

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.

@chlab chlab closed this Oct 28, 2014

Owner

FichteFoll commented Oct 28, 2014

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.

@FichteFoll FichteFoll reopened this Oct 28, 2014

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

ghost commented Oct 29, 2014

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

Makopo/sublime-text-lsl#33

@titoBouzout titoBouzout referenced this issue in SublimeTextIssues/DefaultPackages Dec 22, 2014

Closed

Add support for whitesmiths indentation #61

Owner

titoBouzout commented Dec 22, 2014

This issue was moved to SublimeTextBugs/DefaultPackages#61

@titoBouzout titoBouzout locked and limited conversation to collaborators Dec 22, 2014

@FichteFoll FichteFoll referenced this issue in SublimeText/jQuery Jan 13, 2015

Closed

Convert single to double quotes? #18

@FichteFoll FichteFoll reopened this Apr 28, 2016

@FichteFoll FichteFoll unlocked this conversation Apr 28, 2016

Owner

FichteFoll commented Apr 28, 2016

@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 Apr 14, 2017

sublimehq/Packages#131 shows a possible fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment