+1
lanzz 5 years ago • updated 5 years ago 6

Example (indentation guides shown for illustration purposes):

1: foo() {
2: |    if (bar) {
3: |    |    for (condition) {
4: |    |    |    baz();
5: |    |    }
6: |    }
7: }

If the cursor is on line 2, the second indentation guide should be highlighted, because line 2 starts at that indentation level. This will result in very easy visual identification of the matching closing brace, regardless of the cursor position within the actual line.

So in the current arrangement you would get the indentation guide you want to see if the cursor was on line 3?

Are we in agreement on the change you are asking for?


If you're on line 3 (the "for" statement), the third indentation guide should be highlighted, because that line is indented at the same level. The algorithm should be something like:

  1. get leading whitespace of the current line (e.g. eight spaces, for line 3 in the example)
  2. calculate the indentation level that whitespace corresponds to (e.g. with a 4-space indentation, eight spaces gives us level 2 indentation)
  3. highlight the indentation guide at the calculated indentation level (e.g. level 2 indentation => third indentation guide, because the first guide is for level 0)

I think we are failing to communicate.


I am trying to help get a clear contrast what the difference is between 'what is' and 'what you want'.


Since we have indentation highlighting in place already following one set of design rules then the clearest way for you to describe the change you are seeking is to highlight, in as exact detail as you can, what is different between what is happening now and what you want to see instead.


While you may think your highlighting design is better there may not be universal agreement with you. Opinions are like noses, everyone's got one.


The best way to sell your idea is to make it very clear you fully understand what the current situation is and how your design is different and superior. Without showing a change is better then it is just different and very few people are interested in implementing and enduring change just because it is a change.

It seems for some reason I'm not seeing any indentation highlighting, so I was not aware it ever existed. Forget about this thread.

Ah I am sorry, I thought you were suggesting a change rather than what you were really suggesting. I get what you are saying now. My bad.


I agree with you that these guides are almost a requirement to keep sane when working with some languages.


You can be sure that if you are having difficulties you are not alone so good to get the subject out in the open where it can be discussed and others having the same trouble can benefit from the discussion. All good stuff.


If you have a look in [Preferences -> Settings - Default] you should find some entries like the following:


    // Set to false to turn off the indentation guides.

    // The color and width of the indent guides may be customized by editing

    // the corresponding .tmTheme file, and specifying the colors "guide",

    // "activeGuide" and "stackGuide"

    "draw_indent_guides": true,

    // Controls how the indent guides are drawn, valid options are

    // "draw_normal" and "draw_active". draw_active will draw the indent

    // guides containing the caret in a different color.

    "indent_guide_options": ["draw_normal"],


Copy those lines and then open  [Preferences -> Settings - User] and paste them into that file (these are your personal settings - never edit the [Settings - Default] directly. You can edit it directly but it is a 'bad idea' for reasons we won't go into here.


As the comments in the [Settings - Default] suggest the presentation of the guides is dependant on their being settings in the relevant syntax colour file (e.g. "Packages/Color Scheme - Default/Monokai.tmTheme") that support the guides. If you have selected a tmTheme that does not supply the required values the guides will not display.


So a quick test would be to try reverting to the default Monokai theme and seeing what happens. 


Did the guides appear?

If they did then the problem is just in the theme you were using and you can either choose a theme where the guides display or edit the theme you do like to use to add the missing values.


These are the settings from my own personalised theme so you can see the area where the keys and values referred to above go. See 'guide', 'activeGuide', and 'stackGuide' towards the end of the list? I had to manually add them to the theme. I have chosen to have the guide for the active guide different to the other guides by enabling  "indent_guide_options": ["draw_active"] in my  [Preferences -> Settings - User] and supplying the relevant colours that I like it the .tmTheme file I use.


<dict>

<key>background</key>

<string>#000000</string>

<key>caret</key>

<string>#FFFF00</string>

<key>foreground</key>

<string>#FFA500</string>

<key>invisibles</key>

<string>#FFFFFF40</string>

<key>lineHighlight</key>

<string>#00FF00</string>

<key>selection</key>

<string>#424242</string>

<key>gutterForeground</key>

<string>#424242</string>

<key>guide</key>

<string>#FFFFFF</string>

<key>activeGuide</key>

<string>#00FF00</string>

<key>stackGuide</key>

<string>#424242</string>

</dict>



Hope this is helpful and you can get the guides showing. If you are still having trouble getting it to work don't hesitate to ask for help. One of the many cool things about ST is the great community of people willing to help one another get the best out of the freedom and power ST gives us. 

Yes, I was proposing it as a new feature, but only because I had no idea that it had been already implemented. As soon as I figured that out, I found the setting in the default prefs, but thanks for the detailed explanation :) It is slightly different from what I described above, but otherwise it's exactly what I've been missing.