author | Claus Gittinger <cg@exept.de> |
Mon, 02 Nov 2009 17:51:57 +0100 | |
changeset 3841 | 1f681141ba33 |
parent 3761 | 6584390d427d |
child 3852 | 53a677825c05 |
permissions | -rw-r--r-- |
2376 | 1 |
" |
2 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
"{ Package: 'stx:libwidg2' }" |
|
13 |
||
14 |
Object subclass:#DoWhatIMeanSupport |
|
15 |
instanceVariableNames:'' |
|
3475
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
16 |
classVariableNames:'LastSource LastParseTree' |
2376 | 17 |
poolDictionaries:'' |
18 |
category:'System-Support' |
|
19 |
! |
|
20 |
||
21 |
!DoWhatIMeanSupport class methodsFor:'documentation'! |
|
22 |
||
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
26 |
All Rights Reserved |
|
27 |
||
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! |
|
36 |
||
37 |
documentation |
|
38 |
" |
|
39 |
misc collected UI support (functional) |
|
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
40 |
These used to be in the Smalltalk and SystemBrowser class; |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
41 |
however, they are only needed for programmers, and some of the stuff is useful in multiple |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
42 |
places. |
3667 | 43 |
Therefore it is: |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
44 |
1) not needed for standalone executables |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
45 |
2) published here to avoid multiple implementations |
2376 | 46 |
|
47 |
[author:] |
|
48 |
Claus Gittinger (cg@exept.de) |
|
49 |
||
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
50 |
" |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
51 |
! ! |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
52 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
53 |
!DoWhatIMeanSupport class methodsFor:'code completion'! |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
54 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
55 |
codeCompletionForClass:cls codeView:codeView |
3557 | 56 |
self codeCompletionForClass:cls context:nil codeView:codeView |
57 |
! |
|
58 |
||
59 |
codeCompletionForClass:cls context:contextOrNil codeView:codeView |
|
60 |
"contextOrNil is the current context, if this is calledfrom the debugger; |
|
61 |
nil, if called from the browser. |
|
62 |
If nonNil, we can make better guesses, because we actually know what a variables type |
|
63 |
is. This is not yet done, sigh" |
|
64 |
||
3720
f37c0d1757e3
use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents:
3718
diff
changeset
|
65 |
|crsrPos char interval source node checkedNode count| |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
66 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
67 |
cls isNil ifTrue:[ |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
68 |
self information:'No class'. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
69 |
^ self. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
70 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
71 |
|
3731
eb92d54a47ac
fixed code completion for selector
Claus Gittinger <cg@exept.de>
parents:
3720
diff
changeset
|
72 |
crsrPos := codeView characterPositionOfCursor-1. |
eb92d54a47ac
fixed code completion for selector
Claus Gittinger <cg@exept.de>
parents:
3720
diff
changeset
|
73 |
char := codeView characterAtCharacterPosition:crsrPos. |
eb92d54a47ac
fixed code completion for selector
Claus Gittinger <cg@exept.de>
parents:
3720
diff
changeset
|
74 |
[crsrPos > 1 and:[char isSeparator or:['.' includes:char]]] whileTrue:[ |
eb92d54a47ac
fixed code completion for selector
Claus Gittinger <cg@exept.de>
parents:
3720
diff
changeset
|
75 |
crsrPos := crsrPos - 1. |
eb92d54a47ac
fixed code completion for selector
Claus Gittinger <cg@exept.de>
parents:
3720
diff
changeset
|
76 |
char := codeView characterAtCharacterPosition:crsrPos. |
eb92d54a47ac
fixed code completion for selector
Claus Gittinger <cg@exept.de>
parents:
3720
diff
changeset
|
77 |
]. |
eb92d54a47ac
fixed code completion for selector
Claus Gittinger <cg@exept.de>
parents:
3720
diff
changeset
|
78 |
|
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
79 |
interval := codeView selectedInterval. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
80 |
interval isEmpty ifTrue:[ |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
81 |
interval := crsrPos to:crsrPos. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
82 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
83 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
84 |
source := codeView contentsAsString string. |
3731
eb92d54a47ac
fixed code completion for selector
Claus Gittinger <cg@exept.de>
parents:
3720
diff
changeset
|
85 |
source := source copyTo:crsrPos. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
86 |
|
3720
f37c0d1757e3
use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents:
3718
diff
changeset
|
87 |
"/ this is too naive and stupid; if there is a syntactic error, |
f37c0d1757e3
use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents:
3718
diff
changeset
|
88 |
"/ we will not find a node for a long time (stepping back more and more, |
f37c0d1757e3
use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents:
3718
diff
changeset
|
89 |
"/ until reaching the beginning). This leads to a thousand and more times reparsing |
f37c0d1757e3
use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents:
3718
diff
changeset
|
90 |
"/ without any progress. |
f37c0d1757e3
use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents:
3718
diff
changeset
|
91 |
"/ TODO: do it vice-versa, in that the parser does a callOut for every node generated |
f37c0d1757e3
use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents:
3718
diff
changeset
|
92 |
"/ as it parses the code. Stop, when the interval is hit. |
f37c0d1757e3
use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents:
3718
diff
changeset
|
93 |
"/ that will also work for syntactic incorrect source code. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
94 |
node := self findNodeForInterval:interval in:source allowErrors:true. |
3720
f37c0d1757e3
use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents:
3718
diff
changeset
|
95 |
"/ [node isNil] whileTrue:[ |
f37c0d1757e3
use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents:
3718
diff
changeset
|
96 |
"/ "/ expand to the left ... |
f37c0d1757e3
use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents:
3718
diff
changeset
|
97 |
"/ interval start > 1 ifFalse:[ |
f37c0d1757e3
use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents:
3718
diff
changeset
|
98 |
"/ self information:'No parseNode found'. |
f37c0d1757e3
use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents:
3718
diff
changeset
|
99 |
"/ ^ self. |
f37c0d1757e3
use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents:
3718
diff
changeset
|
100 |
"/ ]. |
f37c0d1757e3
use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents:
3718
diff
changeset
|
101 |
"/ interval start:(interval start - 1). |
f37c0d1757e3
use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents:
3718
diff
changeset
|
102 |
"/ node := self findNodeForInterval:interval in:source allowErrors:true. |
f37c0d1757e3
use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents:
3718
diff
changeset
|
103 |
"/ ]. |
f37c0d1757e3
use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents:
3718
diff
changeset
|
104 |
node isNil ifTrue:[ |
f37c0d1757e3
use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents:
3718
diff
changeset
|
105 |
self information:'No parseNode found'. |
f37c0d1757e3
use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents:
3718
diff
changeset
|
106 |
^ self. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
107 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
108 |
|
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
109 |
(node isVariable |
3366 | 110 |
and:[ node parent notNil |
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
111 |
and:[ node parent isMessage |
3366 | 112 |
and:[ node stop < (codeView characterPositionOfCursor-1) ]]]) ifTrue:[ |
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
113 |
node := node parent. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
114 |
]. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
115 |
|
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
116 |
node isVariable ifTrue:[ |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
117 |
self codeCompletionForVariable:node inClass:cls codeView:codeView. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
118 |
^ self. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
119 |
]. |
3552
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
120 |
node isLiteral ifTrue:[ |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
121 |
node value isSymbol ifTrue:[ |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
122 |
self codeCompletionForLiteralSymbol:node inClass:cls codeView:codeView. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
123 |
^ self. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
124 |
]. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
125 |
]. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
126 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
127 |
checkedNode := node. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
128 |
[checkedNode notNil] whileTrue:[ |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
129 |
checkedNode isMessage ifTrue:[ |
3306
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
130 |
"/ completion in a message-send |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
131 |
self codeCompletionForMessage:checkedNode inClass:cls codeView:codeView. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
132 |
^ self |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
133 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
134 |
checkedNode isMethod ifTrue:[ |
3306
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
135 |
"/ completion in a methods selector pattern |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
136 |
self codeCompletionForMethod:checkedNode inClass:cls codeView:codeView. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
137 |
^ self. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
138 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
139 |
checkedNode := checkedNode parent. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
140 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
141 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
142 |
self information:'Node is neither variable nor message.'. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
143 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
144 |
"Modified: / 04-07-2006 / 18:48:26 / fm" |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
145 |
"Modified: / 20-11-2006 / 12:30:59 / cg" |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
146 |
! ! |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
147 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
148 |
!DoWhatIMeanSupport class methodsFor:'code completion-helpers'! |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
149 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
150 |
askUserForCompletion:what for:codeView from:allTheBest |
3598 | 151 |
|resources| |
152 |
||
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
153 |
allTheBest isEmpty ifTrue:[ ^ nil ]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
154 |
allTheBest size == 1 ifTrue:[ ^ allTheBest first ]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
155 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
156 |
allTheBest size < 20 ifTrue:[ |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
157 |
|menu idx exitKey| |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
158 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
159 |
menu := PopUpMenu labels:allTheBest. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
160 |
menu hideOnKeyFilter:[:key | |hide| |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
161 |
hide := ( #( CursorDown CursorUp Escape Return ) includes: key) not. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
162 |
hide ifTrue:[ |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
163 |
exitKey := key. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
164 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
165 |
hide]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
166 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
167 |
idx := menu startUp. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
168 |
idx == 0 ifTrue:[ |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
169 |
exitKey notNil ifTrue:[ |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
170 |
codeView keyPress:exitKey x:0 y:0. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
171 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
172 |
^ nil |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
173 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
174 |
^ allTheBest at:idx. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
175 |
]. |
3598 | 176 |
resources := codeView application isNil |
177 |
ifTrue:[ codeView resources] |
|
178 |
ifFalse:[ codeView application resources ]. |
|
179 |
||
180 |
^ Dialog |
|
181 |
choose:(resources string:'Choose ',what) |
|
182 |
fromList:allTheBest |
|
183 |
lines:10 |
|
184 |
title:(resources string:'Code completion'). |
|
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
185 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
186 |
"Created: / 10-11-2006 / 14:00:53 / cg" |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
187 |
! |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
188 |
|
3552
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
189 |
codeCompletionForLiteralSymbol:node inClass:cls codeView:codeView |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
190 |
|sym possibleCompletions best start stop oldLen newLen oldVar| |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
191 |
|
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
192 |
sym := node value. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
193 |
possibleCompletions := OrderedCollection new. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
194 |
|
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
195 |
Symbol allInstancesDo:[:existingSym | |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
196 |
(existingSym startsWith:sym) ifTrue:[ |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
197 |
(existingSym = sym) ifFalse:[ |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
198 |
possibleCompletions add:existingSym |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
199 |
]. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
200 |
]. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
201 |
]. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
202 |
possibleCompletions sort. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
203 |
|
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
204 |
best := possibleCompletions longestCommonPrefix. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
205 |
(best = sym or:[(possibleCompletions includes:best) not]) ifTrue:[ |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
206 |
best := self askUserForCompletion:'symbol literal' for:codeView from:possibleCompletions. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
207 |
best isNil ifTrue:[^ self]. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
208 |
]. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
209 |
|
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
210 |
"/ self showInfo:best. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
211 |
|
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
212 |
start := node start. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
213 |
stop := node stop. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
214 |
(codeView characterAtCharacterPosition:start) == $# ifTrue:[ |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
215 |
start := start + 1. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
216 |
]. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
217 |
(codeView characterAtCharacterPosition:start) == $' ifTrue:[ |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
218 |
start := start + 1. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
219 |
stop := stop - 1. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
220 |
]. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
221 |
|
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
222 |
oldVar := (codeView textFromCharacterPosition:start to:stop) asString string withoutSeparators. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
223 |
|
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
224 |
codeView |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
225 |
undoableDo:[ codeView replaceFromCharacterPosition:start to:stop with:best ] |
3600 | 226 |
info:'Completion'. |
3552
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
227 |
|
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
228 |
(best startsWith:oldVar) ifTrue:[ |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
229 |
oldLen := stop - start + 1. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
230 |
newLen := best size. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
231 |
codeView selectFromCharacterPosition:start+oldLen to:start+newLen-1. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
232 |
codeView dontReplaceSelectionOnInput |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
233 |
]. |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
234 |
! |
e631f2f7bb2a
code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents:
3551
diff
changeset
|
235 |
|
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
236 |
codeCompletionForMessage:node inClass:cls codeView:codeView |
3545
1cbb9b58d37a
better message-selector completion
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
237 |
|selector srchClass implClass |
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
238 |
bestSelectors selector2 bestSelectors2 allBest best info numArgs |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
239 |
newParts nSelParts oldLen newLen selectorParts |
3545
1cbb9b58d37a
better message-selector completion
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
240 |
findBest parentNode selectorInBest selector2InBest2 |
3841
1f681141ba33
changed: #codeCompletionForMessage:inClass:codeView:
Claus Gittinger <cg@exept.de>
parents:
3761
diff
changeset
|
241 |
parser selectorsSentInCode split| |
3545
1cbb9b58d37a
better message-selector completion
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
242 |
|
1cbb9b58d37a
better message-selector completion
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
243 |
parser := Parser parseMethod:codeView contents string in:cls ignoreErrors:true ignoreWarnings:true. |
1cbb9b58d37a
better message-selector completion
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
244 |
selectorsSentInCode := parser messagesSent. |
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
245 |
|
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
246 |
findBest := [:node :selector | |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
247 |
|srchClass bestSelectors bestPrefixes| |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
248 |
|
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
249 |
srchClass := self lookupClassForMessage:node inClass:cls. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
250 |
|
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
251 |
srchClass notNil ifTrue:[ |
3731
eb92d54a47ac
fixed code completion for selector
Claus Gittinger <cg@exept.de>
parents:
3720
diff
changeset
|
252 |
bestSelectors := Parser findBest:30 selectorsFor:selector in:srchClass forCompletion:true. |
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
253 |
] ifFalse:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
254 |
codeView topView withCursor:(Cursor questionMark) do:[ |
3731
eb92d54a47ac
fixed code completion for selector
Claus Gittinger <cg@exept.de>
parents:
3720
diff
changeset
|
255 |
bestSelectors := Parser findBest:30 selectorsFor:selector in:nil forCompletion:true. |
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
256 |
]. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
257 |
]. |
2376 | 258 |
|
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
259 |
(bestSelectors includes:selector) ifTrue:[ |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
260 |
bestSelectors := bestSelectors select:[:sel | sel size > selector size]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
261 |
]. |
3731
eb92d54a47ac
fixed code completion for selector
Claus Gittinger <cg@exept.de>
parents:
3720
diff
changeset
|
262 |
bestSelectors |
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
263 |
]. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
264 |
|
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
265 |
selector := node selector. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
266 |
bestSelectors := findBest value:node value:selector. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
267 |
|
3357
7cfa9db9254e
fix: care for no parent message
Claus Gittinger <cg@exept.de>
parents:
3356
diff
changeset
|
268 |
parentNode := node parent. |
7cfa9db9254e
fix: care for no parent message
Claus Gittinger <cg@exept.de>
parents:
3356
diff
changeset
|
269 |
|
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
270 |
"/ if its a unary message AND the parent is a keyword node, look for parent completion too. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
271 |
(node selector isUnarySelector |
3357
7cfa9db9254e
fix: care for no parent message
Claus Gittinger <cg@exept.de>
parents:
3356
diff
changeset
|
272 |
and:[ parentNode notNil |
7cfa9db9254e
fix: care for no parent message
Claus Gittinger <cg@exept.de>
parents:
3356
diff
changeset
|
273 |
and:[ parentNode isMessage |
7cfa9db9254e
fix: care for no parent message
Claus Gittinger <cg@exept.de>
parents:
3356
diff
changeset
|
274 |
and:[ (selector2 := parentNode selector) isKeywordSelector ]]]) ifTrue:[ |
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
275 |
"/ srchClass2 := self lookupClassForMessage:parentNode inClass:cls. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
276 |
selector2 := selector2,selector. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
277 |
bestSelectors2 := findBest value:parentNode value:selector2. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
278 |
]. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
279 |
|
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
280 |
bestSelectors2 isEmptyOrNil ifTrue:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
281 |
allBest := bestSelectors. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
282 |
] ifFalse:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
283 |
bestSelectors isEmptyOrNil ifTrue:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
284 |
allBest := bestSelectors2 |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
285 |
] ifFalse:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
286 |
selectorInBest := (bestSelectors contains:[:sel | sel asLowercase startsWith:selector asLowercase]). |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
287 |
selector2InBest2 := (bestSelectors2 contains:[:sel | sel asLowercase startsWith:selector2 asLowercase]). |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
288 |
|
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
289 |
(selectorInBest not and:[ selector2InBest2 ]) ifTrue:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
290 |
"/ selector2 is more likely |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
291 |
allBest := bestSelectors2 |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
292 |
] ifFalse:[ |
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
293 |
(selectorInBest and:[ selector2InBest2 not ]) ifTrue:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
294 |
"/ selector more likely |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
295 |
allBest := bestSelectors |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
296 |
] ifFalse:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
297 |
"/ assume same likelyness |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
298 |
|
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
299 |
allBest := bestSelectors isEmpty |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
300 |
ifTrue:[ bestSelectors2 ] |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
301 |
ifFalse:[ bestSelectors , #(nil) , bestSelectors2 ]. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
302 |
] |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
303 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
304 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
305 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
306 |
|
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
307 |
allBest isEmptyOrNil ifTrue:[ ^ self ]. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
308 |
|
3841
1f681141ba33
changed: #codeCompletionForMessage:inClass:codeView:
Claus Gittinger <cg@exept.de>
parents:
3761
diff
changeset
|
309 |
split := [:list :splitHow | |
1f681141ba33
changed: #codeCompletionForMessage:inClass:codeView:
Claus Gittinger <cg@exept.de>
parents:
3761
diff
changeset
|
310 |
|part1 part2 all| |
1f681141ba33
changed: #codeCompletionForMessage:inClass:codeView:
Claus Gittinger <cg@exept.de>
parents:
3761
diff
changeset
|
311 |
|
1f681141ba33
changed: #codeCompletionForMessage:inClass:codeView:
Claus Gittinger <cg@exept.de>
parents:
3761
diff
changeset
|
312 |
part1 := list select:splitHow. |
1f681141ba33
changed: #codeCompletionForMessage:inClass:codeView:
Claus Gittinger <cg@exept.de>
parents:
3761
diff
changeset
|
313 |
part2 := list reject:splitHow. |
1f681141ba33
changed: #codeCompletionForMessage:inClass:codeView:
Claus Gittinger <cg@exept.de>
parents:
3761
diff
changeset
|
314 |
part1 isEmpty ifTrue:[ |
1f681141ba33
changed: #codeCompletionForMessage:inClass:codeView:
Claus Gittinger <cg@exept.de>
parents:
3761
diff
changeset
|
315 |
all := part2. |
1f681141ba33
changed: #codeCompletionForMessage:inClass:codeView:
Claus Gittinger <cg@exept.de>
parents:
3761
diff
changeset
|
316 |
] ifFalse:[ |
1f681141ba33
changed: #codeCompletionForMessage:inClass:codeView:
Claus Gittinger <cg@exept.de>
parents:
3761
diff
changeset
|
317 |
part2 isEmpty ifTrue:[ |
1f681141ba33
changed: #codeCompletionForMessage:inClass:codeView:
Claus Gittinger <cg@exept.de>
parents:
3761
diff
changeset
|
318 |
all := part1. |
1f681141ba33
changed: #codeCompletionForMessage:inClass:codeView:
Claus Gittinger <cg@exept.de>
parents:
3761
diff
changeset
|
319 |
] ifFalse:[ |
1f681141ba33
changed: #codeCompletionForMessage:inClass:codeView:
Claus Gittinger <cg@exept.de>
parents:
3761
diff
changeset
|
320 |
all := part1 , part2. |
1f681141ba33
changed: #codeCompletionForMessage:inClass:codeView:
Claus Gittinger <cg@exept.de>
parents:
3761
diff
changeset
|
321 |
] |
1f681141ba33
changed: #codeCompletionForMessage:inClass:codeView:
Claus Gittinger <cg@exept.de>
parents:
3761
diff
changeset
|
322 |
]. |
1f681141ba33
changed: #codeCompletionForMessage:inClass:codeView:
Claus Gittinger <cg@exept.de>
parents:
3761
diff
changeset
|
323 |
all |
1f681141ba33
changed: #codeCompletionForMessage:inClass:codeView:
Claus Gittinger <cg@exept.de>
parents:
3761
diff
changeset
|
324 |
]. |
1f681141ba33
changed: #codeCompletionForMessage:inClass:codeView:
Claus Gittinger <cg@exept.de>
parents:
3761
diff
changeset
|
325 |
|
3545
1cbb9b58d37a
better message-selector completion
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
326 |
"/ the ones already sent in the code are moved to the top of the list. |
3841
1f681141ba33
changed: #codeCompletionForMessage:inClass:codeView:
Claus Gittinger <cg@exept.de>
parents:
3761
diff
changeset
|
327 |
allBest := split value:allBest value:[:sel | selectorsSentInCode includes:sel]. |
1f681141ba33
changed: #codeCompletionForMessage:inClass:codeView:
Claus Gittinger <cg@exept.de>
parents:
3761
diff
changeset
|
328 |
|
1f681141ba33
changed: #codeCompletionForMessage:inClass:codeView:
Claus Gittinger <cg@exept.de>
parents:
3761
diff
changeset
|
329 |
"/ the ones which are a prefix are moved towards the top of the list |
1f681141ba33
changed: #codeCompletionForMessage:inClass:codeView:
Claus Gittinger <cg@exept.de>
parents:
3761
diff
changeset
|
330 |
allBest := split value:allBest value:[:sel | sel startsWith:selector]. |
3545
1cbb9b58d37a
better message-selector completion
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
331 |
|
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
332 |
best := allBest first. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
333 |
allBest size > 1 ifTrue:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
334 |
allBest size < 20 ifTrue:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
335 |
|idx| |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
336 |
|
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
337 |
idx := (PopUpMenu labels:allBest) startUp. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
338 |
idx == 0 ifTrue:[ ^ self]. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
339 |
best := allBest at:idx. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
340 |
] ifFalse:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
341 |
best := Dialog request:'Matching selectors:' initialAnswer:best list:allBest. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
342 |
best isEmptyOrNil ifTrue:[^ self]. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
343 |
]. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
344 |
best = '-' ifTrue:[^ self]. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
345 |
]. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
346 |
|
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
347 |
false ifTrue:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
348 |
srchClass notNil ifTrue:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
349 |
implClass := srchClass whichClassIncludesSelector:best. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
350 |
] ifFalse:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
351 |
implClass := Smalltalk allClasses select:[:cls | (cls includesSelector:best) or:[cls class includesSelector:best]]. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
352 |
implClass size == 1 ifTrue:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
353 |
implClass := implClass first. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
354 |
] ifFalse:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
355 |
implClass := nil |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
356 |
] |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
357 |
]. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
358 |
|
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
359 |
info := best storeString. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
360 |
implClass notNil ifTrue:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
361 |
info := implClass name , ' >> ' , info. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
362 |
]. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
363 |
self information:info. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
364 |
]. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
365 |
|
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
366 |
best ~= selector ifTrue:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
367 |
numArgs := best numArgs. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
368 |
(bestSelectors2 notEmptyOrNil and:[bestSelectors2 includes:best]) ifTrue:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
369 |
selectorParts := parentNode selectorParts , node selectorParts. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
370 |
] ifFalse:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
371 |
selectorParts := node selectorParts. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
372 |
]. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
373 |
nSelParts := selectorParts size. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
374 |
|
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
375 |
newParts := best asCollectionOfSubstringsSeparatedBy:$:. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
376 |
newParts := newParts select:[:part | part size > 0]. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
377 |
|
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
378 |
codeView |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
379 |
undoableDo:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
380 |
|newCursorPosition stop| |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
381 |
|
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
382 |
numArgs > nSelParts ifTrue:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
383 |
stop := selectorParts last stop. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
384 |
|
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
385 |
"/ append the rest ... |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
386 |
numArgs downTo:nSelParts+1 do:[:idx | |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
387 |
|newPart| |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
388 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
389 |
newPart := newParts at:idx. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
390 |
(best endsWith:$:) ifTrue:[ |
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
391 |
newPart := newPart , ':' |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
392 |
]. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
393 |
|
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
394 |
(codeView characterAtCharacterPosition:stop) == $: ifFalse:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
395 |
newPart := ':' , newPart. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
396 |
]. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
397 |
newPart := (codeView characterAtCharacterPosition:stop) asString , newPart. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
398 |
|
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
399 |
codeView replaceFromCharacterPosition:stop to:stop with:newPart. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
400 |
newCursorPosition isNil ifTrue:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
401 |
newCursorPosition := stop + newPart size. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
402 |
] |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
403 |
] |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
404 |
]. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
405 |
|
3547 | 406 |
(nSelParts min:newParts size) downTo:1 do:[:idx | |
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
407 |
|newPart oldPartialToken start stop| |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
408 |
|
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
409 |
newPart := newParts at:idx. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
410 |
oldPartialToken := selectorParts at:idx. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
411 |
start := oldPartialToken start. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
412 |
stop := oldPartialToken stop. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
413 |
|
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
414 |
(best endsWith:$:) ifTrue:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
415 |
(codeView characterAtCharacterPosition:stop+1) == $: ifFalse:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
416 |
newPart := newPart , ':' |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
417 |
] |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
418 |
] ifFalse:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
419 |
(codeView characterAtCharacterPosition:stop) == $: ifTrue:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
420 |
newPart := newPart , ':' |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
421 |
] ifFalse:[ |
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
422 |
(codeView characterAtCharacterPosition:stop+1) isSeparator ifFalse:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
423 |
newPart := newPart , ' ' |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
424 |
] |
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
425 |
] |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
426 |
"/ codeView replaceFromCharacterPosition:start to:stop with:(newPart , ':'). |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
427 |
"/ ] ifFalse:[ |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
428 |
"/ codeView replaceFromCharacterPosition:start to:stop with:newPart. |
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
429 |
]. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
430 |
|
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
431 |
codeView replaceFromCharacterPosition:start to:stop with:newPart. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
432 |
|
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
433 |
oldLen := stop - start + 1. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
434 |
newLen := newPart size. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
435 |
|
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
436 |
"/ codeView selectFromCharacterPosition:start+oldLen to:start+newLen-1. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
437 |
newCursorPosition isNil ifTrue:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
438 |
newCursorPosition := stop + (newLen-oldLen). |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
439 |
]. |
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
440 |
]. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
441 |
codeView cursorToCharacterPosition:newCursorPosition. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
442 |
codeView cursorRight. "/ avoid going to the next line !! |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
443 |
codeView dontReplaceSelectionOnInput. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
444 |
] |
3600 | 445 |
info:'Completion'. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
446 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
447 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
448 |
"Created: / 10-11-2006 / 13:18:27 / cg" |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
449 |
! |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
450 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
451 |
codeCompletionForMethod:node inClass:cls codeView:codeView |
3306
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
452 |
"completion in a methods selector pattern" |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
453 |
|
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
454 |
|crsrPos |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
455 |
selectorSoFar matchingSelectors |
3306
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
456 |
selectors distances best rest |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
457 |
allExistingMethods namesOfArguments |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
458 |
nameBag namesByCount| |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
459 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
460 |
crsrPos := codeView characterPositionOfCursor - 1. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
461 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
462 |
selectorSoFar := ''. |
3306
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
463 |
node selectorParts doWithIndex:[:partToken :argNr| |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
464 |
|part| |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
465 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
466 |
part := partToken value. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
467 |
selectorSoFar := selectorSoFar , part. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
468 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
469 |
(crsrPos >= partToken start |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
470 |
and:[crsrPos <= partToken stop]) ifTrue:[ |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
471 |
matchingSelectors := Smalltalk allClasses |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
472 |
inject:(Set new) |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
473 |
into:[:theSet :eachClass | |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
474 |
|md| |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
475 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
476 |
cls isMeta ifTrue:[ |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
477 |
md := eachClass theMetaclass methodDictionary |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
478 |
] ifFalse:[ |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
479 |
md := eachClass theNonMetaclass methodDictionary |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
480 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
481 |
theSet addAll:(md keys select:[:sel |sel startsWith:selectorSoFar]). |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
482 |
theSet. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
483 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
484 |
selectors := matchingSelectors asOrderedCollection. |
3306
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
485 |
"/ if there is only one, and user has already entered it, he might want to complete the argument-name |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
486 |
(selectors size == 1 |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
487 |
and:[selectors first = selectorSoFar]) ifTrue:[ |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
488 |
allExistingMethods := (Smalltalk allImplementorsOf:selectorSoFar asSymbol) |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
489 |
collect:[:cls | cls compiledMethodAt:selectorSoFar asSymbol]. |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
490 |
namesOfArguments := allExistingMethods collect:[:eachMethod | eachMethod methodArgNames]. |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
491 |
nameBag := Bag new. |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
492 |
namesOfArguments do:[:eachNameVector | nameBag add:(eachNameVector at:argNr)]. |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
493 |
namesByCount := nameBag valuesAndCounts sort:[:a :b | a value < b value]. |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
494 |
"/ take the one which occurs most often |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
495 |
best := self askUserForCompletion:'argument' for:codeView from:(namesByCount collect:[:a | a key]). |
2376 | 496 |
|
3306
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
497 |
codeView |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
498 |
undoableDo:[ |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
499 |
(crsrPos+1) >= codeView contents size ifTrue:[ |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
500 |
codeView paste:best. |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
501 |
] ifFalse:[ |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
502 |
codeView insertString:best atCharacterPosition:crsrPos+1. |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
503 |
] |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
504 |
] |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
505 |
info:'completion'. |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
506 |
codeView cursorToCharacterPosition:(crsrPos + best size - 1). |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
507 |
] ifFalse:[ |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
508 |
distances := selectors collect:[:each | each spellAgainst:selectorSoFar]. |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
509 |
distances sortWith:selectors. |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
510 |
selectors reverse. |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
511 |
best := self askUserForCompletion:'selector' for:codeView from:selectors. |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
512 |
best isNil ifTrue:[^ self]. |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
513 |
|
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
514 |
rest := best copyFrom:selectorSoFar size. |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
515 |
|
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
516 |
codeView |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
517 |
undoableDo:[ |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
518 |
codeView |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
519 |
replaceFromCharacterPosition:crsrPos |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
520 |
to:crsrPos |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
521 |
with:rest |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
522 |
] |
3600 | 523 |
info:'Completion'. |
3306
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
524 |
codeView cursorToCharacterPosition:(crsrPos + rest size - 1). |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
525 |
]. |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
526 |
codeView cursorRight. "/ kludge to make it visible |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
527 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
528 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
529 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
530 |
"Modified: / 04-07-2006 / 18:48:26 / fm" |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
531 |
"Created: / 10-11-2006 / 13:46:44 / cg" |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
532 |
! |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
533 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
534 |
codeCompletionForVariable:node inClass:cls codeView:codeView |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
535 |
|nonMetaClass crsrPos nm |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
536 |
allVariables allDistances best nodeVal |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
537 |
char start stop oldLen newLen oldVar |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
538 |
getDistanceComputeBlockWithWeight addWithFactorBlock names allTheBest bestAssoc |
3551
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
539 |
globalFactor localFactor selectorOfMessageToNode tree implementors argIdx namesUsed kwPart| |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
540 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
541 |
nonMetaClass := cls theNonMetaclass. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
542 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
543 |
nm := node name. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
544 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
545 |
"/ if we are behind the variable and a space has already been entered, |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
546 |
"/ the user is probably looking for a message selector. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
547 |
"/ If the variable represents a global, present its instance creation messages |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
548 |
crsrPos := codeView characterPositionOfCursor. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
549 |
char := codeView characterAtCharacterPosition:crsrPos-1. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
550 |
char isSeparator ifTrue:[ |
3543 | 551 |
nodeVal := cls topNameSpace at:nm asSymbol ifAbsent:[Smalltalk at:nm asSymbol]. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
552 |
nodeVal isBehavior ifTrue:[ |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
553 |
|methods menu exitKey idx| |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
554 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
555 |
methods := nodeVal class methodDictionary values |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
556 |
select:[:m | |cat| |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
557 |
cat := m category asLowercase. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
558 |
cat = 'instance creation' |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
559 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
560 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
561 |
menu := PopUpMenu labels:(methods collect:[:each | each selector]). |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
562 |
menu hideOnKeyFilter:[:key | |hide| |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
563 |
hide := ( #( CursorDown CursorUp Escape Return ) includes: key) not. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
564 |
hide ifTrue:[ |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
565 |
exitKey := key. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
566 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
567 |
hide]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
568 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
569 |
idx := menu startUp. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
570 |
idx == 0 ifTrue:[ |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
571 |
exitKey notNil ifTrue:[ |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
572 |
codeView keyPress:exitKey x:0 y:0. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
573 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
574 |
^ self |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
575 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
576 |
best := (methods at:idx) selector. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
577 |
codeView |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
578 |
undoableDo:[ |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
579 |
codeView insertString:best atCharacterPosition:crsrPos. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
580 |
codeView cursorToCharacterPosition:crsrPos+best size. |
3362 | 581 |
] |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
582 |
info:'completion'. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
583 |
^ self. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
584 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
585 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
586 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
587 |
(node parent notNil and:[node parent isMessage]) ifTrue:[ |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
588 |
node == node parent receiver ifTrue:[ |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
589 |
selectorOfMessageToNode := node parent selector |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
590 |
] |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
591 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
592 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
593 |
getDistanceComputeBlockWithWeight := |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
594 |
[:weight | |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
595 |
[:each | |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
596 |
|dist factor| |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
597 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
598 |
dist := each spellAgainst:nm. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
599 |
factor := 1. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
600 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
601 |
(each startsWith:nm) ifTrue:[ |
3551
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
602 |
factor := 6 * nm size. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
603 |
] ifFalse:[ |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
604 |
(each asLowercase startsWith:nm asLowercase) ifTrue:[ |
3551
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
605 |
factor := 4 * nm size. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
606 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
607 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
608 |
dist := dist + (weight*factor). |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
609 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
610 |
each -> (dist * weight) |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
611 |
] |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
612 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
613 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
614 |
addWithFactorBlock := |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
615 |
[:names :factor | |namesToAdd| |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
616 |
namesToAdd := names select:[:nameToAdd | nameToAdd ~= nm ]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
617 |
namesToAdd := namesToAdd reject:[:each | allVariables includes:each ]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
618 |
allVariables addAll:namesToAdd. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
619 |
allDistances addAll:(namesToAdd collect:(getDistanceComputeBlockWithWeight value:factor)). |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
620 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
621 |
|
3550
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
622 |
nm isUppercaseFirst ifTrue:[ |
3551
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
623 |
globalFactor := 2. "/ favour globals |
3550
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
624 |
localFactor := 1. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
625 |
] ifFalse:[ |
3551
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
626 |
globalFactor := 1. "/ favour locals |
3550
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
627 |
localFactor := 2. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
628 |
]. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
629 |
|
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
630 |
allVariables := OrderedCollection new. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
631 |
allDistances := OrderedCollection new. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
632 |
|
3550
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
633 |
"/ are we in the methods selector spec ? |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
634 |
(node parent notNil |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
635 |
and:[node parent isMethod |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
636 |
and:[node parent arguments includes:node]]) ifTrue:[ |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
637 |
"/ now thats cool: look how the naem of this argument is in other implementations |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
638 |
"/ of this method, and take that as a basis of the selection |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
639 |
|
3550
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
640 |
implementors := SystemBrowser |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
641 |
findImplementorsOf:(node parent selector) |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
642 |
in:(Smalltalk allClasses) |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
643 |
ignoreCase:false. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
644 |
"/ which argument is it |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
645 |
argIdx := node parent arguments indexOf:node. |
3554 | 646 |
implementors size > 50 ifTrue:[ |
647 |
implementors := implementors asOrderedCollection copyTo:50. |
|
648 |
]. |
|
3551
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
649 |
namesUsed := (implementors |
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
650 |
collect:[:eachImplementor | |
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
651 |
|parseTree| |
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
652 |
parseTree := eachImplementor parseTree. |
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
653 |
(parseTree notNil and:[parseTree arguments size > 0]) |
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
654 |
ifFalse:nil |
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
655 |
ifTrue:[ (parseTree arguments at:argIdx) name] ] |
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
656 |
thenSelect:[:a | a notNil]) asSet. |
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
657 |
|
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
658 |
addWithFactorBlock value:namesUsed value:(2 * localFactor). |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
659 |
|
3551
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
660 |
"/ also, look for the keyword before the argument, |
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
661 |
"/ and see if there is such an instVar |
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
662 |
"/ if so, add it with -Arg |
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
663 |
node parent selector isKeyword ifTrue:[ |
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
664 |
kwPart := node parent selector keywords at:argIdx. |
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
665 |
(cls allInstVarNames includes:(kwPart copyWithoutLast:1)) ifTrue:[ |
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
666 |
addWithFactorBlock |
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
667 |
value:(cls allInstVarNames collect:[:nm| nm,'Arg']) |
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
668 |
value:(1 * localFactor). |
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
669 |
]. |
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
670 |
]. |
0c83710ae45e
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
671 |
|
3550
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
672 |
] ifFalse:[ |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
673 |
|
3550
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
674 |
"/ locals in the block/method |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
675 |
names := node allVariablesOnScope. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
676 |
"/ if there were no variables (due to a parse error) |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
677 |
"/ do another parse and see what we have |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
678 |
names isEmpty ifTrue:[ |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
679 |
tree := self treeForCode:(codeView contentsAsString string) allowErrors:true. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
680 |
"/ better if we already have a body (include locals then) |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
681 |
"/ otherwise, only the arguments are considered |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
682 |
tree notNil ifTrue:[ |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
683 |
names := (tree body ? tree) allVariablesOnScope. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
684 |
] |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
685 |
]. |
3470
5cbf651bb214
name completion: care also for private class names
Claus Gittinger <cg@exept.de>
parents:
3366
diff
changeset
|
686 |
|
3550
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
687 |
addWithFactorBlock value:names value:(4 * localFactor). |
2376 | 688 |
|
3550
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
689 |
"/ instance variables |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
690 |
addWithFactorBlock value:cls instVarNames value:(3 * localFactor). |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
691 |
|
3550
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
692 |
"/ inherited instance variables |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
693 |
cls superclass notNil ifTrue:[ |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
694 |
addWithFactorBlock value:cls superclass allInstVarNames value:(2.5 * localFactor). |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
695 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
696 |
|
3550
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
697 |
selectorOfMessageToNode notNil ifTrue:[ |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
698 |
|names responders nonResponders| |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
699 |
|
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
700 |
"/ responding to that messsage |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
701 |
|
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
702 |
"/ private classes |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
703 |
addWithFactorBlock value:(nonMetaClass privateClasses collect:[:cls | cls nameWithoutPrefix]) |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
704 |
value:(1.75 * globalFactor). |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
705 |
|
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
706 |
"/ class variables |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
707 |
names := nonMetaClass classVarNames. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
708 |
responders := names select:[:classVar | (nonMetaClass classVarAt:classVar) respondsTo:selectorOfMessageToNode]. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
709 |
nonResponders := names reject:[:classVar | (nonMetaClass classVarAt:classVar) respondsTo:selectorOfMessageToNode]. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
710 |
|
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
711 |
addWithFactorBlock value:responders value:(1.5 * globalFactor). |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
712 |
addWithFactorBlock value:nonResponders value:(0.5 * 1.5 * globalFactor). |
3550
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
713 |
|
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
714 |
"/ superclass var names |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
715 |
nonMetaClass allSuperclassesDo:[:superClass | |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
716 |
names := superClass classVarNames. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
717 |
responders := names select:[:classVar | (superClass classVarAt:classVar) respondsTo:selectorOfMessageToNode]. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
718 |
nonResponders := names reject:[:classVar | (superClass classVarAt:classVar) respondsTo:selectorOfMessageToNode]. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
719 |
|
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
720 |
addWithFactorBlock value:responders value:(1 * globalFactor). |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
721 |
addWithFactorBlock value:nonResponders value:(0.5 * 1 * globalFactor). |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
722 |
]. |
3470
5cbf651bb214
name completion: care also for private class names
Claus Gittinger <cg@exept.de>
parents:
3366
diff
changeset
|
723 |
|
3550
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
724 |
"/ namespace vars |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
725 |
cls nameSpace ~~ Smalltalk ifTrue:[ |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
726 |
names := cls topNameSpace keys. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
727 |
names := names reject:[:nm | nm includes:$:]. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
728 |
names := names select:[:nm | nm isUppercaseFirst ]. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
729 |
responders := names select:[:nsVar | |c| c := cls topNameSpace at:nsVar. c isBehavior not or:[c isLoaded and:[c respondsTo:selectorOfMessageToNode]]]. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
730 |
nonResponders := names reject:[:nsVar | |c| c := cls topNameSpace at:nsVar. c isBehavior not or:[c isLoaded and:[c respondsTo:selectorOfMessageToNode]]]. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
731 |
addWithFactorBlock value:responders value:(1.5 * globalFactor). |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
732 |
addWithFactorBlock value:nonResponders value:(0.5 * 1.5 * globalFactor). |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
733 |
]. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
734 |
"/ globals |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
735 |
names := Smalltalk keys. |
3718 | 736 |
"/ names := names reject:[:nm | nm includes:$:]. |
3550
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
737 |
names := names select:[:nm | nm isUppercaseFirst ]. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
738 |
responders := names select:[:glblVar | |c| c := Smalltalk at:glblVar. c isBehavior not or:[c isLoaded and:[c respondsTo:selectorOfMessageToNode]]]. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
739 |
nonResponders := names reject:[:glblVar | |c| c := Smalltalk at:glblVar. c isBehavior not or:[c isLoaded and:[c respondsTo:selectorOfMessageToNode]]]. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
740 |
addWithFactorBlock value:responders value:(1.5 * globalFactor). |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
741 |
addWithFactorBlock value:nonResponders value:(0.5 * 1.5 * globalFactor). |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
742 |
] ifFalse:[ |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
743 |
"/ private classes |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
744 |
addWithFactorBlock value:(nonMetaClass privateClasses collect:[:cls | cls nameWithoutPrefix]) |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
745 |
value:(1.75 * globalFactor). |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
746 |
|
3550
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
747 |
"/ class variables |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
748 |
addWithFactorBlock value:nonMetaClass classVarNames value:(1.5 * globalFactor). |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
749 |
cls superclass notNil ifTrue:[ |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
750 |
addWithFactorBlock value:nonMetaClass superclass allClassVarNames value:(1 * globalFactor). |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
751 |
]. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
752 |
|
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
753 |
"/ namespace vars |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
754 |
cls nameSpace ~~ Smalltalk ifTrue:[ |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
755 |
names := cls nameSpace isNameSpace ifTrue:[cls nameSpace keys] ifFalse:[cls nameSpace privateClasses collect:[:c | c nameWithoutPrefix]]. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
756 |
names := names select:[:nm | nm isUppercaseFirst ]. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
757 |
addWithFactorBlock value:names value:(1.5 * globalFactor). |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
758 |
]. |
3761
6584390d427d
dont forget pool variables when looking for the best variable match
Claus Gittinger <cg@exept.de>
parents:
3751
diff
changeset
|
759 |
|
6584390d427d
dont forget pool variables when looking for the best variable match
Claus Gittinger <cg@exept.de>
parents:
3751
diff
changeset
|
760 |
"/ pool variables |
6584390d427d
dont forget pool variables when looking for the best variable match
Claus Gittinger <cg@exept.de>
parents:
3751
diff
changeset
|
761 |
cls theNonMetaclass sharedPools do:[:poolName | |
6584390d427d
dont forget pool variables when looking for the best variable match
Claus Gittinger <cg@exept.de>
parents:
3751
diff
changeset
|
762 |
|pool names| |
6584390d427d
dont forget pool variables when looking for the best variable match
Claus Gittinger <cg@exept.de>
parents:
3751
diff
changeset
|
763 |
|
6584390d427d
dont forget pool variables when looking for the best variable match
Claus Gittinger <cg@exept.de>
parents:
3751
diff
changeset
|
764 |
pool := Smalltalk at:poolName. |
6584390d427d
dont forget pool variables when looking for the best variable match
Claus Gittinger <cg@exept.de>
parents:
3751
diff
changeset
|
765 |
names := pool classVarNames. |
6584390d427d
dont forget pool variables when looking for the best variable match
Claus Gittinger <cg@exept.de>
parents:
3751
diff
changeset
|
766 |
addWithFactorBlock value:names value:(1.5 * globalFactor). |
6584390d427d
dont forget pool variables when looking for the best variable match
Claus Gittinger <cg@exept.de>
parents:
3751
diff
changeset
|
767 |
]. |
6584390d427d
dont forget pool variables when looking for the best variable match
Claus Gittinger <cg@exept.de>
parents:
3751
diff
changeset
|
768 |
|
3550
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
769 |
"/ globals |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
770 |
names := Smalltalk keys. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
771 |
names := names select:[:nm | nm isUppercaseFirst ]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
772 |
addWithFactorBlock value:names value:(1.5 * globalFactor). |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
773 |
]. |
3550
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
774 |
|
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
775 |
"/ pseudos - assuming that thisContext is seldom used. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
776 |
"/ also assuming, that nil is short so its usually typed in. |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
777 |
addWithFactorBlock value:#('self') value:(2.5 * localFactor). |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
778 |
addWithFactorBlock value:#('nil') value:(0.5 * localFactor). |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
779 |
addWithFactorBlock value:#('super' 'false') value:(2 * localFactor). |
34c8ab9f403f
much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents:
3549
diff
changeset
|
780 |
addWithFactorBlock value:#('thisContext') value:(1 * localFactor). |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
781 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
782 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
783 |
bestAssoc := allDistances at:1. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
784 |
bestAssoc := allDistances inject:bestAssoc into:[:el :best | el value > best value |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
785 |
ifTrue:[el] |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
786 |
ifFalse:[best] |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
787 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
788 |
|
3660 | 789 |
allDistances sort:[:a :b | |
790 |
a value > b value ifTrue:[ |
|
791 |
true |
|
792 |
] ifFalse:[ |
|
793 |
a value = b value ifTrue:[ |
|
794 |
a key < b key |
|
795 |
] ifFalse:[ |
|
796 |
false |
|
797 |
] |
|
798 |
] |
|
799 |
]. |
|
3554 | 800 |
allTheBest := allDistances select:[:entry | entry value >= (bestAssoc value * 0.5)]. |
801 |
allTheBest size > 15 ifTrue:[ |
|
802 |
allTheBest := allDistances select:[:entry | entry value >= (bestAssoc value * 0.8)]. |
|
803 |
]. |
|
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
804 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
805 |
best := self askUserForCompletion:'variable' for:codeView from:(allTheBest collect:[:assoc | assoc key]). |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
806 |
best isNil ifTrue:[^ self]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
807 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
808 |
"/ self showInfo:best. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
809 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
810 |
start := node start. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
811 |
stop := node stop. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
812 |
oldVar := (codeView textFromCharacterPosition:start to:stop) asString string withoutSeparators. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
813 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
814 |
codeView |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
815 |
undoableDo:[ codeView replaceFromCharacterPosition:start to:stop with:best ] |
3600 | 816 |
info:'Completion'. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
817 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
818 |
(best startsWith:oldVar) ifTrue:[ |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
819 |
oldLen := stop - start + 1. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
820 |
newLen := best size. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
821 |
codeView selectFromCharacterPosition:start+oldLen to:start+newLen-1. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
822 |
codeView dontReplaceSelectionOnInput |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
823 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
824 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
825 |
"Created: / 10-11-2006 / 13:16:33 / cg" |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
826 |
"Modified: / 16-11-2006 / 14:15:59 / cg" |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
827 |
! |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
828 |
|
3300 | 829 |
findNodeForInterval:interval in:source |
830 |
|tree node| |
|
831 |
||
832 |
interval isEmpty ifTrue: [^ nil]. |
|
833 |
RBParser isNil ifTrue: [^ nil]. |
|
834 |
||
3475
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
835 |
source = LastSource ifTrue:[ |
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
836 |
tree := LastParseTree. |
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
837 |
] ifFalse:[ |
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
838 |
tree := RBParser |
3300 | 839 |
parseMethod:source |
840 |
onError: [:str :err ":nodesSoFar" | ^ nil]. |
|
3475
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
841 |
|
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
842 |
tree isNil ifTrue:[^ nil]. |
3300 | 843 |
|
3475
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
844 |
LastSource := source. |
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
845 |
LastParseTree := tree. |
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
846 |
]. |
3300 | 847 |
|
848 |
node := tree whichNodeIsContainedBy:interval. |
|
849 |
node isNil ifTrue: [ |
|
3475
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
850 |
node := tree bestNodeFor: interval. |
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
851 |
node isNil ifTrue: [ |
3734 | 852 |
node := self findNodeIn:tree forInterval:interval |
3475
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
853 |
]. |
3300 | 854 |
]. |
855 |
^ node |
|
856 |
||
857 |
"Modified: / 16-11-2006 / 19:04:03 / cg" |
|
858 |
! |
|
859 |
||
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
860 |
findNodeForInterval:interval in:source allowErrors:allowErrors |
3751 | 861 |
|tree "errCount" firstIntersectingNode| |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
862 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
863 |
interval isEmpty ifTrue: [^ nil]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
864 |
RBParser isNil ifTrue: [^ nil]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
865 |
|
3475
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
866 |
source = LastSource ifTrue:[ |
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
867 |
tree := LastParseTree. |
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
868 |
] ifFalse:[ |
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
869 |
tree := RBParser |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
870 |
parseMethod:source |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
871 |
onError: [:str :err :nodesSoFar | |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
872 |
|nodes| |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
873 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
874 |
allowErrors ifTrue:[ |
3751 | 875 |
firstIntersectingNode notNil ifTrue:[^ firstIntersectingNode]. |
3586 | 876 |
nodes := nodesSoFar asOrderedCollection |
3306
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
877 |
collect:[:nd | nd whichNodeIntersects:interval] |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
878 |
thenSelect:[:nd | nd notNil ]. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
879 |
nodes size == 1 ifTrue:[ |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
880 |
^ nodes first |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
881 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
882 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
883 |
^ nil] |
3720
f37c0d1757e3
use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents:
3718
diff
changeset
|
884 |
rememberNodes:true |
3751 | 885 |
nodeGenerationCallback:[:node | |
886 |
"/ we would like to return here as soon as the node has been created by the parser; |
|
887 |
"/ however, at that time, its parent(chain) is not yet created and so we might not know |
|
888 |
"/ what the semantic intepretation (especially: scope of variable) will be. |
|
889 |
"/ therefore, we parse all, and return the found node at the end. |
|
890 |
"//// ^ node. |
|
891 |
firstIntersectingNode isNil ifTrue:[ |
|
892 |
(node intersectsInterval:interval) ifTrue:[ |
|
893 |
firstIntersectingNode := node |
|
894 |
]. |
|
895 |
]. |
|
3720
f37c0d1757e3
use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents:
3718
diff
changeset
|
896 |
]. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
897 |
"/ onError: [:str :err | errCount := (errCount?0) + 1. self halt.] |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
898 |
"/ proceedAfterError:true. |
3751 | 899 |
|
900 |
tree notNil ifTrue:[ |
|
901 |
LastSource := source. |
|
902 |
LastParseTree := tree. |
|
903 |
]. |
|
904 |
^ firstIntersectingNode |
|
3475
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
905 |
]. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
906 |
|
3306
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
907 |
^ self findNodeForInterval:interval inParseTree:tree. |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
908 |
! |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
909 |
|
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
910 |
findNodeForInterval:interval inParseTree:parseTree |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
911 |
|node| |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
912 |
|
3306
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
913 |
interval isEmpty ifTrue: [^ nil]. |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
914 |
parseTree isNil ifTrue:[^ nil]. |
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
915 |
|
40e860fd2f02
argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents:
3303
diff
changeset
|
916 |
node := parseTree whichNodeIsContainedBy:interval. |
3475
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
917 |
node isNil ifTrue:[ |
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
918 |
node := parseTree whichNodeIntersects:interval. |
3680 | 919 |
node isNil ifTrue: [ |
920 |
node := self findNodeIn:parseTree forInterval:interval |
|
921 |
]. |
|
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
922 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
923 |
^ node |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
924 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
925 |
"Modified: / 10-11-2006 / 13:13:58 / cg" |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
926 |
! |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
927 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
928 |
findNodeIn:tree forInterval:interval |
3734 | 929 |
|nodeFound wouldReturn| |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
930 |
|
3734 | 931 |
nodeFound := nil. |
932 |
tree nodesDo:[:eachNode | |
|
933 |
(eachNode intersectsInterval:interval) ifTrue:[ |
|
934 |
(nodeFound isNil or:[nodeFound == eachNode parent]) ifTrue:[ |
|
935 |
nodeFound := eachNode |
|
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
936 |
] ifFalse:[ |
3734 | 937 |
(nodeFound parent == eachNode parent |
938 |
and:[ eachNode start >= nodeFound start |
|
939 |
and:[ eachNode stop <= nodeFound stop ] ]) ifTrue:[ |
|
940 |
] ifFalse:[ |
|
941 |
(nodeFound parent notNil |
|
942 |
and:[nodeFound parent isCascade and:[eachNode parent isCascade]]) ifFalse:[^ nil] |
|
943 |
] |
|
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
944 |
] |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
945 |
] ifFalse:[ |
3734 | 946 |
nodeFound notNil ifTrue:[ |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
947 |
"/ already found one - beyond that one; leave |
3734 | 948 |
wouldReturn notNil ifTrue:[wouldReturn := nodeFound]. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
949 |
] |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
950 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
951 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
952 |
"/ (wouldReturn notNil and:[wouldReturn ~~ node]) ifTrue:[self halt]. |
3734 | 953 |
^ nodeFound |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
954 |
|
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
955 |
"Modified: / 20-11-2006 / 12:31:12 / cg" |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
956 |
! |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
957 |
|
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
958 |
lookupClassForMessage:node inClass:classProvidingNamespace |
3681
6dca6308d156
better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents:
3680
diff
changeset
|
959 |
|receiver nm nodeVal receiverClass| |
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
960 |
|
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
961 |
receiver := node receiver. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
962 |
receiver isVariable ifTrue:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
963 |
nm := receiver name. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
964 |
nm = 'self' ifTrue:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
965 |
^ classProvidingNamespace |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
966 |
]. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
967 |
nm = 'super' ifTrue:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
968 |
^ classProvidingNamespace superclass |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
969 |
]. |
3734 | 970 |
nm isUppercaseFirst ifTrue:[ |
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
971 |
"/ wouldn't it be better to simply 'evaluate' the variable ? |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
972 |
nodeVal := Parser new evaluate:nm in:nil receiver:(classProvidingNamespace basicNew). |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
973 |
|
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
974 |
"/ (Smalltalk includesKey:nm asSymbol) ifTrue:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
975 |
"/ nodeVal := Smalltalk at:nm asSymbol. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
976 |
"/ ]. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
977 |
nodeVal notNil ifTrue:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
978 |
^ nodeVal class |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
979 |
] |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
980 |
] |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
981 |
]. |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
982 |
receiver isLiteral ifTrue:[ |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
983 |
^ receiver value class |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
984 |
]. |
3681
6dca6308d156
better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents:
3680
diff
changeset
|
985 |
receiver isMessage ifTrue:[ |
6dca6308d156
better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents:
3680
diff
changeset
|
986 |
(receiver selector = 'new' |
6dca6308d156
better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents:
3680
diff
changeset
|
987 |
or:[ receiver selector = 'new:' ]) ifTrue:[ |
6dca6308d156
better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents:
3680
diff
changeset
|
988 |
receiverClass := self lookupClassForMessage:receiver inClass:classProvidingNamespace. |
6dca6308d156
better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents:
3680
diff
changeset
|
989 |
receiverClass notNil ifTrue:[ |
6dca6308d156
better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents:
3680
diff
changeset
|
990 |
receiverClass isBehavior ifTrue:[ |
6dca6308d156
better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents:
3680
diff
changeset
|
991 |
receiverClass isMeta ifTrue:[ |
6dca6308d156
better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents:
3680
diff
changeset
|
992 |
^ receiverClass theNonMetaclass |
6dca6308d156
better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents:
3680
diff
changeset
|
993 |
] |
6dca6308d156
better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents:
3680
diff
changeset
|
994 |
] |
6dca6308d156
better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents:
3680
diff
changeset
|
995 |
]. |
6dca6308d156
better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents:
3680
diff
changeset
|
996 |
]. |
6dca6308d156
better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents:
3680
diff
changeset
|
997 |
]. |
3356
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
998 |
^ nil |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
999 |
! |
b1e3ccd1bcf2
better messageSelector completion
Claus Gittinger <cg@exept.de>
parents:
3331
diff
changeset
|
1000 |
|
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
1001 |
treeForCode:source allowErrors:allowErrors |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
1002 |
|tree| |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
1003 |
|
3475
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
1004 |
source = LastSource ifTrue:[ |
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
1005 |
tree := LastParseTree. |
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
1006 |
] ifFalse:[ |
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
1007 |
tree := RBParser |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
1008 |
parseMethod:source |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
1009 |
onError: [:str :err :nodesSoFar :parser| |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
1010 |
allowErrors ifTrue:[ |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
1011 |
^ parser currentMethodNode |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
1012 |
]. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
1013 |
^ nil |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
1014 |
] |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
1015 |
proceedAfterError:false |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
1016 |
rememberNodes:true. |
3475
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
1017 |
tree isNil ifTrue:[^ nil]. |
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
1018 |
LastSource := source. |
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
1019 |
LastParseTree := tree. |
8ed28a1e4e37
cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents:
3470
diff
changeset
|
1020 |
]. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
1021 |
^ tree |
2376 | 1022 |
! ! |
1023 |
||
2661
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1024 |
!DoWhatIMeanSupport class methodsFor:'input completion support'! |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1025 |
|
2975 | 1026 |
classCategoryCompletion:aPartialCategory inEnvironment:anEnvironment |
2661
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1027 |
"given a partial class category name, return an array consisting of |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1028 |
2 entries: 1st: the best (longest) match |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1029 |
2nd: collection consisting of matching categories" |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1030 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1031 |
|matches best lcName| |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1032 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1033 |
matches := IdentitySet new. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1034 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1035 |
"/ search for exact match |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1036 |
anEnvironment allClassesDo:[:aClass | |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1037 |
|category| |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1038 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1039 |
category := aClass category. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1040 |
(category notNil and:[category startsWith:aPartialCategory]) ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1041 |
matches add:category |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1042 |
] |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1043 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1044 |
matches isEmpty ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1045 |
"/ search for case-ignoring match |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1046 |
lcName := aPartialCategory asLowercase. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1047 |
anEnvironment allClassesDo:[:aClass | |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1048 |
|category| |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1049 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1050 |
category := aClass category. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1051 |
(category notNil and:[category asLowercase startsWith:lcName]) ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1052 |
matches add:category |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1053 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1054 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1055 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1056 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1057 |
matches isEmpty ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1058 |
^ Array with:aPartialCategory with:(Array with:aPartialCategory) |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1059 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1060 |
matches size == 1 ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1061 |
^ Array with:matches first with:(matches asArray) |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1062 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1063 |
matches := matches asSortedCollection. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1064 |
best := matches longestCommonPrefix. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1065 |
^ Array with:best with:matches asArray |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1066 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1067 |
" |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1068 |
Smalltalk classCategoryCompletion:'Sys' |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1069 |
Smalltalk classCategoryCompletion:'System' |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1070 |
Smalltalk classCategoryCompletion:'System-BinaryStorage' |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1071 |
" |
2975 | 1072 |
|
1073 |
"Created: / 10-08-2006 / 13:06:45 / cg" |
|
2661
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1074 |
! |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1075 |
|
2830 | 1076 |
classNameEntryCompletionBlock |
1077 |
"this block can be used in a dialog to perform className completion" |
|
1078 |
||
2977 | 1079 |
^ self entryCompletionBlockFor:#'classnameCompletion:inEnvironment:' |
2830 | 1080 |
|
2977 | 1081 |
"Modified: / 10-08-2006 / 13:22:02 / cg" |
2830 | 1082 |
! |
1083 |
||
2975 | 1084 |
classnameCompletion:aPartialClassName filter:filterBlock inEnvironment:anEnvironment |
2661
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1085 |
"given a partial classname, return an array consisting of |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1086 |
2 entries: 1st: the best (longest) match |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1087 |
2nd: collection consisting of matching names" |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1088 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1089 |
|searchName matches matchedNamesWithoutPrefix ignCaseMatches best isMatchString cls nsPrefix |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1090 |
others lcSearchName tryToMatch idx words w1 w2 rslt bestMatch| |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1091 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1092 |
aPartialClassName isEmpty ifTrue:[ |
2975 | 1093 |
matches := Smalltalk allClassesForWhich:filterBlock. |
2661
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1094 |
^ Array with:aPartialClassName with:#() |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1095 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1096 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1097 |
(words := aPartialClassName asCollectionOfWords) size > 1 ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1098 |
w1 := words first. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1099 |
w2 := words second. |
2975 | 1100 |
rslt := self classnameCompletion:w1 filter:filterBlock inEnvironment:anEnvironment. |
2661
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1101 |
bestMatch := rslt first. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1102 |
matches := rslt second. |
3549 | 1103 |
('class' copyTo:(w2 size min:5)) = w2 ifTrue:[ |
2661
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1104 |
matches := matches collect:[:m | m , ' class']. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1105 |
bestMatch := bestMatch , ' class'. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1106 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1107 |
^ Array with:bestMatch with:matches |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1108 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1109 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1110 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1111 |
(aPartialClassName startsWith:'Smalltalk::') ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1112 |
nsPrefix := 'Smalltalk::'. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1113 |
searchName := aPartialClassName copyFrom:'Smalltalk::' size + 1 |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1114 |
] ifFalse:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1115 |
nsPrefix := ''. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1116 |
searchName := aPartialClassName. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1117 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1118 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1119 |
(searchName at:1) isLowercase ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1120 |
searchName := searchName copy asUppercaseFirst |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1121 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1122 |
lcSearchName := searchName asLowercase. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1123 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1124 |
isMatchString := searchName includesMatchCharacters. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1125 |
matches := OrderedCollection new. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1126 |
matchedNamesWithoutPrefix := Set new. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1127 |
ignCaseMatches := OrderedCollection new. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1128 |
others := OrderedCollection new. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1129 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1130 |
tryToMatch := [:className :fullClassName| |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1131 |
|addIt lcClassName| |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1132 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1133 |
isMatchString ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1134 |
addIt := searchName match:className |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1135 |
] ifFalse:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1136 |
addIt := className startsWith:searchName. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1137 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1138 |
addIt ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1139 |
matches add:(nsPrefix , fullClassName). |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1140 |
matchedNamesWithoutPrefix add:className. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1141 |
] ifFalse:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1142 |
"/ try ignoring case |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1143 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1144 |
isMatchString ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1145 |
addIt := searchName match:className ignoreCase:true |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1146 |
] ifFalse:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1147 |
lcClassName := className asLowercase. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1148 |
addIt := lcClassName startsWith:lcSearchName. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1149 |
addIt ifFalse:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1150 |
others add:className |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1151 |
] |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1152 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1153 |
addIt ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1154 |
ignCaseMatches add:(nsPrefix , fullClassName). |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1155 |
matchedNamesWithoutPrefix add:className. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1156 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1157 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1158 |
addIt |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1159 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1160 |
|
2975 | 1161 |
anEnvironment allClassesForWhich:filterBlock do:[:aClass | |
2661
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1162 |
|addIt fullClassName classNameWithoutPrefix| |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1163 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1164 |
aClass isMeta ifFalse:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1165 |
fullClassName := aClass name. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1166 |
classNameWithoutPrefix := aClass nameWithoutPrefix. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1167 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1168 |
addIt := tryToMatch value:fullClassName value:fullClassName. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1169 |
addIt ifFalse:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1170 |
classNameWithoutPrefix ~~ fullClassName ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1171 |
tryToMatch value:classNameWithoutPrefix value:fullClassName. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1172 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1173 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1174 |
] |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1175 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1176 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1177 |
matches isEmpty ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1178 |
matches := ignCaseMatches |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1179 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1180 |
"/ matches isEmpty ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1181 |
"/ | nearBy | |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1182 |
"/ nearBy := SortedCollection new sortBlock:[:a :b | a key < b key]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1183 |
"/ others do:[:className | |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1184 |
"/ |lcClassName dist cmpName| |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1185 |
"/ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1186 |
"/ lcClassName := className asLowercase. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1187 |
"/ dist := lcClassName levenshteinTo:lcSearchName s:9 k:1 c:0 i:9 d:2. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1188 |
"/ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1189 |
"/ cmpName := lcClassName copyTo:(lcSearchName size min:lcClassName size). |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1190 |
"/ dist := dist min:(cmpName levenshteinTo:lcSearchName s:9 k:1 c:0 i:9 d:2). |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1191 |
"/ cmpName := lcClassName copyTo:(lcSearchName size + 1 min:lcClassName size). |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1192 |
"/ dist := dist min:(cmpName levenshteinTo:lcSearchName s:9 k:1 c:0 i:9 d:2). |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1193 |
"/ dist < 4 ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1194 |
"/ nearBy add:( dist -> (nsPrefix , className) ). |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1195 |
"/ ] |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1196 |
"/ ]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1197 |
"/ matches := nearBy collect:[:eachPair | eachPair value]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1198 |
"/ ]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1199 |
matches isEmpty ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1200 |
^ Array with:searchName with:(Array with:searchName) |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1201 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1202 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1203 |
matches size == 1 ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1204 |
best := matches first. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1205 |
^ Array with:best with:(matches asArray) |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1206 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1207 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1208 |
matches |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1209 |
sort:[:name1 :name2 | |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1210 |
"name1 comes before:name2 iff" |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1211 |
((name2 includes:$:) and:[(name1 includes:$:) not]) |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1212 |
or:[ ((name1 includes:$:) == (name2 includes:$:)) |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1213 |
and:[ (name1 size < name2 size) |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1214 |
or: [ name1 < name2 ]] |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1215 |
] |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1216 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1217 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1218 |
isMatchString ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1219 |
best := searchName. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1220 |
] ifFalse:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1221 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1222 |
best := matches longestCommonPrefix. |
3198
fea29ae859c9
classnamecompletion fixed when namespace is involved
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1223 |
best size < aPartialClassName size "best size == 0" ifTrue:[ |
2661
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1224 |
best := matchedNamesWithoutPrefix longestCommonPrefix. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1225 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1226 |
best size == 0 ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1227 |
"if tried again, return next match" |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1228 |
idx := ((matches indexOf:aPartialClassName) + 1) \\ matches size. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1229 |
idx ~~ 1 ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1230 |
^ Array with:(matches at:idx) with:(matches asArray) |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1231 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1232 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1233 |
best size < aPartialClassName size ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1234 |
best := aPartialClassName. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1235 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1236 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1237 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1238 |
cls := anEnvironment classNamed:best. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1239 |
(cls isBehavior and:[cls isNameSpace]) ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1240 |
(matches conform:[:each | each = best |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1241 |
or:[each startsWith:(best , '::')]]) |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1242 |
ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1243 |
best := best , '::' |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1244 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1245 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1246 |
^ Array with:best with:matches asArray |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1247 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1248 |
" |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1249 |
Smalltalk classnameCompletion:'Arr' |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1250 |
Smalltalk classnameCompletion:'Arra' |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1251 |
Smalltalk classnameCompletion:'arra' |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1252 |
Smalltalk classnameCompletion:'*rray' |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1253 |
" |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1254 |
|
2975 | 1255 |
"Created: / 10-08-2006 / 13:01:08 / cg" |
2661
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1256 |
! |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1257 |
|
2975 | 1258 |
classnameCompletion:aPartialClassName inEnvironment:anEnvironment |
1259 |
"given a partial classname, return an array consisting of |
|
1260 |
2 entries: 1st: the best (longest) match |
|
1261 |
2nd: collection consisting of matching names" |
|
1262 |
||
1263 |
^ self |
|
1264 |
classnameCompletion:aPartialClassName |
|
1265 |
filter:[:cls | true] |
|
1266 |
inEnvironment:anEnvironment |
|
1267 |
||
1268 |
" |
|
1269 |
Smalltalk classnameCompletion:'Arr' |
|
1270 |
Smalltalk classnameCompletion:'Arra' |
|
1271 |
Smalltalk classnameCompletion:'arra' |
|
1272 |
Smalltalk classnameCompletion:'*rray' |
|
1273 |
" |
|
1274 |
||
1275 |
"Created: / 24-11-1995 / 17:24:45 / cg" |
|
1276 |
"Modified: / 10-08-2006 / 13:01:30 / cg" |
|
1277 |
! |
|
1278 |
||
2977 | 1279 |
entryCompletionBlockFor:completionSelector |
1280 |
"this block can be used in a dialog to perform className completion" |
|
1281 |
||
1282 |
^ [:contents :field | |
|
1283 |
|s what m| |
|
1284 |
||
1285 |
s := contents withoutSpaces. |
|
1286 |
field topView withCursor:(Cursor questionMark) do:[ |
|
1287 |
what := self perform:completionSelector with:s with:Smalltalk. |
|
1288 |
]. |
|
1289 |
field contents:(what first). |
|
1290 |
(what at:2) size ~~ 1 ifTrue:[ |
|
3693 | 1291 |
UserPreferences current beepInEditor ifTrue:[ |
1292 |
field device beep |
|
1293 |
] |
|
2977 | 1294 |
] |
1295 |
]. |
|
1296 |
||
1297 |
"Created: / 10-08-2006 / 13:21:37 / cg" |
|
1298 |
! |
|
1299 |
||
2975 | 1300 |
globalNameCompletion:aPartialGlobalName inEnvironment:anEnvironment |
2661
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1301 |
"given a partial globalName, return an array consisting of |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1302 |
2 entries: 1st: the best (longest) match |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1303 |
2nd: collection consisting of matching names" |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1304 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1305 |
|searchName matches ignCaseMatches best isMatchString| |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1306 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1307 |
searchName := aPartialGlobalName. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1308 |
searchName isEmpty ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1309 |
^ Array with:searchName with:#() |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1310 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1311 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1312 |
(searchName at:1) isLowercase ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1313 |
searchName := searchName copy asUppercaseFirst |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1314 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1315 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1316 |
isMatchString := searchName includesMatchCharacters. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1317 |
matches := OrderedCollection new. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1318 |
ignCaseMatches := OrderedCollection new. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1319 |
anEnvironment keysDo:[:aGlobalName | |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1320 |
| addIt| |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1321 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1322 |
isMatchString ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1323 |
addIt := searchName match:aGlobalName |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1324 |
] ifFalse:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1325 |
addIt := aGlobalName startsWith:searchName |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1326 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1327 |
addIt ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1328 |
matches add:aGlobalName |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1329 |
] ifFalse:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1330 |
"/ try ignoring case |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1331 |
isMatchString ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1332 |
addIt := searchName match:aGlobalName ignoreCase:true |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1333 |
] ifFalse:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1334 |
addIt := aGlobalName asLowercase startsWith:searchName asLowercase |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1335 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1336 |
addIt ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1337 |
ignCaseMatches add:aGlobalName |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1338 |
] |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1339 |
] |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1340 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1341 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1342 |
matches isEmpty ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1343 |
matches := ignCaseMatches |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1344 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1345 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1346 |
matches isEmpty ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1347 |
^ Array with:searchName with:(Array with:searchName) |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1348 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1349 |
matches size == 1 ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1350 |
^ Array with:matches first with:(matches asArray) |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1351 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1352 |
matches := matches asSortedCollection. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1353 |
isMatchString ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1354 |
best := searchName. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1355 |
] ifFalse:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1356 |
best := matches longestCommonPrefix. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1357 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1358 |
^ Array with:best with:matches asArray |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1359 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1360 |
" |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1361 |
Smalltalk globalnameCompletion:'Arr' |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1362 |
Smalltalk globalnameCompletion:'Arra' |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1363 |
Smalltalk globalnameCompletion:'arra' |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1364 |
Smalltalk globalnameCompletion:'*rray' |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1365 |
" |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1366 |
|
2975 | 1367 |
"Created: / 10-08-2006 / 13:06:23 / cg" |
2661
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1368 |
! |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1369 |
|
2975 | 1370 |
methodProtocolCompletion:aPartialProtocolName inEnvironment:anEnvironment |
2661
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1371 |
"given a partial method protocol name, return an array consisting of |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1372 |
2 entries: 1st: the best (longest) match |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1373 |
2nd: collection consisting of matching protocols" |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1374 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1375 |
|matches best lcName| |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1376 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1377 |
matches := IdentitySet new. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1378 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1379 |
"/ search for exact match |
3751 | 1380 |
anEnvironment allMethodsWithSelectorDo:[:eachMethod :eachSelector | |
1381 |
|protocol| |
|
2661
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1382 |
|
3751 | 1383 |
protocol := eachMethod category. |
1384 |
(protocol notNil and:[protocol startsWith:aPartialProtocolName]) ifTrue:[ |
|
1385 |
matches add:protocol |
|
2661
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1386 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1387 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1388 |
matches isEmpty ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1389 |
"/ search for case-ignoring match |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1390 |
lcName := aPartialProtocolName asLowercase. |
3751 | 1391 |
anEnvironment allMethodsWithSelectorDo:[:eachMethod :eachSelector | |
1392 |
|protocol| |
|
2661
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1393 |
|
3751 | 1394 |
protocol := eachMethod category. |
1395 |
(protocol asLowercase startsWith:lcName) ifTrue:[ |
|
1396 |
matches add:protocol |
|
2661
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1397 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1398 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1399 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1400 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1401 |
matches isEmpty ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1402 |
^ Array with:aPartialProtocolName with:(Array with:aPartialProtocolName) |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1403 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1404 |
matches size == 1 ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1405 |
^ Array with:matches first with:(matches asArray) |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1406 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1407 |
matches := matches asSortedCollection. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1408 |
best := matches longestCommonPrefix. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1409 |
^ Array with:best with:matches asArray |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1410 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1411 |
" |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1412 |
Smalltalk methodProtocolCompletion:'doc' |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1413 |
Smalltalk methodProtocolCompletion:'docu' |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1414 |
Smalltalk methodProtocolCompletion:'documenta' |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1415 |
" |
2975 | 1416 |
|
1417 |
"Created: / 10-08-2006 / 13:05:27 / cg" |
|
1418 |
! |
|
1419 |
||
1420 |
nameSpaceCompletion:aPartialClassName inEnvironment:anEnvironment |
|
1421 |
"given a partial name, return an array consisting of |
|
1422 |
2 entries: 1st: the best (longest) match |
|
1423 |
2nd: collection consisting of matching names" |
|
1424 |
||
1425 |
^ self |
|
1426 |
classnameCompletion:aPartialClassName |
|
1427 |
filter:[:cls | cls isNameSpace] |
|
1428 |
inEnvironment:anEnvironment |
|
1429 |
||
1430 |
" |
|
1431 |
DoWhatIMeanSupport nameSpaceCompletion:'To' inEnvironment:Smalltalk |
|
1432 |
" |
|
1433 |
||
1434 |
"Created: / 10-08-2006 / 13:02:16 / cg" |
|
1435 |
! |
|
1436 |
||
1437 |
packageCompletion:aPartialPackage inEnvironment:anEnvironment |
|
1438 |
"given a partial package name, return an array consisting of |
|
1439 |
2 entries: 1st: the best (longest) match |
|
1440 |
2nd: collection consisting of matching packages" |
|
1441 |
||
1442 |
|matches best lcName| |
|
1443 |
||
1444 |
matches := IdentitySet new. |
|
1445 |
||
1446 |
"/ search for exact match |
|
1447 |
anEnvironment allClassesDo:[:aClass | |
|
1448 |
|package| |
|
1449 |
||
1450 |
package := aClass package. |
|
1451 |
(package notNil and:[package startsWith:aPartialPackage]) ifTrue:[ |
|
1452 |
matches add:package |
|
1453 |
] |
|
1454 |
]. |
|
1455 |
matches isEmpty ifTrue:[ |
|
1456 |
"/ search for case-ignoring match |
|
1457 |
lcName := aPartialPackage asLowercase. |
|
1458 |
anEnvironment allClassesDo:[:aClass | |
|
1459 |
|package| |
|
1460 |
||
1461 |
package := aClass package. |
|
1462 |
(package notNil and:[package asLowercase startsWith:lcName]) ifTrue:[ |
|
1463 |
matches add:package |
|
1464 |
]. |
|
1465 |
]. |
|
1466 |
]. |
|
1467 |
||
1468 |
matches isEmpty ifTrue:[ |
|
1469 |
^ Array with:aPartialPackage with:(Array with:aPartialPackage) |
|
1470 |
]. |
|
1471 |
matches size == 1 ifTrue:[ |
|
1472 |
^ Array with:matches first with:(matches asArray) |
|
1473 |
]. |
|
1474 |
matches := matches asSortedCollection. |
|
1475 |
best := matches longestCommonPrefix. |
|
1476 |
^ Array with:best with:matches asArray |
|
1477 |
||
1478 |
" |
|
1479 |
DoWhatIMeanSupport packageCompletion:'stx:' inEnvironment:Smalltalk |
|
1480 |
DoWhatIMeanSupport packageCompletion:'stx:libw' inEnvironment:Smalltalk |
|
1481 |
" |
|
1482 |
||
1483 |
"Created: / 10-08-2006 / 13:05:07 / cg" |
|
2661
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1484 |
! |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1485 |
|
2977 | 1486 |
packageNameEntryCompletionBlock |
1487 |
"this block can be used in a dialog to perform className completion" |
|
1488 |
||
1489 |
^ self entryCompletionBlockFor:#'packageCompletion:inEnvironment:' |
|
1490 |
||
1491 |
"Created: / 10-08-2006 / 13:22:31 / cg" |
|
1492 |
! |
|
1493 |
||
2661
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1494 |
selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1495 |
"given a partial selector, return an array consisting of |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1496 |
2 entries: 1st: the longest match |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1497 |
2nd: collection consisting of matching implemented selectors" |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1498 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1499 |
|matches best lcSym| |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1500 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1501 |
matches := IdentitySet new. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1502 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1503 |
"/ search for exact match |
3751 | 1504 |
anEnvironment allMethodsWithSelectorDo:[:eachMethod :eachSelector | |
1505 |
(eachSelector startsWith:aPartialSymbolName) ifTrue:[ |
|
1506 |
matches add:eachSelector |
|
2661
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1507 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1508 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1509 |
matches isEmpty ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1510 |
"/ search for case-ignoring match |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1511 |
lcSym := aPartialSymbolName asLowercase. |
3751 | 1512 |
anEnvironment allMethodsWithSelectorDo:[:eachMethod :eachSelector | |
1513 |
(eachSelector asLowercase startsWith:lcSym) ifTrue:[ |
|
1514 |
matches add:eachSelector |
|
2661
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1515 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1516 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1517 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1518 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1519 |
matches isEmpty ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1520 |
^ Array with:aPartialSymbolName with:(Array with:aPartialSymbolName) |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1521 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1522 |
matches size == 1 ifTrue:[ |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1523 |
^ Array with:matches first with:(matches asArray) |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1524 |
]. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1525 |
matches := matches asSortedCollection. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1526 |
best := matches longestCommonPrefix. |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1527 |
^ Array with:best with:matches asArray |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1528 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1529 |
" |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1530 |
Smalltalk selectorCompletion:'at:p' |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1531 |
Smalltalk selectorCompletion:'nextP' |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1532 |
Smalltalk selectorCompletion:'nextp' |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1533 |
" |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1534 |
|
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1535 |
"Modified: / 7.6.1996 / 08:44:33 / stefan" |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1536 |
"Modified: / 14.6.1998 / 15:54:03 / cg" |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1537 |
! ! |
f68913f2facf
moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents:
2560
diff
changeset
|
1538 |
|
2376 | 1539 |
!DoWhatIMeanSupport class methodsFor:'rename support'! |
1540 |
||
1541 |
goodRenameDefaultFor:oldName lastOld:lastOldName lastNew:lastNewName |
|
2513 | 1542 |
"generate a reasonable default for a rename operation. |
1543 |
(used for rename category etc.)" |
|
2468 | 1544 |
|
2559 | 1545 |
|prefix suffix lastNewSize lastOldSize left right inserted deleted| |
2376 | 1546 |
|
1547 |
lastNewName isNil ifTrue:[ ^ nil]. |
|
1548 |
||
1549 |
lastNewSize := lastNewName size. |
|
1550 |
lastOldSize := lastOldName size. |
|
1551 |
||
1552 |
(lastNewName endsWith:lastOldName) ifTrue:[ |
|
2514 | 1553 |
"last rename was |
1554 |
'foo' -> 'Xfoo' |
|
1555 |
then, a good default for |
|
1556 |
'bar' would be 'Xbar' |
|
1557 |
" |
|
2376 | 1558 |
prefix := lastNewName copyTo:(lastNewSize - lastOldSize). |
1559 |
^ (prefix , oldName). |
|
1560 |
]. |
|
1561 |
(lastOldName endsWith:lastNewName) ifTrue:[ |
|
2514 | 1562 |
"last rename was |
1563 |
'Xfoo' -> 'foo' |
|
1564 |
then, a good default for |
|
1565 |
'Xbar' would be 'bar' |
|
1566 |
" |
|
2376 | 1567 |
prefix := lastOldName copyTo:(lastOldSize - lastNewSize). |
2514 | 1568 |
(oldName startsWith:prefix) ifTrue:[ |
1569 |
^ (oldName copyFrom:prefix size+1). |
|
1570 |
] |
|
1571 |
]. |
|
1572 |
(lastOldName asLowercase = lastNewName asLowercase) ifTrue:[ |
|
1573 |
(lastOldName first ~= lastNewName first) ifTrue:[ |
|
1574 |
(lastOldName first isLowercase = oldName first isLowercase) ifTrue:[ |
|
1575 |
"last rename was |
|
1576 |
'xfoo' -> 'Xfoo' |
|
1577 |
then, a good default for |
|
1578 |
'xbar' would be 'Xbar' |
|
1579 |
" |
|
1580 |
lastOldName first isLowercase ifTrue:[ |
|
1581 |
^ oldName first asUppercase asString , (oldName copyFrom:2). |
|
1582 |
] ifFalse:[ |
|
1583 |
^ oldName first asLowercase asString , (oldName copyFrom:2). |
|
1584 |
] |
|
1585 |
] |
|
1586 |
]. |
|
2376 | 1587 |
]. |
1588 |
(lastOldName withoutSeparators = lastNewName) ifTrue:[ |
|
2514 | 1589 |
"last rename was |
1590 |
' foo ' -> 'foo' |
|
1591 |
then, a good default for |
|
1592 |
' bar ' would be 'bar' |
|
1593 |
" |
|
2376 | 1594 |
^ oldName withoutSeparators. |
1595 |
]. |
|
1596 |
(lastNewName startsWith:lastOldName) ifTrue:[ |
|
2557 | 1597 |
"last rename was |
1598 |
'foo' -> 'fooX' |
|
1599 |
then, a good default for |
|
1600 |
'bar' would be 'barX' |
|
1601 |
" |
|
2376 | 1602 |
suffix := lastNewName copyLast:(lastNewSize - lastOldSize). |
1603 |
^ (oldName , suffix). |
|
1604 |
]. |
|
1605 |
(lastOldName startsWith:lastNewName) ifTrue:[ |
|
2557 | 1606 |
"last rename was |
1607 |
'fooX' -> 'foo' |
|
1608 |
then, a good default for |
|
1609 |
'barX' would be 'bar' |
|
1610 |
" |
|
2376 | 1611 |
suffix := lastOldName copyLast:(lastOldSize - lastNewSize). |
1612 |
(oldName endsWith:suffix) ifTrue:[ |
|
1613 |
^ (oldName copyWithoutLast:suffix size). |
|
1614 |
] |
|
1615 |
]. |
|
2558 | 1616 |
|
2557 | 1617 |
prefix := lastOldName commonPrefixWith:lastNewName. |
1618 |
suffix := lastOldName commonSuffixWith:lastNewName. |
|
2559 | 1619 |
|
2558 | 1620 |
(prefix size > 0) ifTrue:[ |
1621 |
(suffix size > 0) ifTrue:[ |
|
2559 | 1622 |
|
1623 |
prefix := prefix copyTo:(((lastNewName size - suffix size) min:(lastOldName size - suffix size)) min:prefix size). |
|
1624 |
||
2558 | 1625 |
"last rename was |
1626 |
'fooR' -> 'fooXR' |
|
1627 |
then, a good default for |
|
1628 |
'barR' would be 'barXR' |
|
1629 |
" |
|
1630 |
left := lastOldName copyTo:prefix size. |
|
1631 |
right := lastOldName copyLast:suffix size. |
|
2559 | 1632 |
lastNewSize > lastOldSize ifTrue:[ |
1633 |
inserted := (lastNewName copyFrom:(left size + 1)) copyWithoutLast:(right size). |
|
1634 |
inserted size > 0 ifTrue:[ |
|
3532 | 1635 |
(oldName startsWith:prefix) ifTrue:[ |
1636 |
^ (oldName copyTo:prefix size) , inserted , (oldName copyFrom:prefix size + 1) |
|
1637 |
]. |
|
2559 | 1638 |
]. |
1639 |
]. |
|
3585 | 1640 |
(oldName string endsWith:suffix string) ifTrue:[ |
1641 |
deleted := (lastOldName string copyFrom:(prefix size + 1)) copyWithoutLast:(suffix size). |
|
1642 |
(oldName size-suffix size-deleted size + 1) >= 1 ifTrue:[ |
|
1643 |
((oldName copyFrom:oldName size-suffix size-deleted size + 1) copyTo:deleted size) = deleted ifTrue:[ |
|
1644 |
"last rename was |
|
1645 |
'fooXR' -> 'fooR' |
|
1646 |
then, a good default for |
|
1647 |
'barXS' would be 'barS' |
|
1648 |
" |
|
1649 |
^ (oldName copyTo:oldName size-suffix size-deleted size) , suffix |
|
1650 |
] |
|
2559 | 1651 |
] |
1652 |
] |
|
2558 | 1653 |
]. |
1654 |
||
1655 |
(oldName endsWith:(lastOldName copyFrom:prefix size+1)) ifTrue:[ |
|
1656 |
"last rename was |
|
1657 |
'fooX' -> 'fooY' |
|
1658 |
then, a good default for |
|
1659 |
'barX' would be 'barY' |
|
1660 |
" |
|
1661 |
left := oldName copyWithoutLast:(lastOldName copyFrom:prefix size+1) size. |
|
1662 |
right := lastNewName copyFrom:prefix size+1. |
|
1663 |
^ left , right |
|
1664 |
] |
|
2557 | 1665 |
]. |
2376 | 1666 |
|
2382
d89d86edaae4
separated default for arbitrary renames and deault for files.
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
1667 |
^ nil |
2557 | 1668 |
|
1669 |
" |
|
2558 | 1670 |
self goodRenameDefaultFor:'bar' lastOld:'foo' lastNew:'fooXX' |
1671 |
self goodRenameDefaultFor:'bar' lastOld:'foo' lastNew:'XXfoo' |
|
1672 |
||
1673 |
self goodRenameDefaultFor:'barXX' lastOld:'fooXX' lastNew:'foo' |
|
1674 |
self goodRenameDefaultFor:'XXbar' lastOld:'XXfoo' lastNew:'foo' |
|
1675 |
||
1676 |
self goodRenameDefaultFor:'barXX' lastOld:'fooXX' lastNew:'fooYY' |
|
1677 |
self goodRenameDefaultFor:'XXbar' lastOld:'XXfoo' lastNew:'foo' |
|
1678 |
||
2559 | 1679 |
self goodRenameDefaultFor:'bar2' lastOld:'foo1' lastNew:'foo01' |
1680 |
self goodRenameDefaultFor:'barXY' lastOld:'fooXY' lastNew:'fooY' |
|
2560 | 1681 |
self goodRenameDefaultFor:'bar' lastOld:'foo' lastNew:'fXoo' |
1682 |
self goodRenameDefaultFor:'bar' lastOld:'foo' lastNew:'fXXXoo' |
|
2559 | 1683 |
self goodRenameDefaultFor:'bar' lastOld:'foo' lastNew:'foXXXo' |
1684 |
||
1685 |
self goodRenameDefaultFor:'bar001' lastOld:'foo001' lastNew:'foo002_001' |
|
2560 | 1686 |
self goodRenameDefaultFor:'CoastCore-CSFoo' lastOld:'CoastCore-CSBar' lastNew:'Coast-Core-CSBar' |
2557 | 1687 |
" |
2382
d89d86edaae4
separated default for arbitrary renames and deault for files.
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
1688 |
! |
d89d86edaae4
separated default for arbitrary renames and deault for files.
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
1689 |
|
d89d86edaae4
separated default for arbitrary renames and deault for files.
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
1690 |
goodRenameDefaultForFile:oldName lastOld:lastOldName lastNew:lastNewName |
2513 | 1691 |
"generate a reasonable default for a file rename operation. |
1692 |
(Try to rename multiple files in the new fileBrowser, |
|
1693 |
to see what this is doing)" |
|
2468 | 1694 |
|
2382
d89d86edaae4
separated default for arbitrary renames and deault for files.
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
1695 |
|prefix suffix t |
d89d86edaae4
separated default for arbitrary renames and deault for files.
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
1696 |
lastOldWOSuffix lastNewWOSuffix oldWOSuffix lastOldRest oldRest lastNewRest |
d89d86edaae4
separated default for arbitrary renames and deault for files.
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
1697 |
lastRemoved lastInserted default| |
d89d86edaae4
separated default for arbitrary renames and deault for files.
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
1698 |
|
d89d86edaae4
separated default for arbitrary renames and deault for files.
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
1699 |
default := self goodRenameDefaultFor:oldName lastOld:lastOldName lastNew:lastNewName. |
d89d86edaae4
separated default for arbitrary renames and deault for files.
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
1700 |
default notNil ifTrue:[ ^ default]. |
d89d86edaae4
separated default for arbitrary renames and deault for files.
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
1701 |
|
3135
7ad9ff29225e
changed #classCategoryLoadFromRepository
Claus Gittinger <cg@exept.de>
parents:
2977
diff
changeset
|
1702 |
lastOldWOSuffix := lastOldName asFilename nameWithoutSuffix. |
7ad9ff29225e
changed #classCategoryLoadFromRepository
Claus Gittinger <cg@exept.de>
parents:
2977
diff
changeset
|
1703 |
lastNewWOSuffix := lastNewName asFilename nameWithoutSuffix. |
7ad9ff29225e
changed #classCategoryLoadFromRepository
Claus Gittinger <cg@exept.de>
parents:
2977
diff
changeset
|
1704 |
oldWOSuffix := oldName asFilename nameWithoutSuffix. |
2376 | 1705 |
|
2434 | 1706 |
"/ suffix change ? |
1707 |
lastOldWOSuffix = lastNewWOSuffix ifTrue:[ |
|
1708 |
lastOldName asFilename suffix ~= lastNewName asFilename suffix ifTrue:[ |
|
1709 |
^ (oldName asFilename withSuffix:(lastNewName asFilename suffix)) pathName |
|
1710 |
]. |
|
1711 |
]. |
|
1712 |
||
2553 | 1713 |
default := self goodRenameDefaultFor:oldWOSuffix lastOld:lastOldWOSuffix lastNew:lastNewWOSuffix. |
1714 |
default notNil ifTrue:[ |
|
1715 |
lastOldRest := lastOldName copyFrom:lastOldWOSuffix size + 1. |
|
1716 |
lastNewRest := lastNewName copyFrom:lastNewWOSuffix size + 1. |
|
1717 |
oldRest := oldName copyFrom:oldWOSuffix size + 1. |
|
1718 |
||
1719 |
^ default , lastNewRest |
|
1720 |
]. |
|
1721 |
||
2376 | 1722 |
prefix := lastOldWOSuffix commonPrefixWith:oldWOSuffix. |
1723 |
(lastNewWOSuffix startsWith:prefix) ifTrue:[ |
|
1724 |
lastOldRest := lastOldWOSuffix copyFrom:prefix size + 1. |
|
1725 |
lastNewRest := lastNewWOSuffix copyFrom:prefix size + 1. |
|
1726 |
oldRest := oldWOSuffix copyFrom:prefix size + 1. |
|
1727 |
||
1728 |
(lastNewRest endsWith:lastOldRest) ifTrue:[ |
|
1729 |
t := lastNewRest copyWithoutLast:lastOldRest size. |
|
1730 |
^ ((prefix , t , oldRest) asFilename withSuffix:oldName asFilename suffix) name |
|
1731 |
]. |
|
1732 |
]. |
|
1733 |
||
1734 |
suffix := lastOldWOSuffix commonSuffixWith:lastNewWOSuffix. |
|
1735 |
suffix size > 0 ifTrue:[ |
|
1736 |
"/ last change changed something at the beginning |
|
1737 |
prefix := oldWOSuffix commonPrefixWith:lastOldWOSuffix. |
|
1738 |
prefix size > 0 ifTrue:[ |
|
1739 |
"/ this name starts with the same characters |
|
1740 |
lastRemoved := lastOldWOSuffix copyWithoutLast:suffix size. |
|
1741 |
lastInserted := lastNewWOSuffix copyWithoutLast:suffix size. |
|
1742 |
(lastRemoved startsWith:lastInserted) ifTrue:[ |
|
1743 |
oldWOSuffix size >= lastInserted size ifTrue:[ |
|
1744 |
^ (oldWOSuffix copyTo:lastInserted size) , (oldName copyFrom:lastRemoved size + 1) |
|
1745 |
] |
|
1746 |
]. |
|
1747 |
^ lastInserted , (oldName copyFrom:lastRemoved size + 1) |
|
1748 |
]. |
|
1749 |
]. |
|
1750 |
||
1751 |
^ nil |
|
3135
7ad9ff29225e
changed #classCategoryLoadFromRepository
Claus Gittinger <cg@exept.de>
parents:
2977
diff
changeset
|
1752 |
|
7ad9ff29225e
changed #classCategoryLoadFromRepository
Claus Gittinger <cg@exept.de>
parents:
2977
diff
changeset
|
1753 |
"Modified: / 07-11-2006 / 13:58:39 / cg" |
2376 | 1754 |
! ! |
1755 |
||
2515
69cbb89c127e
+isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
1756 |
!DoWhatIMeanSupport class methodsFor:'typing distance'! |
69cbb89c127e
+isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
1757 |
|
69cbb89c127e
+isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
1758 |
isKey:k1 nextTo:k2 |
2774 | 1759 |
"return true, if k1 and k2 are adjacent keys on the keyboard. |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
1760 |
This is used to specially priorize plausible typing errors of adjacent keys. |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
1761 |
CAVEAT: hard coded us- and german keyboards here." |
2515
69cbb89c127e
+isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
1762 |
|
3316 | 1763 |
^ self isKey:k1 nextTo:k2 onKeyboard:(self keyboard) |
2515
69cbb89c127e
+isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
1764 |
|
69cbb89c127e
+isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
1765 |
" |
3299
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
1766 |
self isKey:$a nextTo:$a |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
1767 |
self isKey:$a nextTo:$s |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
1768 |
self isKey:$a nextTo:$q |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
1769 |
self isKey:$a nextTo:$w |
1cd4b22434a6
code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
1770 |
self isKey:$a nextTo:$z |
2517 | 1771 |
self isKey:$a nextTo:$x |
2515
69cbb89c127e
+isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
1772 |
" |
3316 | 1773 |
|
1774 |
"Modified: / 16-01-2008 / 17:17:31 / cg" |
|
2515
69cbb89c127e
+isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
1775 |
! |
69cbb89c127e
+isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
1776 |
|
69cbb89c127e
+isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
1777 |
isKey:k1 nextTo:k2 onKeyboard:keys |
2774 | 1778 |
"return true, if k1 and k2 are adjacent keys on the keyboard defined by keys" |
2515
69cbb89c127e
+isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
1779 |
|
69cbb89c127e
+isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
1780 |
|row1 row2 col1 col2| |
69cbb89c127e
+isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
1781 |
|
2774 | 1782 |
row1 := keys findFirst:[:eachRow | col1 := eachRow indexOf:k1. col1 ~~ 0]. |
2517 | 1783 |
row1 == 0 ifTrue:[^ false]. |
2774 | 1784 |
row2 := keys findFirst:[:eachRow | col2 := eachRow indexOf:k2. col2 ~~ 0]. |
2517 | 1785 |
row2 == 0 ifTrue:[^ false]. |
2515
69cbb89c127e
+isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
1786 |
|
2774 | 1787 |
^ (row1-row2) abs <= 1 and:[(col1-col2) abs <= 1] |
2515
69cbb89c127e
+isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
1788 |
|
69cbb89c127e
+isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
1789 |
" |
2774 | 1790 |
self isKey:$a nextTo:$q |
2517 | 1791 |
self isKey:$a nextTo:$x |
2515
69cbb89c127e
+isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
1792 |
" |
3316 | 1793 |
! |
1794 |
||
1795 |
keyboard |
|
1796 |
"the keyboard layout (to find possible typing errors)" |
|
1797 |
||
1798 |
|lang| |
|
1799 |
||
1800 |
lang := UserPreferences current language. |
|
1801 |
lang == #de ifTrue:[ |
|
1802 |
^ #( |
|
1803 |
'1234567890-' |
|
1804 |
'*qwertzuiop' |
|
1805 |
'**asdfghjkl:' |
|
1806 |
'***yxcvbnm' ). |
|
1807 |
]. |
|
1808 |
||
1809 |
lang == #fr ifTrue:[ |
|
1810 |
^ #( |
|
1811 |
'1234567890' |
|
1812 |
'*azertyuiop' |
|
1813 |
'**qsdfghjklm' |
|
1814 |
'***wxcvbn,' ). |
|
1815 |
]. |
|
1816 |
||
1817 |
^ #( |
|
1818 |
'1234567890-' |
|
1819 |
'*qwertyuiop' |
|
1820 |
'**asdfghjkl:' |
|
1821 |
'***zxcvbnm' ). |
|
1822 |
||
1823 |
" |
|
1824 |
self keyboard |
|
1825 |
" |
|
1826 |
||
1827 |
"Created: / 16-01-2008 / 17:17:13 / cg" |
|
2515
69cbb89c127e
+isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
1828 |
! ! |
69cbb89c127e
+isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
1829 |
|
2376 | 1830 |
!DoWhatIMeanSupport class methodsFor:'documentation'! |
1831 |
||
1832 |
version |
|
3841
1f681141ba33
changed: #codeCompletionForMessage:inClass:codeView:
Claus Gittinger <cg@exept.de>
parents:
3761
diff
changeset
|
1833 |
^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.61 2009-11-02 16:51:57 cg Exp $' |
3761
6584390d427d
dont forget pool variables when looking for the best variable match
Claus Gittinger <cg@exept.de>
parents:
3751
diff
changeset
|
1834 |
! |
6584390d427d
dont forget pool variables when looking for the best variable match
Claus Gittinger <cg@exept.de>
parents:
3751
diff
changeset
|
1835 |
|
6584390d427d
dont forget pool variables when looking for the best variable match
Claus Gittinger <cg@exept.de>
parents:
3751
diff
changeset
|
1836 |
version_CVS |
3841
1f681141ba33
changed: #codeCompletionForMessage:inClass:codeView:
Claus Gittinger <cg@exept.de>
parents:
3761
diff
changeset
|
1837 |
^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.61 2009-11-02 16:51:57 cg Exp $' |
2376 | 1838 |
! ! |