Keep (highlighter) source in ParseTreeIndex
This is usefull for inspecting tree index.
--- a/SmallSense__CodeHighlightingService.st Tue Apr 08 21:46:51 2014 +0200
+++ b/SmallSense__CodeHighlightingService.st Wed Apr 09 09:58:54 2014 +0200
@@ -391,9 +391,13 @@
newCode notNil ifTrue:[
"textView" modified ifFalse:[
newCode ~= oldCodeList ifTrue:[
+ | newCodeText |
+
+ newCodeText := newCode.
newCode := newCode asStringCollection.
"textView" modified ifFalse:[
done := true.
+ elements source: newCodeText.
textView notNil ifTrue:[
"/ must add this event - and not been interrupted
"/ by any arriving key-event.
@@ -420,7 +424,7 @@
]
"Created: / 03-08-2013 / 11:11:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 17-12-2013 / 22:27:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 09-04-2014 / 09:50:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CodeHighlightingService class methodsFor:'documentation'!
--- a/SmallSense__ParseNodeInspector.st Tue Apr 08 21:46:51 2014 +0200
+++ b/SmallSense__ParseNodeInspector.st Wed Apr 09 09:58:54 2014 +0200
@@ -427,8 +427,7 @@
parseTree
- ^self
- aspectAt: #parseTree
+ ^self builder bindings at: #parseTree
ifAbsentPut:
[PluggableAdaptor on: self nodeHolder getter:
[:m|
@@ -446,12 +445,12 @@
"Created: / 28-03-2007 / 15:58:31 / janfrog"
"Modified: / 31-10-2007 / 12:11:46 / janfrog"
"Created: / 14-09-2011 / 17:24:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 09-04-2014 / 09:35:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
selectionHolder
- ^self
- aspectAt: #selectionHolder
+ ^self builder bindings at: #selectionHolder
ifAbsentPut:
[nil asValue
onChangeSend:#updateSourceViewSelection to:self;
@@ -461,6 +460,7 @@
"Created: / 28-03-2007 / 16:46:30 / janfrog"
"Modified: / 31-10-2007 / 12:25:54 / janfrog"
"Created: / 14-09-2011 / 17:24:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 09-04-2014 / 09:35:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
sourceHolder
@@ -611,16 +611,18 @@
!
label
- | label |
- label := self ivarName ,' <', self astNodeName, '>'.
- (astNode startPosition isNil or:[astNode endPosition isNil]) ifTrue:[
+ | label start stop |
+ label := self ivarName ,' {', self astNodeName, '}'.
+ ((start := astNode startPosition) isNil or:[(stop := astNode endPosition) isNil]) ifTrue:[
label := label asText colorizeAllWith: Color red.
+ ] ifFalse:[
+ label := label , ' [' , start printString , '..' , stop printString , ']'
].
^ label
"Created: / 28-03-2007 / 15:53:18 / janfrog"
"Modified: / 12-04-2007 / 11:30:23 / janfrog"
- "Modified: / 19-09-2013 / 18:24:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 09-04-2014 / 09:39:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
node
--- a/SmallSense__ParseTreeIndex.st Tue Apr 08 21:46:51 2014 +0200
+++ b/SmallSense__ParseTreeIndex.st Wed Apr 09 09:58:54 2014 +0200
@@ -14,7 +14,7 @@
"{ NameSpace: SmallSense }"
SortedCollection subclass:#ParseTreeIndex
- instanceVariableNames:'tree'
+ instanceVariableNames:'tree source'
classVariableNames:''
poolDictionaries:''
category:'SmallSense-Core-Index'
@@ -82,6 +82,14 @@
"Created: / 20-10-2013 / 01:02:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+source
+ ^ source
+!
+
+source:something
+ source := something.
+!
+
tree
^ tree
!
@@ -90,6 +98,24 @@
tree := aParseNode.
! !
+!ParseTreeIndex methodsFor:'inspecting'!
+
+inspector2TabTreeInspector
+ ^ self newInspector2Tab
+ label: 'Parse Tree';
+ priority: 35;
+ application: [ SmallSense::ParseNodeInspector new node: tree source: source ]
+ yourself
+
+ "Created: / 09-04-2014 / 09:31:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+inspector2Tabs
+ ^ super inspector2Tabs , #(inspector2TabTreeInspector)
+
+ "Created: / 09-04-2014 / 09:32:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!ParseTreeIndex methodsFor:'utilities'!
newElementFor: aParseNode
--- a/SmallSense__SmalltalkCompletionEngine.st Tue Apr 08 21:46:51 2014 +0200
+++ b/SmallSense__SmalltalkCompletionEngine.st Wed Apr 09 09:58:54 2014 +0200
@@ -244,7 +244,7 @@
"/ then, if the prefix is at least 3 chars,
"/ also add methods with that prefix.
- ((type classes size > 6) and:[ prefix > 2 ]) ifTrue:[
+ ((type classes size > 6) and:[ prefix size > 2 ]) ifTrue:[
self addMethodsStartingWith:prefix stripOff: stripprefix
].
] ifTrue:[
@@ -252,6 +252,7 @@
].
"Created: / 08-04-2014 / 21:04:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 09-04-2014 / 09:31:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
addMethodsForType: type stripOff: stripprefix