author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Fri, 04 Oct 2013 08:25:15 +0100 | |
changeset 120 | 4fefce92f5bb |
child 123 | 1b949542c4b2 |
permissions | -rw-r--r-- |
120
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
1 |
"{ Package: 'jv:smallsense' }" |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
2 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
3 |
"{ NameSpace: SmallSense }" |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
4 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
5 |
CompletionEngine subclass:#JavaCompletionEngineSimple |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
6 |
instanceVariableNames:'class method' |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
7 |
classVariableNames:'' |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
8 |
poolDictionaries:'' |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
9 |
category:'SmallSense-Java' |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
10 |
! |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
11 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
12 |
!JavaCompletionEngineSimple methodsFor:'completion'! |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
13 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
14 |
complete |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
15 |
| line col scanner token tokens values maybeReceiverToken | |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
16 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
17 |
line := codeView listAt: codeView cursorLine. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
18 |
col := codeView cursorCol. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
19 |
line isNil ifTrue:[ ^ nil ]. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
20 |
line size < (col - 1) ifTrue:[ ^ nil ]. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
21 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
22 |
"/ we need at least three characters in order to reduce |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
23 |
"/ completions... |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
24 |
line size < 3 ifTrue:[ ^ nil ]. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
25 |
col - 3 to: col - 1 do:[:i| |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
26 |
| c | |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
27 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
28 |
c := line at: i. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
29 |
(c isLetterOrDigit or:[c == $_ or:[ c == $$ ] ]) ifFalse:[ ^ nil ] |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
30 |
]. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
31 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
32 |
"/ Setup some context vars |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
33 |
method := codeView editedMethod. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
34 |
class := method notNil ifTrue:[method mclass] ifFalse:[codeView editedClass ]. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
35 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
36 |
"/ ok, we got three character prefix, now scan the current line... |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
37 |
scanner := JavaScanner for: line. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
38 |
tokens := OrderedCollection new. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
39 |
values := OrderedCollection new. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
40 |
[ |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
41 |
[ (token := scanner nextToken) ~~ #EOF and:[ scanner tokenStartPosition < (col - 1) ] ] whileTrue:[ |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
42 |
tokens add: token. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
43 |
values add: scanner tokenValue. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
44 |
]. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
45 |
] on: Error do:[ |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
46 |
^ nil |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
47 |
]. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
48 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
49 |
"/ now check whether the butlast token is dot... |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
50 |
maybeReceiverToken := nil. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
51 |
(tokens size > 1 and:[(tokens at: tokens size - 1) == $.]) ifTrue:[ |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
52 |
"/ if so, it's likely a message send, then complete methods... |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
53 |
tokens size > 2 ifTrue:[ |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
54 |
maybeReceiverToken := values at: values size - 2. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
55 |
]. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
56 |
] ifFalse:[ |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
57 |
"/ if not, then complete local variables, fields and methods defined in the class itself. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
58 |
maybeReceiverToken := 'this'. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
59 |
]. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
60 |
maybeReceiverToken = 'this' ifTrue:[ |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
61 |
values last first isUppercase ifTrue:[ |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
62 |
self addClassesStartingWith: values last. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
63 |
] ifFalse:[ |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
64 |
self addFieldsStartingWith: values last. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
65 |
self addLocalsStartingWith: values last. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
66 |
]. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
67 |
]. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
68 |
self addMethodsForReceiver: maybeReceiverToken startingWith: values last. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
69 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
70 |
^ result |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
71 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
72 |
"Created: / 02-10-2013 / 13:55:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
73 |
"Modified: / 03-10-2013 / 17:48:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
74 |
! ! |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
75 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
76 |
!JavaCompletionEngineSimple methodsFor:'completion-individual'! |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
77 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
78 |
addClassesStartingWith: prefix |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
79 |
self allClassesDo:[:cls| |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
80 |
| name i | |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
81 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
82 |
name := cls name. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
83 |
i := name lastIndexOf: $/. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
84 |
((name size >= (i + prefix size)) |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
85 |
and:[(name at: i + 1) == prefix first |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
86 |
and:[(name at: i + prefix size) == prefix last |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
87 |
and:[(2 to: prefix size - 1) allSatisfy:[:o| (name at: i + o) == (prefix at: o)]]]]) |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
88 |
ifTrue:[ |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
89 |
result add: (ClassPO new subject: cls). |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
90 |
]. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
91 |
]. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
92 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
93 |
"Created: / 03-10-2013 / 11:16:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
94 |
"Modified: / 03-10-2013 / 18:10:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
95 |
! |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
96 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
97 |
addFieldsStartingWith: prefix |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
98 |
| klass | |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
99 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
100 |
klass := class. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
101 |
[ klass notNil ] whileTrue:[ |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
102 |
klass instVarNames do:[:nm | |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
103 |
result add: (VariablePO instanceVariable: nm in: klass). |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
104 |
]. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
105 |
klass := klass superclass. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
106 |
]. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
107 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
108 |
"Created: / 03-10-2013 / 11:16:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
109 |
! |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
110 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
111 |
addLocalsStartingWith: prefix |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
112 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
113 |
"Created: / 03-10-2013 / 17:46:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
114 |
! |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
115 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
116 |
addMethodsForReceiver: maybeReceiverToken startingWith: prefix |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
117 |
^ self addMethodsStartingWith: prefix |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
118 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
119 |
"Created: / 03-10-2013 / 17:46:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
120 |
! |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
121 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
122 |
addMethodsStartingWith: prefix |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
123 |
^ self addMethodsStartingWith: prefix filter: [:m | m isJavaMethod ] |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
124 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
125 |
"Created: / 03-10-2013 / 18:01:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
126 |
! |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
127 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
128 |
allClassesDo: aBlock |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
129 |
| loader loaders | |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
130 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
131 |
loaders := Set new. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
132 |
loader := (class notNil and:[class isJavaClass]) ifTrue:[class classLoader] ifFalse:[JavaVM systemClassLoader]. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
133 |
[ loader notNil ] whileTrue:[ |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
134 |
loaders add: loader. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
135 |
loader := loader instVarNamed: #parent. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
136 |
]. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
137 |
loaders add: nil. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
138 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
139 |
JavaVM registry classesDo:[:cls| |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
140 |
(loaders includes: cls classLoader) ifTrue:[ |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
141 |
aBlock value: cls. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
142 |
]. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
143 |
]. |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
144 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
145 |
"Created: / 03-10-2013 / 17:52:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
146 |
! ! |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
147 |