From e29057d661e57e92adc4e4f2022cb5205a53b503 Mon Sep 17 00:00:00 2001 From: Marcus Denker Date: Tue, 3 Oct 2023 14:43:47 +0200 Subject: [PATCH] fix a isForWorkspace: send --- .../SpMorphicCodeAdapter.class.st | 80 +++++++++---------- .../SpMorphicCodeCompletionEngine.class.st | 35 ++++---- .../SpMorphicCodeTextStyler.class.st | 17 ++-- src/Spec2-Code-Morphic/package.st | 2 +- 4 files changed, 68 insertions(+), 66 deletions(-) diff --git a/src/Spec2-Code-Morphic/SpMorphicCodeAdapter.class.st b/src/Spec2-Code-Morphic/SpMorphicCodeAdapter.class.st index bd34c8fd9..9117cdc64 100644 --- a/src/Spec2-Code-Morphic/SpMorphicCodeAdapter.class.st +++ b/src/Spec2-Code-Morphic/SpMorphicCodeAdapter.class.st @@ -1,10 +1,11 @@ Class { - #name : #SpMorphicCodeAdapter, - #superclass : #SpMorphicTextAdapter, - #category : #'Spec2-Code-Morphic' + #name : 'SpMorphicCodeAdapter', + #superclass : 'SpMorphicTextAdapter', + #category : 'Spec2-Code-Morphic', + #package : 'Spec2-Code-Morphic' } -{ #category : #initialization } +{ #category : 'initialization' } SpMorphicCodeAdapter >> addKeyBindingsTo: aMorph [ super addKeyBindingsTo: aMorph. @@ -15,19 +16,19 @@ SpMorphicCodeAdapter >> addKeyBindingsTo: aMorph [ toAction: each action ] ] ] -{ #category : #'widget API' } +{ #category : 'widget API' } SpMorphicCodeAdapter >> behavior [ ^ self presenter behavior ] -{ #category : #'private - shout' } +{ #category : 'private - shout' } SpMorphicCodeAdapter >> bindingOf: aString [ ^ self presenter bindingOf: aString ] -{ #category : #factory } +{ #category : 'factory' } SpMorphicCodeAdapter >> buildWidget [ | newWidget | @@ -52,7 +53,7 @@ SpMorphicCodeAdapter >> buildWidget [ ^ newWidget ] -{ #category : #private } +{ #category : 'private' } SpMorphicCodeAdapter >> changeLineNumbers: hasLineNumbers to: aMorph [ hasLineNumbers @@ -60,7 +61,7 @@ SpMorphicCodeAdapter >> changeLineNumbers: hasLineNumbers to: aMorph [ ifFalse: [ aMorph withoutLineNumbers ] ] -{ #category : #'private - shout' } +{ #category : 'private - shout' } SpMorphicCodeAdapter >> classOrMetaClass: aClass [ self suspendObservedPropertiesWhile: [ @@ -70,7 +71,7 @@ SpMorphicCodeAdapter >> classOrMetaClass: aClass [ forScripting: self isScripting ] ] -{ #category : #private } +{ #category : 'private' } SpMorphicCodeAdapter >> computeOriginFor: aMorph [ | desiredTop desiredLeft | @@ -82,50 +83,50 @@ SpMorphicCodeAdapter >> computeOriginFor: aMorph [ ^ desiredLeft @ desiredTop ] -{ #category : #'widget API' } +{ #category : 'widget API' } SpMorphicCodeAdapter >> doItContext [ ^ self presenter doItContext ] -{ #category : #'widget API' } +{ #category : 'widget API' } SpMorphicCodeAdapter >> doItReceiver [ ^ self presenter doItReceiver ] -{ #category : #NOCompletion } +{ #category : 'NOCompletion' } SpMorphicCodeAdapter >> guessTypeForName: aString [ ^nil ] -{ #category : #'private - shout' } +{ #category : 'private - shout' } SpMorphicCodeAdapter >> hasBindingOf: aString [ ^ self presenter hasBindingOf: aString ] -{ #category : #testing } +{ #category : 'testing' } SpMorphicCodeAdapter >> hasSmartCharacters [ ^ self presenter hasSmartCharacters ] -{ #category : #private } +{ #category : 'private' } SpMorphicCodeAdapter >> hasSyntaxHighlight [ ^ self presenter hasSyntaxHighlight ] -{ #category : #private } +{ #category : 'private' } SpMorphicCodeAdapter >> hasSyntaxHighlightEnabled [ "this is used just for testing" ^ self presenter hasSyntaxHighlight ] -{ #category : #'widget API' } +{ #category : 'widget API' } SpMorphicCodeAdapter >> insertPopoverAfterCurrentSelection: aPresenter style: styleName [ | popover pos | @@ -147,7 +148,7 @@ SpMorphicCodeAdapter >> insertPopoverAfterCurrentSelection: aPresenter style: st popover takeKeyboardFocus ] ] -{ #category : #'widget API' } +{ #category : 'widget API' } SpMorphicCodeAdapter >> interactionModel: anInteractionModel [ self classOrMetaClass: anInteractionModel behavior. @@ -155,13 +156,13 @@ SpMorphicCodeAdapter >> interactionModel: anInteractionModel [ self setInteractionModel: anInteractionModel to: w ] ] -{ #category : #'widget API' } +{ #category : 'widget API' } SpMorphicCodeAdapter >> isScripting [ ^ self presenter isScripting ] -{ #category : #private } +{ #category : 'private' } SpMorphicCodeAdapter >> newCompletionEngine: anInteractionModel [ ^ SpMorphicCodeCompletionEngine new @@ -173,7 +174,7 @@ SpMorphicCodeAdapter >> newCompletionEngine: anInteractionModel [ yourself ] -{ #category : #private } +{ #category : 'private' } SpMorphicCodeAdapter >> originMorphFor: aMorph [ (aMorph textArea hasSelection not and: [ @@ -182,32 +183,32 @@ SpMorphicCodeAdapter >> originMorphFor: aMorph [ ^ aMorph textArea cursor ] -{ #category : #NOCompletion } +{ #category : 'NOCompletion' } SpMorphicCodeAdapter >> receiverClass [ ^ self behavior ] -{ #category : #'widget API' } +{ #category : 'widget API' } SpMorphicCodeAdapter >> refreshStyling [ self presenter hasSyntaxHighlight ifFalse: [ ^ self ]. self widgetDo: [ :w | w textArea shoutStyler refreshStyling ] ] -{ #category : #'widget API' } +{ #category : 'widget API' } SpMorphicCodeAdapter >> selectedBehavior [ ^ self presenter selectedBehavior ] -{ #category : #NOCompletion } +{ #category : 'NOCompletion' } SpMorphicCodeAdapter >> selectedClassOrMetaClass [ ^ self behavior ] -{ #category : #private } +{ #category : 'private' } SpMorphicCodeAdapter >> setEditingModeFor: textArea [ self hasSyntaxHighlight @@ -221,38 +222,37 @@ SpMorphicCodeAdapter >> setEditingModeFor: textArea [ super setEditingModeFor: textArea ] ] -{ #category : #private } +{ #category : 'private' } SpMorphicCodeAdapter >> setEditingModeFor: textArea withBehavior: aBehavior forScripting: aBoolean [ textArea model: self. - (aBoolean or: [ aBehavior isNil ]) - ifTrue: [ + (aBoolean or: [ aBehavior isNil ]) + ifTrue: [ textArea beForSmalltalkScripting. textArea editingMode classOrMetaClass: aBehavior ] - ifFalse: [ - textArea beForSmalltalkCodeInClass: aBehavior ]. + ifFalse: [ textArea beForSmalltalkCodeInClass: aBehavior ]. "Following code should bring correct requestor (a code presenter) with a proper code interaction model into styler to enable a visibility of external variables (like workspace variables)" - textArea shoutStyler styler - isForWorkspace: aBoolean; + textArea shoutStyler styler + isScripting: aBoolean; workspace: self presenter. textArea shoutStyler refreshStyling ] -{ #category : #'widget API' } +{ #category : 'widget API' } SpMorphicCodeAdapter >> setInteractionModel: anInteractionModel to: w [ w textArea editor isSmalltalkEditor ifFalse: [ ^ self ]. w completionEngine: (self newCompletionEngine: anInteractionModel) ] -{ #category : #private } +{ #category : 'private' } SpMorphicCodeAdapter >> setSmartCharactersFor: aWidget [ self suspendObservedPropertiesWhile: [ aWidget textArea editor completionEngine smartCharacters: self hasSmartCharacters ] ] -{ #category : #private } +{ #category : 'private' } SpMorphicCodeAdapter >> setSyntaxHighlightThemeFor: textArea [ | theme | @@ -264,7 +264,7 @@ SpMorphicCodeAdapter >> setSyntaxHighlightThemeFor: textArea [ refreshStyling ] -{ #category : #private } +{ #category : 'private' } SpMorphicCodeAdapter >> suspendObservedPropertiesWhile: aBlock [ | textHolder textSubscriptions | @@ -275,7 +275,7 @@ SpMorphicCodeAdapter >> suspendObservedPropertiesWhile: aBlock [ textHolder subscriptions: textSubscriptions ] ] -{ #category : #private } +{ #category : 'private' } SpMorphicCodeAdapter >> textWithStyle [ "This method is to be used for testing. DO NOT USE IT!" @@ -283,7 +283,7 @@ SpMorphicCodeAdapter >> textWithStyle [ ^ self widget getText ] -{ #category : #'widget API' } +{ #category : 'widget API' } SpMorphicCodeAdapter >> userActionDuring: aBlock [ aBlock value diff --git a/src/Spec2-Code-Morphic/SpMorphicCodeCompletionEngine.class.st b/src/Spec2-Code-Morphic/SpMorphicCodeCompletionEngine.class.st index 57fcfd2c2..2312aa996 100644 --- a/src/Spec2-Code-Morphic/SpMorphicCodeCompletionEngine.class.st +++ b/src/Spec2-Code-Morphic/SpMorphicCodeCompletionEngine.class.st @@ -9,8 +9,8 @@ I can have several configurations: " Class { - #name : #SpMorphicCodeCompletionEngine, - #superclass : #CompletionEngine, + #name : 'SpMorphicCodeCompletionEngine', + #superclass : 'CompletionEngine', #instVars : [ 'scripting', 'completionClass', @@ -19,89 +19,90 @@ Class { 'completionBuilder', 'smartCharacters' ], - #category : #'Spec2-Code-Morphic' + #category : 'Spec2-Code-Morphic', + #package : 'Spec2-Code-Morphic' } -{ #category : #accessing } +{ #category : 'accessing' } SpMorphicCodeCompletionEngine >> completionBuilder [ ^ completionBuilder ifNil: [ CoASTHeuristicsResultSetBuilder new ] ] -{ #category : #accessing } +{ #category : 'accessing' } SpMorphicCodeCompletionEngine >> completionBuilder: anObject [ completionBuilder := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } SpMorphicCodeCompletionEngine >> completionClass [ ^ completionClass ] -{ #category : #accessing } +{ #category : 'accessing' } SpMorphicCodeCompletionEngine >> completionClass: anObject [ completionClass := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } SpMorphicCodeCompletionEngine >> doItContext [ ^ doItContext ] -{ #category : #accessing } +{ #category : 'accessing' } SpMorphicCodeCompletionEngine >> doItContext: aContext [ doItContext := aContext ] -{ #category : #accessing } +{ #category : 'accessing' } SpMorphicCodeCompletionEngine >> doItRequestor [ ^ doItRequestor ] -{ #category : #accessing } +{ #category : 'accessing' } SpMorphicCodeCompletionEngine >> doItRequestor: aRequestor [ doItRequestor := aRequestor ] -{ #category : #initialization } +{ #category : 'initialization' } SpMorphicCodeCompletionEngine >> initialize [ super initialize. contextClass := CoCompletionContext ] -{ #category : #testing } +{ #category : 'testing' } SpMorphicCodeCompletionEngine >> isScripting [ ^ scripting ] -{ #category : #accessing } +{ #category : 'accessing' } SpMorphicCodeCompletionEngine >> scripting: aBoolean [ scripting := aBoolean ] -{ #category : #accessing } +{ #category : 'accessing' } SpMorphicCodeCompletionEngine >> smartCharacters [ ^ smartCharacters ifNil: [ super smartCharacters ] ] -{ #category : #accessing } +{ #category : 'accessing' } SpMorphicCodeCompletionEngine >> smartCharacters: aBoolean [ smartCharacters := aBoolean ] -{ #category : #accessing } +{ #category : 'accessing' } SpMorphicCodeCompletionEngine >> variableBindingNames [ ^ self doItRequestor variableBindingNames diff --git a/src/Spec2-Code-Morphic/SpMorphicCodeTextStyler.class.st b/src/Spec2-Code-Morphic/SpMorphicCodeTextStyler.class.st index 53e49044b..d5f6f1f05 100644 --- a/src/Spec2-Code-Morphic/SpMorphicCodeTextStyler.class.st +++ b/src/Spec2-Code-Morphic/SpMorphicCodeTextStyler.class.st @@ -1,19 +1,20 @@ Class { - #name : #SpMorphicCodeTextStyler, - #superclass : #SHRBTextStyler, + #name : 'SpMorphicCodeTextStyler', + #superclass : 'SHRBTextStyler', #instVars : [ 'attributeTable' ], - #category : #'Spec2-Code-Morphic' + #category : 'Spec2-Code-Morphic', + #package : 'Spec2-Code-Morphic' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } SpMorphicCodeTextStyler class >> new [ ^ self newWithAttributeTable: self styleTable ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } SpMorphicCodeTextStyler class >> newWithAttributeTable: attrTable [ ^ self basicNew @@ -21,19 +22,19 @@ SpMorphicCodeTextStyler class >> newWithAttributeTable: attrTable [ yourself ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } SpMorphicCodeTextStyler class >> newWithAttributeTableNamed: aString [ ^ self newWithAttributeTable: (self newAttributesForStyleTableNamed: aString) ] -{ #category : #private } +{ #category : 'private' } SpMorphicCodeTextStyler >> attributesFor: aSymbol [ ^ attributeTable at: aSymbol ifAbsent: [ #() ] ] -{ #category : #initialization } +{ #category : 'initialization' } SpMorphicCodeTextStyler >> initializeAttributeTable: attrTable [ attributeTable := attrTable. diff --git a/src/Spec2-Code-Morphic/package.st b/src/Spec2-Code-Morphic/package.st index d3c0dd321..a646a6f45 100644 --- a/src/Spec2-Code-Morphic/package.st +++ b/src/Spec2-Code-Morphic/package.st @@ -1 +1 @@ -Package { #name : #'Spec2-Code-Morphic' } +Package { #name : 'Spec2-Code-Morphic' }