Skip to content

Commit

Permalink
dc: add support for updating while typing
Browse files Browse the repository at this point in the history
  • Loading branch information
tom95 committed Oct 2, 2023
1 parent 6ce78c0 commit 3bb38d3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
25 changes: 17 additions & 8 deletions packages/DomainCode-Parser/DCBlock.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ DCBlock class >> smalltalkMessageSendSelector [
{ #category : #smalltalk }
DCBlock class >> smalltalkUndeclaredVariable [
<query: #change>
<query: #type>
^ {
[:x | x language = SBTSSmalltalk].
Expand Down Expand Up @@ -447,7 +447,8 @@ DCBlock >> deleteAfterCursor [
self
deleteFrom: source
at: cursorIndex + 1
do: [:new :edit | apply value: new value: edit value: cursorIndex]]
do: [:new :edit | apply value: new value: edit value: cursorIndex]].
self batchedChangeStep
]
{ #category : #'as yet unclassified' }
Expand All @@ -458,7 +459,8 @@ DCBlock >> deleteBeforeCursor [
self
deleteFrom: source
at: cursorIndex
do: [:new :edit | apply value: new value: edit value: cursorIndex - 1]]
do: [:new :edit | apply value: new value: edit value: cursorIndex - 1]].
self batchedChangeStep
]
{ #category : #'text modify' }
Expand Down Expand Up @@ -732,7 +734,13 @@ DCBlock >> intoWorld: aWorld [
when: #selectionChanged
send: #updateSelectionQueries
to: self queryState.
self queryState updateChangeQueries]
self sandblockEditor
when: #batchedChange
send: #updateTypeQueries
to: self queryState.
self queryState
updateTypeQueries;
updateChangeQueries]
]
{ #category : #'as yet unclassified' }
Expand Down Expand Up @@ -798,13 +806,14 @@ DCBlock >> keyStroke: anEvent [
insert: text
in: source
at: cursorIndex + 1
do: [:new :edit | apply value: new value: edit value: cursorIndex + 1]]]]
do: [:new :edit | apply value: new value: edit value: cursorIndex + 1]]]].
self batchedChangeStep
]
{ #category : #'as yet unclassified' }
DCBlock >> language [
^ language ifNil: [self owner language]
^ language ifNil: [self owner ifNotNil: #language]
]
{ #category : #'as yet unclassified' }
Expand Down Expand Up @@ -895,8 +904,8 @@ DCBlock >> outOfWorld: aWorld [
self isRootBlock ifTrue: [
self sandblockEditor
removeActionsWithReceiver: self queryState
forEvent: #selectionChanged]
removeActionsWithReceiver: self queryState forEvent: #selectionChanged;
removeActionsWithReceiver: self queryState forEvent: #batchedChange]
]
{ #category : #'as yet unclassified' }
Expand Down
10 changes: 9 additions & 1 deletion packages/DomainCode-Parser/DCQueryState.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ DCQueryState >> initialize [
currentDecorators := Dictionary new
at: #selection put: WeakKeyDictionary new;
at: #change put: WeakKeyDictionary new;
at: #type put: WeakKeyDictionary new;
yourself.
updateQueued := Dictionary new
]
Expand Down Expand Up @@ -97,7 +98,8 @@ DCQueryState >> tryShortcut: aSymbol do: aBlock [
{ #category : #'as yet unclassified' }
DCQueryState >> updateChangeQueries [

self updateQueriesFor: #change
self updateQueriesFor: #change.
self updateTypeQueries
]

{ #category : #'as yet unclassified' }
Expand All @@ -118,3 +120,9 @@ DCQueryState >> updateSelectionQueries [

self updateQueriesFor: #selection
]

{ #category : #'as yet unclassified' }
DCQueryState >> updateTypeQueries [

self updateQueriesFor: #type
]

0 comments on commit 3bb38d3

Please sign in to comment.