pharo icon indicating copy to clipboard operation
pharo copied to clipboard

Improve Settings Syntax Highlighting section

Open Shaping opened this issue 3 years ago • 4 comments

Pharo version: 10 64-bit

I need Pharo's syntax highlighter settings to work at least as well as VW's. I'm willing to do the work.

SHRBTextStyler>>blueStyleTable and SHRBTextStyler>>blueStyleTable mention details that interest me, like the colors of 7 levels of parentheses and blocks. But none of these details appear in the Syntax Highlighting section of Settings, and can therefore not be conveniently set or changed.

I want to:

  • Color method temp variables and block parameter variables differently. Currently they are identified too generally as just #variables. They are therefore always the same color. Can someone point me to the parser classes that extract these features?

  • Color differently Classes and other globals? I'm trying to find this distinction as well in the parser classes. If someone familiar with the parsing and related GUI classes can give me some pointers, I'll do the work.

  • Let the user assign colors to the first 7 levels of parentheses and first 7 levels of brackets.

Shaping avatar Aug 05 '22 14:08 Shaping

Check the existing settings. There is also the book chapter on Settings in deep into Pharo. You can also change the coloring scheme (for example I do not like to have comments too pale because I want to read them).

Ducasse avatar Aug 05 '22 15:08 Ducasse

I wrote the issue because I checked the settings and didn't find those three features above. Are you saying that one or more of those features actually exists?

Here in summary are the syntactic features for which I want unique styles (colors are what I actually have in mind):

  • method parameters
  • temporary variables
  • block input parameters
  • global variables
  • classes (a specific kind of global variable)

If I can do that now, please show me how.

Also, I just noticed that currently variables that should match in color don't, or rather we are allowing the user to set definitions of method parameters to one color and references to them later in the method to another. I prefer to have the two be color-synced so that my eye can match them quickly.

For example, I don't want to see this:

image

I would want the three occurrences of aDictionary to be the same color without needing to use two different syntax tokens.

Yes, I too do not want the comment to be too pale, but I want the color to be less desirable to read than the others because I insist that my code be as self-documented as possible, and I want to force myself to read it and get the understanding I need from it. For me, comments are for describing the weird stuff that no one can anticipate, or to provide background and context that the uninitiated won't know about.

Shaping avatar Aug 06 '22 07:08 Shaping

hi,

all this is already possible,

  • in the case of block arguments and method arguments (and method variables) the only reason why they are not differentiate now is because we decided it was better like that, but you are free to edit and use your own style.
  • Same for globals and classes.
  • parenthesis are already differentiate to 7 levels.

if you check at SHRBTextStyler class>>blueStyleTable and around, you will see all what you need.

Yes, the setting browser section of this is lacking and not showing all capabilities, but capabilities are there (no idea why, as they were always there).

You can always enhance the settings browser to include all that, but to be honest I am not sure the settings browser is doing a good job at showing settings and I will revamp the tool as soon as I find time. Instead, I would replace the whole syntax highlight customization section now for a button "Customize" that opens a dedicated tool.

estebanlm avatar Aug 06 '22 08:08 estebanlm

Yes, I noticed that the parsing of parens/blocks seems to be done for me already, but the GUI doesn't represent it. I'm not sure about distinguishing between the different variable types. That looks a little broken, but I've not studied >>blueStyleTable thoroughly; so I'm not sure. I'm not sure how to connect to the GUI yet. Studying chapter 5 of Deep into Pharo.

Yes to your thought on a dedicated tool. I really need to see the right colors to read quickly and efficiently. Can I help you do this now? You seem not to like the potential outcome of keeping the SH GUI embedded in the larger Settings Browser. Can we just make a sample-method pane with a good "omni-method" to show off all the features, and then add the bits for the paren/block levels (old VW versions had this GUI, but the new versions don't)? The five variables types I listed should already be parsed and tokenized, but I'm not sure yet, without some additional study of >>blueStyleTable. Are you sure all 5 types have unique tokens/symbols representing the specific type of variable parsed? If so, we don't have much to do. I guess I don't understand why the existing SH GUI wasn't finished with all the hard stuff done under the hood.

Shaping avatar Aug 06 '22 14:08 Shaping