--- a/SmallSense__SmalltalkLintService.st Thu Aug 27 09:29:09 2015 +0200
+++ b/SmallSense__SmalltalkLintService.st Thu Aug 27 16:52:44 2015 +0200
@@ -17,7 +17,7 @@
Tools::BackgroundSourceProcessingService subclass:#SmalltalkLintService
instanceVariableNames:'rulesHolder rules highlighter support annotations
- annotationsSequenceNumber'
+ annotationsSequenceNumber annotationsPerLine'
classVariableNames:'Debugging'
poolDictionaries:''
category:'SmallSense-Smalltalk-Lint'
@@ -103,6 +103,7 @@
| anns |
(anns := self annotations) notNil ifTrue:[
+ ^ annotationsPerLine at: lineNo ifAbsent:[nil].
^ anns detect:[:annotation | annotation line = lineNo] ifNone:[ nil ]
].
^ nil
@@ -120,19 +121,20 @@
annotationsPerLineMap := Dictionary new.
rulesToIntervalsMap keysAndValuesDo:[ :rule :intervals |
intervals do:[:interval |
- | line annotation |
+ | line annotation r |
line := codeView lineOfCharacterPosition: interval first.
annotation := annotationsPerLineMap at: line ifAbsentPut:[ Tools::LintAnnotation new line: line ].
- annotation rule notNil ifTrue:[
- annotation rule isComposite
- ifTrue: [ annotation rule addRule:rule "rules add: rule" ]
- ifFalse:[ annotation rule: (RBCompositeLintRule rules: (OrderedCollection with: (annotation rule) with: rule))]
+ (r := annotation rule) notNil ifTrue:[
+ r isComposite
+ ifTrue: [ r addRule:rule "rules add: rule" ]
+ ifFalse:[ annotation rule: (RBCompositeLintRule rules: (OrderedCollection with: r with: rule))]
] ifFalse:[
annotation rule: rule
].
].
].
+ annotationsPerLine := annotationsPerLineMap.
annotations := annotationsPerLineMap values sort:[ :a :b | a line < b line ].
annotationsSequenceNumber := highlighter sequenceNumber.
]
@@ -186,10 +188,12 @@
sourceChanged:force
| lang |
+ annotations := annotationsPerLine := nil.
+
rules isNil ifTrue:[ ^ self ].
+ rules resetResult.
((lang := codeView language) isNil or:[lang isSmalltalk not]) ifTrue:[ ^ self ].
- rules resetResult.
- annotations := nil.
+
super sourceChanged:force.
"Created: / 18-02-2012 / 22:50:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -298,6 +302,7 @@
|lang cls env oldCodeList oldCode |
rules isNil ifTrue:[ ^ self ].
+
codeView codeAspect ~~ #method ifTrue:[ ^ self ].
(lang := codeView language) isNil ifTrue: [ ^ self ].
lang isSmalltalk ifFalse: [ ^ self ].
@@ -346,6 +351,8 @@
] do:[
env := (SmallSense::SmalltalkUnacceptedMethodEnvironment onClass:cls methodSource: oldCode).
rules rejectRules:[:rule | SmalltalkChecker isRuleDisabled:rule class].
+Transcript showCR:rules.
+Transcript showCR:rules rules.
SmalltalkChecker runRule: rules onEnvironment: env
].
delayed ifTrue:[
@@ -434,11 +441,11 @@
!SmalltalkLintService class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/goodies/smallsense/SmallSense__SmalltalkLintService.st,v 1.4 2015-05-18 14:50:32 cg Exp $'
+ ^ '$Header$'
!
version_CVS
- ^ '$Path: stx/goodies/smallsense/SmallSense__SmalltalkLintService.st, Version: 1.0, User: cg, Time: 2015-01-31T02:00:40.102+01$'
+ ^ '$Header$'
!
version_HG
@@ -447,6 +454,6 @@
!
version_SVN
- ^ '$Id: SmallSense__SmalltalkLintService.st,v 1.4 2015-05-18 14:50:32 cg Exp $'
+ ^ '$Id$'
! !