author | Claus Gittinger <cg@exept.de> |
Fri, 09 Dec 2016 13:45:14 +0100 | |
branch | cvs_MAIN |
changeset 1007 | 60cc13ef0a9c |
parent 965 | b6f6cde0739f |
child 1082 | e6639a9f8efe |
permissions | -rw-r--r-- |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
1 |
" |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
2 |
COPYRIGHT (c) 2006 by eXept Software AG |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
3 |
All Rights Reserved |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
4 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
5 |
This software is furnished under a license and may be used |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
6 |
only in accordance with the terms of that license and with the |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
7 |
inclusion of the above copyright notice. This software may not |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
8 |
be provided or otherwise made available to, or used by, any |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
9 |
other person. No title to or ownership of the software is |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
10 |
hereby transferred. |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
11 |
" |
249
8bc64027b189
Package renamed to stx:goodies/smallsense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
174
diff
changeset
|
12 |
"{ Package: 'stx:goodies/smallsense' }" |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
13 |
|
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
60
diff
changeset
|
14 |
"{ NameSpace: SmallSense }" |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
60
diff
changeset
|
15 |
|
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
16 |
Tools::BackgroundSourceProcessingService subclass:#SmalltalkLintService |
315
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
314
diff
changeset
|
17 |
instanceVariableNames:'rulesHolder rules highlighter support annotations |
874
385aed1f9547
class: SmallSense::SmalltalkLintService
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
18 |
annotationsSequenceNumber annotationsPerLine' |
16 | 19 |
classVariableNames:'Debugging' |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
20 |
poolDictionaries:'' |
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
21 |
category:'SmallSense-Smalltalk-Lint' |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
22 |
! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
23 |
|
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
24 |
!SmalltalkLintService class methodsFor:'documentation'! |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
25 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
26 |
copyright |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
27 |
" |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
28 |
COPYRIGHT (c) 2006 by eXept Software AG |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
29 |
All Rights Reserved |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
30 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
31 |
This software is furnished under a license and may be used |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
32 |
only in accordance with the terms of that license and with the |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
33 |
inclusion of the above copyright notice. This software may not |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
34 |
be provided or otherwise made available to, or used by, any |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
35 |
other person. No title to or ownership of the software is |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
36 |
hereby transferred. |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
37 |
" |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
38 |
! ! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
39 |
|
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
40 |
!SmalltalkLintService class methodsFor:'accessing'! |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
41 |
|
17
8443d79a77ac
Improvements in background lint checker
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16
diff
changeset
|
42 |
debugging |
8443d79a77ac
Improvements in background lint checker
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16
diff
changeset
|
43 |
^Debugging == true |
8443d79a77ac
Improvements in background lint checker
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16
diff
changeset
|
44 |
|
8443d79a77ac
Improvements in background lint checker
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16
diff
changeset
|
45 |
"Created: / 17-02-2012 / 00:48:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
8443d79a77ac
Improvements in background lint checker
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16
diff
changeset
|
46 |
! |
8443d79a77ac
Improvements in background lint checker
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16
diff
changeset
|
47 |
|
16 | 48 |
debugging: aBoolean |
49 |
||
50 |
Debugging := aBoolean |
|
51 |
||
52 |
"Created: / 16-02-2012 / 16:22:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
53 |
! |
|
54 |
||
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
55 |
label |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
56 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
57 |
"Answers short label - for UI" |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
58 |
|
42
48307f46ff8e
Edit support cut off to a new service. Added SmallSense syntax highlighting service.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
41
diff
changeset
|
59 |
^'SmallSense - Static Checking' |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
60 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
61 |
"Created: / 07-03-2010 / 14:00:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
42
48307f46ff8e
Edit support cut off to a new service. Added SmallSense syntax highlighting service.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
41
diff
changeset
|
62 |
"Modified: / 27-07-2013 / 22:36:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
7 | 63 |
! |
64 |
||
65 |
priority |
|
66 |
"Answers a priority of the service. Services with higher priority |
|
67 |
will get the event notification before ones with lower priority. |
|
68 |
Therefore, a lower-priority service might not get the event if high |
|
69 |
priority service processes it" |
|
70 |
||
71 |
^ 10 |
|
72 |
||
73 |
"Created: / 01-02-2012 / 10:29:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
74 |
! ! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
75 |
|
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
76 |
!SmalltalkLintService class methodsFor:'queries'! |
35
4e7326538420
Added SmallSenseService>>isUsefulFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
32
diff
changeset
|
77 |
|
4e7326538420
Added SmallSenseService>>isUsefulFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
32
diff
changeset
|
78 |
isUsefulFor:aCodeView |
4e7326538420
Added SmallSenseService>>isUsefulFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
32
diff
changeset
|
79 |
"this filters useful services. |
964 | 80 |
must be redefined to return true in subclasses |
81 |
(but each class must do it only for itself - not for subclasses)" |
|
35
4e7326538420
Added SmallSenseService>>isUsefulFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
32
diff
changeset
|
82 |
|
86
3b615594edf6
Fixed Lint service to work on CVS Smalltalk/X...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
76
diff
changeset
|
83 |
^ self == SmalltalkLintService |
35
4e7326538420
Added SmallSenseService>>isUsefulFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
32
diff
changeset
|
84 |
|
4e7326538420
Added SmallSenseService>>isUsefulFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
32
diff
changeset
|
85 |
"Created: / 24-07-2013 / 11:35:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
86
3b615594edf6
Fixed Lint service to work on CVS Smalltalk/X...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
76
diff
changeset
|
86 |
"Modified: / 17-09-2013 / 15:26:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
35
4e7326538420
Added SmallSenseService>>isUsefulFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
32
diff
changeset
|
87 |
! ! |
4e7326538420
Added SmallSenseService>>isUsefulFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
32
diff
changeset
|
88 |
|
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
89 |
!SmalltalkLintService class methodsFor:'testing'! |
11
17938f618c57
Added settings application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10
diff
changeset
|
90 |
|
17938f618c57
Added settings application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10
diff
changeset
|
91 |
isAvailable |
17938f618c57
Added settings application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10
diff
changeset
|
92 |
|
917 | 93 |
^(UserPreferences current smallSenseEnabled == true) |
11
17938f618c57
Added settings application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10
diff
changeset
|
94 |
|
17938f618c57
Added settings application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10
diff
changeset
|
95 |
"Created: / 04-02-2012 / 22:20:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
17938f618c57
Added settings application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10
diff
changeset
|
96 |
! ! |
17938f618c57
Added settings application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10
diff
changeset
|
97 |
|
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
98 |
!SmalltalkLintService methodsFor:'accessing'! |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
99 |
|
315
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
314
diff
changeset
|
100 |
annotationAtLine: lineNo |
965 | 101 |
| anns bbb | |
315
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
314
diff
changeset
|
102 |
|
917 | 103 |
(anns := self annotations) notNil ifTrue:[ |
945 | 104 |
^ annotationsPerLine at: lineNo ifAbsent:[nil]. |
105 |
"/ ^ anns detect:[:annotation | annotation line = lineNo] ifNone:[ nil ] |
|
315
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
314
diff
changeset
|
106 |
]. |
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
314
diff
changeset
|
107 |
^ nil |
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
314
diff
changeset
|
108 |
|
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
314
diff
changeset
|
109 |
"Created: / 30-01-2012 / 21:06:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
314
diff
changeset
|
110 |
"Modified: / 15-12-2014 / 15:40:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
314
diff
changeset
|
111 |
! |
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
314
diff
changeset
|
112 |
|
314
6d1b45736520
Support for drawing annotation markers in codeview scrollbar.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
313
diff
changeset
|
113 |
annotations |
945 | 114 |
| rulesToIntervalsMap annotationsPerLineMap | |
315
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
314
diff
changeset
|
115 |
|
945 | 116 |
(highlighter notNil and:[ highlighter sequenceNumber ~~ annotationsSequenceNumber ]) ifTrue:[ |
117 |
rulesToIntervalsMap := highlighter rulesToIntervalsMap. |
|
118 |
rulesToIntervalsMap notEmptyOrNil ifTrue:[ |
|
119 |
annotationsPerLineMap := Dictionary new. |
|
120 |
rulesToIntervalsMap keysAndValuesDo:[ :rule :intervals | |
|
121 |
intervals do:[:interval | |
|
122 |
| line annotation r | |
|
314
6d1b45736520
Support for drawing annotation markers in codeview scrollbar.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
313
diff
changeset
|
123 |
|
945 | 124 |
line := codeView lineOfCharacterPosition: interval first. |
125 |
annotation := annotationsPerLineMap at: line ifAbsentPut:[ Tools::LintAnnotation new line: line ]. |
|
126 |
(r := annotation rule) notNil ifTrue:[ |
|
127 |
r isComposite |
|
128 |
ifTrue: [ r addRule:rule "rules add: rule" ] |
|
129 |
ifFalse:[ annotation rule: (RBCompositeLintRule rules: (OrderedCollection with: r with: rule))] |
|
130 |
] ifFalse:[ |
|
131 |
annotation rule: rule |
|
132 |
]. |
|
133 |
]. |
|
134 |
]. |
|
135 |
annotationsPerLine := annotationsPerLineMap. |
|
136 |
annotations := annotationsPerLineMap values sort:[ :a :b | a line < b line ]. |
|
137 |
annotationsSequenceNumber := highlighter sequenceNumber. |
|
138 |
] |
|
315
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
314
diff
changeset
|
139 |
]. |
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
314
diff
changeset
|
140 |
^annotations |
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
314
diff
changeset
|
141 |
|
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
314
diff
changeset
|
142 |
"Created: / 15-12-2014 / 15:29:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
314
diff
changeset
|
143 |
"Modified: / 15-12-2014 / 19:00:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
314
6d1b45736520
Support for drawing annotation markers in codeview scrollbar.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
313
diff
changeset
|
144 |
! |
6d1b45736520
Support for drawing annotation markers in codeview scrollbar.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
313
diff
changeset
|
145 |
|
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
146 |
syntaxHighlighter |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
147 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
148 |
^highlighter |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
149 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
150 |
"Created: / 05-08-2011 / 10:59:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
151 |
! ! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
152 |
|
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
153 |
!SmalltalkLintService methodsFor:'aspects'! |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
154 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
155 |
rulesHolder |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
156 |
"return/create the 'rulesHolder' value holder (automatically generated)" |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
157 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
158 |
rulesHolder isNil ifTrue:[ |
917 | 159 |
rulesHolder := ValueHolder new. |
160 |
rulesHolder addDependent:self. |
|
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
161 |
]. |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
162 |
^ rulesHolder |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
163 |
! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
164 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
165 |
rulesHolder:something |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
166 |
"set the 'rulesHolder' value holder (automatically generated)" |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
167 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
168 |
|oldValue newValue| |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
169 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
170 |
rulesHolder notNil ifTrue:[ |
917 | 171 |
oldValue := rulesHolder value. |
172 |
rulesHolder removeDependent:self. |
|
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
173 |
]. |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
174 |
rulesHolder := something. |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
175 |
rulesHolder notNil ifTrue:[ |
917 | 176 |
rulesHolder addDependent:self. |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
177 |
]. |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
178 |
newValue := rulesHolder value. |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
179 |
oldValue ~~ newValue ifTrue:[ |
917 | 180 |
self update:#value with:newValue from:rulesHolder. |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
181 |
]. |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
182 |
! ! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
183 |
|
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
184 |
!SmalltalkLintService methodsFor:'change & update'! |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
185 |
|
18
cebd9550b288
branch jv-experiments merged back
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17
diff
changeset
|
186 |
sourceChanged:force |
24 | 187 |
| lang | |
188 |
||
874
385aed1f9547
class: SmallSense::SmalltalkLintService
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
189 |
annotations := annotationsPerLine := nil. |
385aed1f9547
class: SmallSense::SmalltalkLintService
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
190 |
|
18
cebd9550b288
branch jv-experiments merged back
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17
diff
changeset
|
191 |
rules isNil ifTrue:[ ^ self ]. |
874
385aed1f9547
class: SmallSense::SmalltalkLintService
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
192 |
rules resetResult. |
965 | 193 |
|
194 |
"/ why this? - if there are rules and annotations, any reason to not show them? |
|
195 |
"/ ((lang := codeView language) isNil or:[lang isSmalltalk not]) ifTrue:[ ^ self ]. |
|
874
385aed1f9547
class: SmallSense::SmalltalkLintService
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
196 |
|
18
cebd9550b288
branch jv-experiments merged back
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17
diff
changeset
|
197 |
super sourceChanged:force. |
cebd9550b288
branch jv-experiments merged back
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17
diff
changeset
|
198 |
|
cebd9550b288
branch jv-experiments merged back
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17
diff
changeset
|
199 |
"Created: / 18-02-2012 / 22:50:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
315
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
314
diff
changeset
|
200 |
"Modified: / 15-12-2014 / 19:00:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
18
cebd9550b288
branch jv-experiments merged back
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17
diff
changeset
|
201 |
! |
cebd9550b288
branch jv-experiments merged back
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17
diff
changeset
|
202 |
|
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
203 |
update:something with:aParameter from:changedObject |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
204 |
"Invoked when an object that I depend upon sends a change notification." |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
205 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
206 |
changedObject == rulesHolder ifTrue:[ |
917 | 207 |
(UserPreferences current smallSenseBackgroundLintEnabled == true) ifTrue:[ |
208 |
| rulesHierarchical ruleList disabledRules | |
|
18
cebd9550b288
branch jv-experiments merged back
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17
diff
changeset
|
209 |
|
917 | 210 |
"/xxxx |
211 |
rulesHierarchical := rulesHolder value. |
|
212 |
rulesHierarchical notNil ifTrue:[ |
|
213 |
"/ remove globally disabled rules |
|
214 |
disabledRules := SmalltalkChecker forceDisabledRules. |
|
215 |
ruleList := rulesHierarchical flattened reject:[:each| disabledRules includes: each class name]. |
|
461 | 216 |
|
917 | 217 |
"/ remove user-disabled rules |
218 |
ruleList := rulesHierarchical flattened reject:[:each| SmalltalkChecker isRuleDisabled:each class]. |
|
219 |
ruleList := ruleList collect:[ :e | e class new ]. |
|
220 |
rules := RBCompositeLintRule rules: ruleList. |
|
221 |
highlighter rules: ruleList. |
|
222 |
self process. |
|
223 |
]. |
|
224 |
]. |
|
225 |
^ self. |
|
39
748389119d0a
Initial support for per-language edit support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
35
diff
changeset
|
226 |
]. |
748389119d0a
Initial support for per-language edit support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
35
diff
changeset
|
227 |
|
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
228 |
super update:something with:aParameter from:changedObject |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
229 |
|
298
c1d8d35e71fd
Make sure each service runs checks on its own *copy* of rules
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
295
diff
changeset
|
230 |
"Modified (format): / 16-10-2014 / 23:20:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
231 |
! ! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
232 |
|
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
233 |
!SmalltalkLintService methodsFor:'event handling'! |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
234 |
|
917 | 235 |
buttonPress:button x:x y:y in:view |
44
efc9d79a287f
Bugfix in SmallSenseService - added accidenticaly removed method.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
42
diff
changeset
|
236 |
|lineNr| |
efc9d79a287f
Bugfix in SmallSenseService - added accidenticaly removed method.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
42
diff
changeset
|
237 |
|
efc9d79a287f
Bugfix in SmallSenseService - added accidenticaly removed method.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
42
diff
changeset
|
238 |
rules isNil ifTrue:[ |
917 | 239 |
^ false |
44
efc9d79a287f
Bugfix in SmallSenseService - added accidenticaly removed method.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
42
diff
changeset
|
240 |
]. |
efc9d79a287f
Bugfix in SmallSenseService - added accidenticaly removed method.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
42
diff
changeset
|
241 |
view == gutterView ifTrue:[ |
917 | 242 |
button == 1 ifTrue:[ |
243 |
lineNr := textView yVisibleToLineNr:y. |
|
244 |
lineNr notNil ifTrue:[ |
|
245 |
^ self showInfoWindowForLine: lineNr |
|
246 |
]. |
|
247 |
^ false. |
|
248 |
]. |
|
44
efc9d79a287f
Bugfix in SmallSenseService - added accidenticaly removed method.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
42
diff
changeset
|
249 |
]. |
efc9d79a287f
Bugfix in SmallSenseService - added accidenticaly removed method.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
42
diff
changeset
|
250 |
^ false |
efc9d79a287f
Bugfix in SmallSenseService - added accidenticaly removed method.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
42
diff
changeset
|
251 |
|
efc9d79a287f
Bugfix in SmallSenseService - added accidenticaly removed method.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
42
diff
changeset
|
252 |
"Created: / 30-01-2012 / 21:04:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
efc9d79a287f
Bugfix in SmallSenseService - added accidenticaly removed method.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
42
diff
changeset
|
253 |
! |
efc9d79a287f
Bugfix in SmallSenseService - added accidenticaly removed method.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
42
diff
changeset
|
254 |
|
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
255 |
viewRealized |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
256 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
257 |
| browser | |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
258 |
|
917 | 259 |
(UserPreferences current smallSenseBackgroundLintEnabled == true) ifFalse:[ ^ self ]. |
11
17938f618c57
Added settings application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10
diff
changeset
|
260 |
|
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
261 |
(browser := codeView browser) notNil ifTrue:[ |
917 | 262 |
browser navigationState canvasType ~~ #smallLintByRuleResultBrowserSpec ifTrue:[ |
263 |
self rulesHolder: (browser perform:#smalllintRulesOrDefaultHolder ifNotUnderstood:[browser smalllintRulesOrAllHolder]) |
|
264 |
]. |
|
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
265 |
]. |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
266 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
267 |
"Created: / 23-01-2012 / 10:43:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
30
d501a5c4ad42
Added smalllintRulesOrDefaut which accesses user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
29
diff
changeset
|
268 |
"Modified: / 28-02-2013 / 22:43:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
269 |
! ! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
270 |
|
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
271 |
!SmalltalkLintService methodsFor:'initialization'! |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
272 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
273 |
initialize |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
274 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
275 |
super initialize. |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
276 |
|
311
368ff7243ade
Cleanup in SmalltalkLintService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
301
diff
changeset
|
277 |
highlighter := Tools::LintHighlighter new. |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
278 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
279 |
"Created: / 05-08-2011 / 11:53:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
311
368ff7243ade
Cleanup in SmalltalkLintService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
301
diff
changeset
|
280 |
"Modified (comment): / 03-12-2014 / 09:38:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
281 |
! ! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
282 |
|
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
283 |
!SmalltalkLintService methodsFor:'private'! |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
284 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
285 |
process |
917 | 286 |
"(Re)starts the processing job. Should be called whenever a source |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
287 |
must be (re)processed." |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
288 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
289 |
rules isNil ifTrue:[ |
917 | 290 |
^self |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
291 |
]. |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
292 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
293 |
^super process. |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
294 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
295 |
"Created: / 24-01-2012 / 12:43:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
296 |
! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
297 |
|
965 | 298 |
rehighlight: delayed |
299 |
| service | |
|
300 |
||
301 |
service := self service: SmallSense::CodeHighlightingService name. |
|
302 |
service isNil ifTrue:[ |
|
303 |
service := self service: Tools::CodeHighlightingService name |
|
304 |
]. |
|
305 |
service notNil ifTrue:[ |
|
306 |
"/ let the code-hghlighter do the drawing |
|
307 |
service sourceChanged: true. |
|
308 |
codeView updateScrollersViewBackground. |
|
309 |
]. |
|
310 |
||
311 |
"Created: / 27-01-2012 / 17:06:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
312 |
"Modified (format): / 15-12-2014 / 19:00:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
313 |
! |
|
314 |
||
315 |
showInfoWindowForLine: lineNo |
|
316 |
| ann | |
|
317 |
||
318 |
ann := self annotationAtLine: lineNo. |
|
319 |
ann isNil ifTrue:[ ^ false ]. |
|
320 |
||
321 |
codeView topView beMaster. |
|
322 |
||
323 |
CriticsWindow new |
|
324 |
rule: ann rule; |
|
325 |
codeView: codeView; |
|
326 |
allButOpen; |
|
327 |
"/ openWindowAt: (Screen current pointerPosition - (20@20)). |
|
328 |
openWindowAs:#popUp at: (Screen current pointerPosition - (20@20)). |
|
329 |
||
330 |
^true |
|
331 |
||
332 |
"Created: / 30-01-2012 / 21:04:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
333 |
! ! |
|
334 |
||
335 |
!SmalltalkLintService methodsFor:'processing'! |
|
336 |
||
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
337 |
process: delayed |
965 | 338 |
"Do the real source processing. If delayed is true, actual data update must |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
339 |
be done within the event queue using #pushUserEvent:... |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
340 |
" |
174
3e08d765d86f
sync from current CVS head; fixed comment highlighting for STXEOLRule
Claus Gittinger
parents:
100
diff
changeset
|
341 |
|lang cls env oldCodeList oldCode | |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
342 |
|
11
17938f618c57
Added settings application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10
diff
changeset
|
343 |
rules isNil ifTrue:[ ^ self ]. |
874
385aed1f9547
class: SmallSense::SmalltalkLintService
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
344 |
|
39
748389119d0a
Initial support for per-language edit support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
35
diff
changeset
|
345 |
codeView codeAspect ~~ #method ifTrue:[ ^ self ]. |
965 | 346 |
"/ why this - |
347 |
"/ (lang := codeView language) isNil ifTrue: [ ^ self ]. |
|
348 |
"/ lang isSmalltalk ifFalse: [ ^ self ]. |
|
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
349 |
done := false. |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
350 |
modified := false. |
39
748389119d0a
Initial support for per-language edit support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
35
diff
changeset
|
351 |
|
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
352 |
cls := codeView klass. |
917 | 353 |
cls isNil ifTrue:[^ self ]. |
39
748389119d0a
Initial support for per-language edit support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
35
diff
changeset
|
354 |
|
748389119d0a
Initial support for per-language edit support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
35
diff
changeset
|
355 |
Delay waitForMilliseconds: 200."Give user some time to write" |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
356 |
|
419
56dc11b797dc
class: SmallSense::SmalltalkLintService
Claus Gittinger <cg@exept.de>
parents:
323
diff
changeset
|
357 |
"/ attempt to avoid multiple processing; did not work. |
56dc11b797dc
class: SmallSense::SmalltalkLintService
Claus Gittinger <cg@exept.de>
parents:
323
diff
changeset
|
358 |
"/ left here for someone to think about it... |
56dc11b797dc
class: SmallSense::SmalltalkLintService
Claus Gittinger <cg@exept.de>
parents:
323
diff
changeset
|
359 |
"/ (codeView sensor hasUserEvent:#process for:self withArguments:nil) ifTrue:[^ self]. |
56dc11b797dc
class: SmallSense::SmalltalkLintService
Claus Gittinger <cg@exept.de>
parents:
323
diff
changeset
|
360 |
|
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
361 |
(cls notNil and:[cls isObsolete]) ifTrue:[ |
949 | 362 |
cls isMeta ifTrue:[ |
363 |
cls := (Smalltalk at:cls theNonMetaclass name) class |
|
364 |
] ifFalse:[ |
|
365 |
cls := Smalltalk at:cls name |
|
366 |
]. |
|
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
367 |
]. |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
368 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
369 |
"textView" modified ifFalse:[ |
949 | 370 |
oldCodeList := textView list copy. |
371 |
oldCodeList isEmptyOrNil ifTrue: [ ^ self ]. |
|
372 |
"textView" modified ifFalse:[ |
|
373 |
oldCodeList isNil ifFalse:[ |
|
374 |
oldCode := oldCodeList asStringWithoutEmphasis. |
|
375 |
oldCode isEmptyOrNil ifTrue:[ ^ self ]. |
|
376 |
"textView" modified ifFalse:[ |
|
377 |
Screen currentScreenQuerySignal answer:codeView device |
|
378 |
do:[ |
|
379 |
Error handle:[:ex | |
|
380 |
| errMsg | |
|
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
381 |
|
949 | 382 |
Debugging == true ifTrue:[ |
383 |
Debugging := false. |
|
384 |
ex pass. |
|
385 |
]. |
|
16 | 386 |
|
965 | 387 |
"/ Transcript topView raiseDeiconified. |
388 |
"/ Transcript showCR:'ParseError: ', ex description. |
|
949 | 389 |
errMsg := ex description asStringCollection first asString. |
390 |
self showInfo:(('Smalltalk Lint: ',errMsg) withColor:Color red). |
|
391 |
] do:[ |
|
392 |
env := (SmallSense::SmalltalkUnacceptedMethodEnvironment onClass:cls methodSource: oldCode). |
|
393 |
rules rejectRules:[:rule | SmalltalkChecker isRuleDisabled:rule class]. |
|
965 | 394 |
"/ Transcript showCR:rules. |
395 |
"/ Transcript showCR:rules rules. |
|
949 | 396 |
SmalltalkChecker runRule: rules onEnvironment: env |
397 |
]. |
|
398 |
delayed ifTrue:[ |
|
399 |
codeView sensor pushUserEvent:#rehighlight: for:self withArgument: true. |
|
400 |
] ifFalse:[ |
|
401 |
self rehighlight: true. |
|
402 |
] |
|
403 |
] |
|
404 |
] |
|
405 |
] |
|
406 |
] |
|
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
407 |
] |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
408 |
|
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
409 |
"Created: / 24-01-2012 / 12:44:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
295
ebca485b6bdf
Show an error warning in browser info line when an error occur during linting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
290
diff
changeset
|
410 |
"Modified: / 16-10-2014 / 01:10:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
411 |
! ! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
412 |
|
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
413 |
!SmalltalkLintService methodsFor:'redrawing'! |
4
783561e02172
Lint support improved - shows an icon in gutter view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
414 |
|
965 | 415 |
drawLine:lineNo in:view atX:x y:yBaseline width:w height:hFont ascent:aFont |
416 |
from:startCol to:endColOrNil with:fg and:bg |
|
4
783561e02172
Lint support improved - shows an icon in gutter view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
417 |
"Called by both gutterView and textView (well, not yet) to |
783561e02172
Lint support improved - shows an icon in gutter view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
418 |
allow services to draw custom things on text view. |
783561e02172
Lint support improved - shows an icon in gutter view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
419 |
Ask JV what the args means if unsure (I'm lazy to document |
783561e02172
Lint support improved - shows an icon in gutter view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
420 |
them, now it is just an experiment...)" |
783561e02172
Lint support improved - shows an icon in gutter view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
421 |
|
965 | 422 |
"/ | lang | |
312 | 423 |
"/ ((lang := codeView language) isNil or:[lang isSmalltalk not]) ifTrue:[ ^ self ]. |
4
783561e02172
Lint support improved - shows an icon in gutter view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
424 |
|
917 | 425 |
(UserPreferences current smallSenseBackgroundLintEnabled == true) ifFalse:[ ^ self ]. |
315
0a4845a0c211
Update to catchup changes in libtool: refactoring to support multiple lint warnings at line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
314
diff
changeset
|
426 |
|
965 | 427 |
self drawAnnotationInLine:lineNo |
428 |
in:view atX:x y:yBaseline width:w height:hFont ascent:aFont |
|
429 |
from:startCol to:endColOrNil with:fg and:bg |
|
4
783561e02172
Lint support improved - shows an icon in gutter view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
430 |
! ! |
783561e02172
Lint support improved - shows an icon in gutter view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
431 |
|
290
428b0d4e2725
Fix in SmalltalkLintService: break dependency on rules when unregistering.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
432 |
!SmalltalkLintService methodsFor:'registering'! |
428b0d4e2725
Fix in SmalltalkLintService: break dependency on rules when unregistering.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
433 |
|
428b0d4e2725
Fix in SmalltalkLintService: break dependency on rules when unregistering.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
434 |
unregister |
428b0d4e2725
Fix in SmalltalkLintService: break dependency on rules when unregistering.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
435 |
super unregister. |
428b0d4e2725
Fix in SmalltalkLintService: break dependency on rules when unregistering.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
436 |
rulesHolder removeDependent: self. |
428b0d4e2725
Fix in SmalltalkLintService: break dependency on rules when unregistering.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
437 |
|
428b0d4e2725
Fix in SmalltalkLintService: break dependency on rules when unregistering.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
438 |
"Created: / 14-10-2014 / 22:40:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
428b0d4e2725
Fix in SmalltalkLintService: break dependency on rules when unregistering.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
439 |
! ! |
428b0d4e2725
Fix in SmalltalkLintService: break dependency on rules when unregistering.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
440 |
|
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
441 |
!SmalltalkLintService class methodsFor:'documentation'! |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
442 |
|
323 | 443 |
version |
874
385aed1f9547
class: SmallSense::SmalltalkLintService
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
444 |
^ '$Header$' |
323 | 445 |
! |
446 |
||
447 |
version_CVS |
|
874
385aed1f9547
class: SmallSense::SmalltalkLintService
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
448 |
^ '$Header$' |
323 | 449 |
! |
450 |
||
29
fe650a6e5704
Moved NavigationState>>selectedClasses to package stx:libtool.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
27
diff
changeset
|
451 |
version_HG |
fe650a6e5704
Moved NavigationState>>selectedClasses to package stx:libtool.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
27
diff
changeset
|
452 |
|
fe650a6e5704
Moved NavigationState>>selectedClasses to package stx:libtool.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
27
diff
changeset
|
453 |
^ '$Changeset: <not expanded> $' |
fe650a6e5704
Moved NavigationState>>selectedClasses to package stx:libtool.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
27
diff
changeset
|
454 |
! |
fe650a6e5704
Moved NavigationState>>selectedClasses to package stx:libtool.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
27
diff
changeset
|
455 |
|
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
456 |
version_SVN |
874
385aed1f9547
class: SmallSense::SmalltalkLintService
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
457 |
^ '$Id$' |
0
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
458 |
! ! |
893cc7b0ed1d
copied smallsense from old /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
459 |