A better IDE
This commit is contained in:
@@ -21,6 +21,11 @@ CarpExpressionNode >> isDefinition [
|
||||
^ false
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
CarpExpressionNode >> isDefinitionPredicate [
|
||||
^ false
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
CarpExpressionNode >> isQuoted [
|
||||
^ parent ifNil: [ false ] ifNotNil: [ parent isQuoted ]
|
||||
|
@@ -51,8 +51,18 @@ CarpListNode >> initialize [
|
||||
|
||||
{ #category : #accessing }
|
||||
CarpListNode >> intoModel [
|
||||
^ CarpList
|
||||
contents: (expressions collect: #intoModel)
|
||||
^ self isDefinition
|
||||
ifTrue: [ | binding |
|
||||
binding := (CarpBinding perform: self expressions first value source asSymbol)
|
||||
name: self definitionVariable intoModel.
|
||||
self expressions size = 3
|
||||
ifTrue: [ binding binding: self expressions third intoModel ].
|
||||
self expressions size = 4
|
||||
ifTrue: [ binding
|
||||
arguments: self expressions third intoModel;
|
||||
body: self expressions fourth intoModel ].
|
||||
binding ]
|
||||
ifFalse: [ CarpList contents: (expressions collect: #intoModel) ]
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
|
@@ -7,6 +7,31 @@ Class {
|
||||
#category : #'Carp-IDE'
|
||||
}
|
||||
|
||||
{ #category : #'instance creation' }
|
||||
CarpBinding class >> def [
|
||||
^ CarpStaticVariable new
|
||||
]
|
||||
|
||||
{ #category : #'instance creation' }
|
||||
CarpBinding class >> defdynamic [
|
||||
^ CarpDynamicVariable new
|
||||
]
|
||||
|
||||
{ #category : #'instance creation' }
|
||||
CarpBinding class >> defmacro [
|
||||
^ CarpMacro new
|
||||
]
|
||||
|
||||
{ #category : #'instance creation' }
|
||||
CarpBinding class >> defn [
|
||||
^ CarpStaticFunction new
|
||||
]
|
||||
|
||||
{ #category : #'instance creation' }
|
||||
CarpBinding class >> defndynamic [
|
||||
^ CarpDynamicFunction new
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
CarpBinding >> bindingName [
|
||||
^ self subclassResponsibility
|
||||
|
@@ -14,9 +14,13 @@ CarpExpression >> asElement [
|
||||
|
||||
{ #category : #accessing }
|
||||
CarpExpression >> asElementWithModule: aModule [
|
||||
^ ((GtCarpIDECoderModel code: self toCarp)
|
||||
| applicationStrategy |
|
||||
applicationStrategy := LeCarpApplicationStrategy new.
|
||||
^ (GtExpandableSourceCoderElement new
|
||||
coderViewModel: ((GtCarpIDECoderModel code: self toCarp)
|
||||
module: aModule;
|
||||
expression: self) asElement
|
||||
carpLinkApplicationStrategy: applicationStrategy;
|
||||
expression: self) asCoderViewModel) collapse
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
|
@@ -84,6 +84,7 @@ CarpModule >> carpCoderStreamingMethodsFor: aView context: aPhlowContext [
|
||||
ifNotNil: [ :aContents | aNewMethodCoderViewModel := aContents ]
|
||||
ifNil: [ aNewMethodCoder := GtCarpNewFunctionCoderModel new
|
||||
module: self;
|
||||
carpLinkApplicationStrategy: LeCarpApplicationStrategy new;
|
||||
onSave: [ aButton fireEvent: BrDropdownHideWish new.
|
||||
coderElement initializeForModule ].
|
||||
|
||||
|
@@ -12,6 +12,18 @@ Class {
|
||||
#category : #'Carp-Coder'
|
||||
}
|
||||
|
||||
{ #category : #accessing }
|
||||
CarpModuleCoderElement >> build [
|
||||
| application commandFactory |
|
||||
application := CarpApplication uniqueInstance.
|
||||
application isRunning ifFalse: [ application start ].
|
||||
commandFactory := application newCommandFactory.
|
||||
|
||||
^ commandFactory
|
||||
<< self module toCarp;
|
||||
sendAndWait
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
CarpModuleCoderElement >> buildContentPane [
|
||||
|
||||
@@ -91,6 +103,13 @@ CarpModuleCoderElement >> buildModuleLabel [
|
||||
action: [ :aButton |
|
||||
aButton phlow spawnObject: self module toCarp ]).
|
||||
|
||||
aContainer addChild: (BrButton new
|
||||
aptitude: BrGlamorousButtonWithIconAptitude;
|
||||
icon: BrGlamorousVectorIcons refresh;
|
||||
beSmallSize;
|
||||
label: 'Build';
|
||||
action: [ self build ]).
|
||||
|
||||
^ aContainer
|
||||
]
|
||||
|
||||
@@ -133,7 +152,8 @@ CarpModuleCoderElement >> coderViewModel: aCarpCoderViewModel [
|
||||
|
||||
container ifNotNil: #removeFromParent.
|
||||
container := self buildContentPane.
|
||||
self addChildFirst: container
|
||||
self addChildFirst: container.
|
||||
self build
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
|
@@ -23,6 +23,11 @@ CarpSequence >> contents: aCollection [
|
||||
contents := aCollection
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
CarpSequence >> do: aBlock [
|
||||
contents do: aBlock
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
CarpSequence >> open [
|
||||
^ self subclassResponsibility
|
||||
|
@@ -12,6 +12,11 @@ CarpSymbol class >> named: aString [
|
||||
^ self new name: aString
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
CarpSymbol >> name [
|
||||
^ name
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
CarpSymbol >> name: aString [
|
||||
name := aString
|
||||
|
@@ -7,6 +7,12 @@ Class {
|
||||
#category : #'Carp-Coder'
|
||||
}
|
||||
|
||||
{ #category : #accessing }
|
||||
GtCarpIDECoderModel >> collapsedTextPromise [
|
||||
^ self expression name name , ' : '
|
||||
, (self bindAndExecute: '(type ' , module name, '.', self expression name name , ')') value
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
GtCarpIDECoderModel >> expression [
|
||||
^ expression
|
||||
@@ -30,7 +36,8 @@ GtCarpIDECoderModel >> initializeAddOns: addOns [
|
||||
|
||||
{ #category : #accessing }
|
||||
GtCarpIDECoderModel >> remove [
|
||||
^ module removeExpression: self expression
|
||||
module removeExpression: self expression.
|
||||
self bindAndExecute: module toCarp
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
@@ -38,5 +45,6 @@ GtCarpIDECoderModel >> save [
|
||||
module removeExpression: expression.
|
||||
module
|
||||
addExpression: (CarpParser parse: sourceCode availableSource text) intoModel.
|
||||
self bindAndExecute: module toCarp.
|
||||
onSave ifNotNil: [ onSave value ]
|
||||
]
|
||||
|
@@ -10,14 +10,11 @@ Class {
|
||||
|
||||
{ #category : #accessing }
|
||||
GtCarpNewFunctionCoderModel >> initializeAddOns: addOns [
|
||||
super initializeAddOns: addOns.
|
||||
|
||||
addOns
|
||||
addMainAction: 'Save' translated
|
||||
icon: BrGlamorousVectorIcons accept
|
||||
action: [ :aCoderUIModel :anElement |
|
||||
self save ]
|
||||
id: GtMethodCoderSaveActionId.
|
||||
action: [ :aCoderUIModel :anElement | self save ]
|
||||
id: GtMethodCoderSaveActionId
|
||||
]
|
||||
|
||||
{ #category : #coders }
|
||||
@@ -32,6 +29,9 @@ GtCarpNewFunctionCoderModel >> onSave: aBlock [
|
||||
|
||||
{ #category : #accessing }
|
||||
GtCarpNewFunctionCoderModel >> save [
|
||||
module addExpression: (CarpParser parse: sourceCode currentSourceText value text) intoModel.
|
||||
| expression |
|
||||
expression := (CarpParser parse: sourceCode currentSourceText value text) intoModel.
|
||||
module addExpression: expression.
|
||||
self bindAndExecute: module toCarp.
|
||||
onSave ifNotNil: [ onSave value ]
|
||||
]
|
||||
|
@@ -13,9 +13,8 @@ LeCarpApplicationStrategy class >> strategyName [
|
||||
{ #category : #accessing }
|
||||
LeCarpApplicationStrategy >> applicationServer [
|
||||
|
||||
content database isDatabase ifFalse: [ ^ nil ].
|
||||
CarpApplication uniqueInstance ifNil:
|
||||
[ CarpApplication uniqueInstance: (self newCarpApplicationFor: content database) ].
|
||||
[ CarpApplication uniqueInstance: self newCarpApplication ].
|
||||
^ CarpApplication uniqueInstance
|
||||
]
|
||||
|
||||
@@ -31,10 +30,10 @@ LeCarpApplicationStrategy >> applicationSettings [
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
LeCarpApplicationStrategy >> newCarpApplicationFor: aLeDatabase [
|
||||
LeCarpApplicationStrategy >> newCarpApplication [
|
||||
|
||||
^ CarpApplication new initializeWith:
|
||||
(self updatedSettings: LanguageLinkSettings carpDefaultSettings).
|
||||
(self updatedSettings: LanguageLinkSettings carpDefaultSettings)
|
||||
|
||||
]
|
||||
|
||||
|
Reference in New Issue
Block a user