A new version of ShoutCore was added to project The Inbox:
http://source.squeak.org/inbox/ShoutCore-kfr.55.mcz ==================== Summary ==================== Name: ShoutCore-kfr.55 Author: kfr Time: 6 January 2016, 8:49:46.186914 pm UUID: bd33aa70-60b2-48ee-adee-31db9e5d3ab7 Ancestors: ShoutCore-ul.54 Add preference to turn syntax highlighting on or off =============== Diff against ShoutCore-ul.54 =============== Item was changed: SHTextStyler subclass: #SHTextStylerST80 instanceVariableNames: 'classOrMetaClass workspace font parser formatAssignments environment sourceMap processedSourceMap pixelHeight attributesByPixelHeight parseAMethod' + classVariableNames: 'SubduedSyntaxHighlights SyntaxHighlighting SyntaxHighlightingAsYouType SyntaxHighlightingAsYouTypeAnsiAssignment SyntaxHighlightingAsYouTypeLeftArrowAssignment' - classVariableNames: 'SubduedSyntaxHighlights SyntaxHighlightingAsYouType SyntaxHighlightingAsYouTypeAnsiAssignment SyntaxHighlightingAsYouTypeLeftArrowAssignment' poolDictionaries: '' category: 'ShoutCore-Styling'! SHTextStylerST80 class instanceVariableNames: 'styleTable textAttributesByPixelHeight'! !SHTextStylerST80 commentStamp: 'tween 8/27/2004 10:55' prior: 0! I style Smalltalk methods and expressions. My 'styleTable' class instance var holds an array ofArrays which control how each token is styled/coloured. See my defaultStyleTable class method for its structure. My styleTable can be changed by either modifying the defaultStyleTable class method and then executing SHTextStylerST80 initialize ; or by giving me a new styleTable through my #styleTable: class method. My 'textAttributesByPixelSize' class instance var contains a dictionary of dictionaries. The key is a pixelSize and the value a Dictionary from token type Symbol to TextAttribute array. It is created/maintained automatically. I also install these 3 preferences when my class initialize method is executed.... #syntaxHighlightingAsYouType - controls whether methods are styled in browsers #syntaxHighlightingAsYouTypeAnsiAssignment - controls whether assignments are formatted to be := #syntaxHighlightingAsYouTypeLeftArrowAssignment - controls whether assignments are formatted to be _ I reimplement #unstyledTextFrom: so that TextActions are preserved in the unstyled text ! SHTextStylerST80 class instanceVariableNames: 'styleTable textAttributesByPixelHeight'! Item was added: + ----- Method: SHTextStylerST80 class>>syntaxHighlighting (in category 'preferences') ----- + syntaxHighlighting + <preference: 'syntaxHighlighting' + category: 'browsing' + description: 'Enable, or disable, Shout - Syntax Highlighting. When enabled, code in Browsers and Workspaces is styled to reveal its syntactic structure.' + type: #Boolean> + ^SyntaxHighlighting ifNil: [true]! Item was added: + ----- Method: SHTextStylerST80 class>>syntaxHighlighting: (in category 'preferences') ----- + syntaxHighlighting: aBoolean + SyntaxHighlighting := aBoolean.! |
There's already such preference, which does exactly the same thing. It's
called #syntaxHighlightingAsYouType. It looks like its senders have been removed from the image for some reason. Levente On Sat, 9 Jan 2016, [hidden email] wrote: > A new version of ShoutCore was added to project The Inbox: > http://source.squeak.org/inbox/ShoutCore-kfr.55.mcz > > ==================== Summary ==================== > > Name: ShoutCore-kfr.55 > Author: kfr > Time: 6 January 2016, 8:49:46.186914 pm > UUID: bd33aa70-60b2-48ee-adee-31db9e5d3ab7 > Ancestors: ShoutCore-ul.54 > > Add preference to turn syntax highlighting on or off > > =============== Diff against ShoutCore-ul.54 =============== > > Item was changed: > SHTextStyler subclass: #SHTextStylerST80 > instanceVariableNames: 'classOrMetaClass workspace font parser formatAssignments environment sourceMap processedSourceMap pixelHeight attributesByPixelHeight parseAMethod' > + classVariableNames: 'SubduedSyntaxHighlights SyntaxHighlighting SyntaxHighlightingAsYouType SyntaxHighlightingAsYouTypeAnsiAssignment SyntaxHighlightingAsYouTypeLeftArrowAssignment' > - classVariableNames: 'SubduedSyntaxHighlights SyntaxHighlightingAsYouType SyntaxHighlightingAsYouTypeAnsiAssignment SyntaxHighlightingAsYouTypeLeftArrowAssignment' > poolDictionaries: '' > category: 'ShoutCore-Styling'! > SHTextStylerST80 class > instanceVariableNames: 'styleTable textAttributesByPixelHeight'! > > !SHTextStylerST80 commentStamp: 'tween 8/27/2004 10:55' prior: 0! > I style Smalltalk methods and expressions. > > My 'styleTable' class instance var holds an array ofArrays which control how each token is styled/coloured. See my defaultStyleTable class method for its structure. > My styleTable can be changed by either modifying the defaultStyleTable class method and then executing SHTextStylerST80 initialize ; or by giving me a new styleTable through my #styleTable: class method. > > My 'textAttributesByPixelSize' class instance var contains a dictionary of dictionaries. > The key is a pixelSize and the value a Dictionary from token type Symbol to TextAttribute array. > It is created/maintained automatically. > > I also install these 3 preferences when my class initialize method is executed.... > #syntaxHighlightingAsYouType - controls whether methods are styled in browsers > #syntaxHighlightingAsYouTypeAnsiAssignment - controls whether assignments are formatted to be := > #syntaxHighlightingAsYouTypeLeftArrowAssignment - controls whether assignments are formatted to be _ > > I reimplement #unstyledTextFrom: so that TextActions are preserved in the unstyled text > > > > > > > ! > SHTextStylerST80 class > instanceVariableNames: 'styleTable textAttributesByPixelHeight'! > > Item was added: > + ----- Method: SHTextStylerST80 class>>syntaxHighlighting (in category 'preferences') ----- > + syntaxHighlighting > + <preference: 'syntaxHighlighting' > + category: 'browsing' > + description: 'Enable, or disable, Shout - Syntax Highlighting. When enabled, code in Browsers and Workspaces is styled to reveal its syntactic structure.' > + type: #Boolean> > + ^SyntaxHighlighting ifNil: [true]! > > Item was added: > + ----- Method: SHTextStylerST80 class>>syntaxHighlighting: (in category 'preferences') ----- > + syntaxHighlighting: aBoolean > + SyntaxHighlighting := aBoolean.! > > > |
Ok, I thought syntaxHighlightingAsYouType was more of a dynamic preference that redid the syntax while typing. Anyway, there seem to be a old method that survived copying over to PluggableTextMorphPlus ----- Method: PluggableShoutMorph>>okToStyle (in category 'styler') ----- okToStyle styler ifNil:[^false]. Preferences syntaxHighlightingAsYouType ifFalse: [^false]. (model respondsTo: #shoutAboutToStyle: ) ifFalse:[^true]. ^model shoutAboutToStyle: self! Best, Karl On Sat, Jan 9, 2016 at 9:43 PM, Levente Uzonyi <[hidden email]> wrote: There's already such preference, which does exactly the same thing. It's called #syntaxHighlightingAsYouType. |
Free forum by Nabble | Edit this page |