author | Claus Gittinger <cg@exept.de> |
Sun, 26 Feb 2017 15:17:18 +0100 | |
branch | cvs_MAIN |
changeset 1020 | 5cc6ac344d41 |
parent 1019 | a88253f563be |
child 1094 | 94681c0aee18 |
permissions | -rw-r--r-- |
252
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
1 |
" |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
2 |
stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
3 |
Copyright (C) 2013-2014 Jan Vrany |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
4 |
|
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
5 |
This library is free software; you can redistribute it and/or |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
6 |
modify it under the terms of the GNU Lesser General Public |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
7 |
License as published by the Free Software Foundation; either |
917 | 8 |
version 2.1 of the License. |
252
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
9 |
|
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
10 |
This library is distributed in the hope that it will be useful, |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
13 |
Lesser General Public License for more details. |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
14 |
|
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
15 |
You should have received a copy of the GNU Lesser General Public |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
16 |
License along with this library; if not, write to the Free Software |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
17 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
18 |
" |
249
8bc64027b189
Package renamed to stx:goodies/smallsense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
239
diff
changeset
|
19 |
"{ Package: 'stx:goodies/smallsense' }" |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
20 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
21 |
"{ NameSpace: SmallSense }" |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
22 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
23 |
Object subclass:#EditSupport |
164
3c5e63dbdb3b
Fixes for Groovy completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
159
diff
changeset
|
24 |
instanceVariableNames:'service codeView textView backspaceIsUndo completionController |
205
43bee6463c53
Introduced notion of `environment` to completion context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
186
diff
changeset
|
25 |
completionEnvironment snippets ignoreKeystrokes |
43bee6463c53
Introduced notion of `environment` to completion context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
186
diff
changeset
|
26 |
ignoreKeystrokesPosition' |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
27 |
classVariableNames:'' |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
28 |
poolDictionaries:'' |
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
29 |
category:'SmallSense-Core-Services' |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
30 |
! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
31 |
|
252
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
32 |
!EditSupport class methodsFor:'documentation'! |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
33 |
|
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
34 |
copyright |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
35 |
" |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
36 |
stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
37 |
Copyright (C) 2013-2014 Jan Vrany |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
38 |
|
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
39 |
This library is free software; you can redistribute it and/or |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
40 |
modify it under the terms of the GNU Lesser General Public |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
41 |
License as published by the Free Software Foundation; either |
917 | 42 |
version 2.1 of the License. |
252
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
43 |
|
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
44 |
This library is distributed in the hope that it will be useful, |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
45 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
46 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
47 |
Lesser General Public License for more details. |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
48 |
|
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
49 |
You should have received a copy of the GNU Lesser General Public |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
50 |
License along with this library; if not, write to the Free Software |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
51 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
52 |
" |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
53 |
! ! |
112
5c8f0eb0dd55
UX fixes for completion: do not close the completionwindow then pressing Ctrl-space
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
110
diff
changeset
|
54 |
|
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
55 |
!EditSupport class methodsFor:'instance creation'! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
56 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
57 |
forLanguage: aProgrammingLanguage |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
58 |
aProgrammingLanguage notNil ifTrue:[ |
917 | 59 |
aProgrammingLanguage isSmalltalk ifTrue:[ |
60 |
^ SmalltalkEditSupport new |
|
61 |
]. |
|
62 |
(aProgrammingLanguage askFor: #isJava) ifTrue:[ |
|
63 |
^ JavaEditSupport new |
|
64 |
]. |
|
65 |
(aProgrammingLanguage askFor: #isGroovy) ifTrue:[ |
|
66 |
^ GroovyEditSupport new |
|
67 |
] |
|
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
68 |
]. |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
69 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
70 |
^GenericEditSupport new. |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
71 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
72 |
"Created: / 24-07-2013 / 23:20:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
122 | 73 |
"Modified: / 04-10-2013 / 08:41:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
74 |
! ! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
75 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
76 |
!EditSupport methodsFor:'accessing'! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
77 |
|
157
c71d2e62ece2
Refactored API of CompletionEngine - caller now must set up an context pass it.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
156
diff
changeset
|
78 |
codeView |
164
3c5e63dbdb3b
Fixes for Groovy completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
159
diff
changeset
|
79 |
^ codeView |
157
c71d2e62ece2
Refactored API of CompletionEngine - caller now must set up an context pass it.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
156
diff
changeset
|
80 |
|
c71d2e62ece2
Refactored API of CompletionEngine - caller now must set up an context pass it.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
156
diff
changeset
|
81 |
"Created: / 21-01-2014 / 23:13:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
164
3c5e63dbdb3b
Fixes for Groovy completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
159
diff
changeset
|
82 |
"Modified: / 03-02-2014 / 23:28:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
157
c71d2e62ece2
Refactored API of CompletionEngine - caller now must set up an context pass it.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
156
diff
changeset
|
83 |
! |
c71d2e62ece2
Refactored API of CompletionEngine - caller now must set up an context pass it.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
156
diff
changeset
|
84 |
|
213
360f02a38ae9
Use EditSupport>>environment to allow environment customization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
205
diff
changeset
|
85 |
environment |
360f02a38ae9
Use EditSupport>>environment to allow environment customization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
205
diff
changeset
|
86 |
"raise an error: this method should be implemented (TODO)" |
360f02a38ae9
Use EditSupport>>environment to allow environment customization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
205
diff
changeset
|
87 |
|
360f02a38ae9
Use EditSupport>>environment to allow environment customization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
205
diff
changeset
|
88 |
^ service environment |
360f02a38ae9
Use EditSupport>>environment to allow environment customization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
205
diff
changeset
|
89 |
|
360f02a38ae9
Use EditSupport>>environment to allow environment customization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
205
diff
changeset
|
90 |
"Created: / 15-05-2014 / 16:44:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
360f02a38ae9
Use EditSupport>>environment to allow environment customization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
205
diff
changeset
|
91 |
! |
360f02a38ae9
Use EditSupport>>environment to allow environment customization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
205
diff
changeset
|
92 |
|
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
93 |
language |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
94 |
^ self subclassResponsibility. |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
95 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
96 |
"Created: / 24-07-2013 / 23:44:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
97 |
! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
98 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
99 |
service |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
100 |
^ service |
164
3c5e63dbdb3b
Fixes for Groovy completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
159
diff
changeset
|
101 |
! |
3c5e63dbdb3b
Fixes for Groovy completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
159
diff
changeset
|
102 |
|
3c5e63dbdb3b
Fixes for Groovy completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
159
diff
changeset
|
103 |
textView |
3c5e63dbdb3b
Fixes for Groovy completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
159
diff
changeset
|
104 |
^ textView |
3c5e63dbdb3b
Fixes for Groovy completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
159
diff
changeset
|
105 |
|
3c5e63dbdb3b
Fixes for Groovy completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
159
diff
changeset
|
106 |
"Created: / 03-02-2014 / 23:28:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
107 |
! ! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
108 |
|
120
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
109 |
!EditSupport methodsFor:'accessing-classes'! |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
110 |
|
205
43bee6463c53
Introduced notion of `environment` to completion context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
186
diff
changeset
|
111 |
completionControllerClass |
43bee6463c53
Introduced notion of `environment` to completion context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
186
diff
changeset
|
112 |
"raise an error: this method should be implemented (TODO)" |
43bee6463c53
Introduced notion of `environment` to completion context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
186
diff
changeset
|
113 |
|
43bee6463c53
Introduced notion of `environment` to completion context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
186
diff
changeset
|
114 |
^ CompletionController |
43bee6463c53
Introduced notion of `environment` to completion context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
186
diff
changeset
|
115 |
|
43bee6463c53
Introduced notion of `environment` to completion context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
186
diff
changeset
|
116 |
"Created: / 13-05-2014 / 16:13:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
43bee6463c53
Introduced notion of `environment` to completion context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
186
diff
changeset
|
117 |
! |
43bee6463c53
Introduced notion of `environment` to completion context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
186
diff
changeset
|
118 |
|
120
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
119 |
completionEngineClass |
917 | 120 |
"Returns a code completion engine class or nil, of |
120
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
121 |
no completion is supported" |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
122 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
123 |
^ nil |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
124 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
125 |
"Created: / 03-10-2013 / 17:43:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
134
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
126 |
! |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
127 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
128 |
scannerClass |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
129 |
"Returns a class to use for scanning lines. If nil, scanning is |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
130 |
not supported and scanLine* methods will return an empty array." |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
131 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
132 |
^ nil |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
133 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
134 |
"Created: / 22-10-2013 / 00:33:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
120
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
135 |
! ! |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
136 |
|
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
137 |
!EditSupport methodsFor:'editing'! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
138 |
|
917 | 139 |
electricDeleteCharacterAtCol: col |
159
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
140 |
textView deleteCharAtLine: textView cursorLine col: col |
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
141 |
|
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
142 |
"Created: / 22-01-2014 / 21:17:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
143 |
! |
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
144 |
|
917 | 145 |
electricDeleteCharacterAtLine:line col: col |
159
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
146 |
textView deleteCharAtLine: line col: col |
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
147 |
|
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
148 |
"Created: / 22-01-2014 / 21:16:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
149 |
! |
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
150 |
|
917 | 151 |
electricDo:aBlock |
919 | 152 |
| completionSupport | |
153 |
||
154 |
(completionSupport := textView completionSupport) notNil ifTrue:[ |
|
155 |
completionSupport |
|
156 |
stopCompletionProcess; |
|
157 |
closeCompletionView. |
|
159
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
158 |
]. |
89
8ff5fb2b27bf
Improvement in (Smalltalk)EditSupport.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
159 |
textView hasSelection ifTrue:[ |
919 | 160 |
textView undoableDo:[ textView deleteSelection ]. |
89
8ff5fb2b27bf
Improvement in (Smalltalk)EditSupport.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
161 |
]. |
159
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
162 |
textView undoableDo:[ aBlock value. ]. |
89
8ff5fb2b27bf
Improvement in (Smalltalk)EditSupport.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
163 |
backspaceIsUndo := true. |
8ff5fb2b27bf
Improvement in (Smalltalk)EditSupport.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
164 |
|
8ff5fb2b27bf
Improvement in (Smalltalk)EditSupport.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
165 |
"Created: / 17-09-2013 / 23:15:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
134
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
166 |
"Modified: / 22-10-2013 / 03:15:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
89
8ff5fb2b27bf
Improvement in (Smalltalk)EditSupport.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
167 |
! |
8ff5fb2b27bf
Improvement in (Smalltalk)EditSupport.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
168 |
|
917 | 169 |
electricInsert:text |
159
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
170 |
self electricInsert:text advanceCursorBy:nil. |
135
f40d2ac07f38
Electric editing for Smalltalk: autoinsert space fter assignment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
134
diff
changeset
|
171 |
|
f40d2ac07f38
Electric editing for Smalltalk: autoinsert space fter assignment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
134
diff
changeset
|
172 |
"Created: / 22-10-2013 / 11:08:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
f40d2ac07f38
Electric editing for Smalltalk: autoinsert space fter assignment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
134
diff
changeset
|
173 |
! |
f40d2ac07f38
Electric editing for Smalltalk: autoinsert space fter assignment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
134
diff
changeset
|
174 |
|
917 | 175 |
electricInsert:stringOrLines advanceCursorBy:offsetOrNil |
176 |
^ self |
|
177 |
electricInsert:stringOrLines |
|
178 |
advanceCursorBy:offsetOrNil |
|
179 |
ignoreKeystrokes:nil |
|
155
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
180 |
|
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
181 |
"Created: / 22-10-2013 / 11:56:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
182 |
"Modified: / 19-01-2014 / 20:29:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
183 |
! |
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
184 |
|
917 | 185 |
electricInsert:stringOrLines advanceCursorBy:offsetOrNil ignoreKeystrokes:ignoreKeystrokeSequence |
144
a43236d0c411
Indentation fixes for electric-inserted code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
139
diff
changeset
|
186 |
"Insert given stringOrLines. If offsetOrNil is not nil, then |
155
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
187 |
move cursor by `offsetOrNil` after the **begining** of |
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
188 |
inserted text. If `ignoreKeystrokeSequence` is not nil and not empty, then if |
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
189 |
subsequent key strokes are ignored (i.e, does nothing) if matches |
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
190 |
the given sequence. This is used to avoid duplication if user is not |
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
191 |
aware of electric insertion and types whole text that has been |
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
192 |
(electrically) inserted). |
144
a43236d0c411
Indentation fixes for electric-inserted code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
139
diff
changeset
|
193 |
|
a43236d0c411
Indentation fixes for electric-inserted code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
139
diff
changeset
|
194 |
`stringOrLines` could be either string or collection of strings (lines) |
a43236d0c411
Indentation fixes for electric-inserted code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
139
diff
changeset
|
195 |
`offsetOrNil` could be either integer (cursor is then advanced by |
917 | 196 |
offsetOrNil characters after **begining** of inserted text) |
197 |
or point (x,y, cursor is then advanced by x lines after current |
|
198 |
line and by y characters after beggining of the inserted text |
|
199 |
(if x == 0) or at set at column y (if x ~~ 0) |
|
155
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
200 |
`ignoreKeystrokeSequence` a sequenceable collection of keys (in a form |
917 | 201 |
as passed to #keyPress:x:y: method." |
202 |
||
159
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
203 |
| lineOffset colOffset newCursorCol newCursorLine advanceCursor | |
144
a43236d0c411
Indentation fixes for electric-inserted code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
139
diff
changeset
|
204 |
|
a43236d0c411
Indentation fixes for electric-inserted code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
139
diff
changeset
|
205 |
advanceCursor := false. |
a43236d0c411
Indentation fixes for electric-inserted code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
139
diff
changeset
|
206 |
offsetOrNil notNil ifTrue:[ |
917 | 207 |
lineOffset := offsetOrNil isPoint ifTrue:[ |
208 |
offsetOrNil x |
|
209 |
] ifFalse:[ 0 ]. |
|
210 |
colOffset := offsetOrNil isPoint ifTrue:[ |
|
211 |
offsetOrNil y |
|
212 |
] ifFalse:[ |
|
213 |
offsetOrNil |
|
214 |
]. |
|
215 |
newCursorLine := textView cursorLine + lineOffset. |
|
216 |
newCursorCol := (lineOffset == 0 |
|
217 |
ifTrue:[ textView cursorCol ] |
|
218 |
ifFalse:[ 0 ]) + colOffset. |
|
219 |
advanceCursor := true. |
|
144
a43236d0c411
Indentation fixes for electric-inserted code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
139
diff
changeset
|
220 |
]. |
917 | 221 |
self |
222 |
electricDo:[ |
|
223 |
stringOrLines isString ifTrue:[ |
|
224 |
"/ Simple strin |
|
225 |
textView insertStringAtCursor:stringOrLines. |
|
226 |
] ifFalse:[ |
|
227 |
"/ C |
|
228 |
textView insertLines:stringOrLines withCR:false. |
|
229 |
]. |
|
230 |
advanceCursor ifTrue:[ |
|
231 |
(textView cursorLine ~~ newCursorLine |
|
232 |
or:[ textView cursorCol ~~ newCursorCol ]) |
|
233 |
ifTrue:[ textView cursorLine:newCursorLine col:newCursorCol. ]. |
|
234 |
]. |
|
235 |
]. |
|
155
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
236 |
ignoreKeystrokeSequence notEmptyOrNil ifTrue:[ |
917 | 237 |
ignoreKeystrokes := ignoreKeystrokeSequence. |
238 |
ignoreKeystrokesPosition := 1. |
|
155
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
239 |
]. |
144
a43236d0c411
Indentation fixes for electric-inserted code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
139
diff
changeset
|
240 |
|
155
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
241 |
"Created: / 19-01-2014 / 20:29:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
242 |
"Modified: / 20-01-2014 / 09:24:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
159
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
243 |
"Modified (format): / 22-01-2014 / 21:13:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
137
12232e62cf54
Fixes in electring snippets (both in API and Smalltalk snippets)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
135
diff
changeset
|
244 |
! |
12232e62cf54
Fixes in electring snippets (both in API and Smalltalk snippets)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
135
diff
changeset
|
245 |
|
917 | 246 |
electricInsert:text ignoreKeystrokes:ignore |
247 |
self |
|
248 |
electricInsert:text |
|
249 |
advanceCursorBy:nil |
|
250 |
ignoreKeystrokes:ignore |
|
157
c71d2e62ece2
Refactored API of CompletionEngine - caller now must set up an context pass it.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
156
diff
changeset
|
251 |
|
c71d2e62ece2
Refactored API of CompletionEngine - caller now must set up an context pass it.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
156
diff
changeset
|
252 |
"Created: / 21-01-2014 / 23:29:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
c71d2e62ece2
Refactored API of CompletionEngine - caller now must set up an context pass it.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
156
diff
changeset
|
253 |
! |
c71d2e62ece2
Refactored API of CompletionEngine - caller now must set up an context pass it.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
156
diff
changeset
|
254 |
|
917 | 255 |
electricInsertBlockOpenedBy:openText closedBy:closeText |
919 | 256 |
| completionSupport indent lines autoIndent | |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
257 |
|
919 | 258 |
(completionSupport := textView completionSupport) notNil ifTrue:[ |
259 |
completionSupport |
|
260 |
stopCompletionProcess; |
|
261 |
closeCompletionView. |
|
159
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
262 |
]. |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
263 |
indent := self indentAtCursorLine. |
159
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
264 |
autoIndent := textView autoIndent. |
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
265 |
textView autoIndent:false. |
137
12232e62cf54
Fixes in electring snippets (both in API and Smalltalk snippets)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
135
diff
changeset
|
266 |
[ |
919 | 267 |
textView undoableDo:[ |
268 |
lines := Array |
|
269 |
with:openText ? '' |
|
270 |
with:'' |
|
271 |
with:((String new:indent withAll:Character space) , closeText). |
|
272 |
self electricInsert:lines advanceCursorBy:1 @ (indent + 5) |
|
273 |
]. |
|
1019 | 274 |
] ensure:[ |
275 |
textView autoIndent:autoIndent |
|
919 | 276 |
]. |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
277 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
278 |
"Created: / 25-07-2013 / 10:41:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
159
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
279 |
"Modified: / 22-01-2014 / 21:20:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
134
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
280 |
! |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
281 |
|
159
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
282 |
electricInsertSnippet |
134
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
283 |
^ false |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
284 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
285 |
"Created: / 22-10-2013 / 01:54:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
286 |
! ! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
287 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
288 |
!EditSupport methodsFor:'event handling'! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
289 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
290 |
keyPress: key x:x y:y in: view |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
291 |
"Handles an event in given view (a subview of codeView). |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
292 |
If the method returns true, the event will not be processed |
155
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
293 |
by the view. |
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
294 |
|
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
295 |
IMPORTANT: Never ever call `^ super keyPress: key x:x y:y in: view`, |
1019 | 296 |
as keyPressIgnore... advances position and calling keyPressIgnore here |
155
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
297 |
and calling super would advance it twice!! |
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
298 |
" |
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
299 |
|
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
300 |
view ~~ textView ifTrue:[ ^ false ]. |
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
301 |
|
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
302 |
(self keyPressIgnored: key) ifTrue:[ |
1019 | 303 |
^ true. |
155
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
304 |
]. |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
305 |
|
134
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
306 |
key == Character space ifTrue:[ |
1019 | 307 |
^ self electricInsertSnippet |
134
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
308 |
]. |
109
59448a46a48f
Completion refactoring (part 2).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
108
diff
changeset
|
309 |
|
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
310 |
^false |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
311 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
312 |
"Created: / 24-07-2013 / 23:31:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
217
6ff466b83ff9
Fixes and improvements for Java/Groovy completion (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
213
diff
changeset
|
313 |
"Modified: / 17-05-2014 / 21:22:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
155
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
314 |
! |
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
315 |
|
274
2cfcd8eb9761
Fixes for issue #10: Extra characters inserted when typing too fast and complete-if-ambiguous is on
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
252
diff
changeset
|
316 |
keyPressIgnored |
2cfcd8eb9761
Fixes for issue #10: Extra characters inserted when typing too fast and complete-if-ambiguous is on
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
252
diff
changeset
|
317 |
"Advance position in keyPressIgnore buffer. Return true if position has been edvanced, false othwrwise" |
2cfcd8eb9761
Fixes for issue #10: Extra characters inserted when typing too fast and complete-if-ambiguous is on
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
252
diff
changeset
|
318 |
ignoreKeystrokes notNil ifTrue:[ |
917 | 319 |
ignoreKeystrokesPosition := ignoreKeystrokesPosition + 1. |
320 |
ignoreKeystrokesPosition > ignoreKeystrokes size ifTrue:[ |
|
321 |
"/ Nil out instvars if there's no more keys to ignore. |
|
322 |
ignoreKeystrokes := ignoreKeystrokesPosition := nil. |
|
323 |
]. |
|
324 |
^ true. |
|
274
2cfcd8eb9761
Fixes for issue #10: Extra characters inserted when typing too fast and complete-if-ambiguous is on
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
252
diff
changeset
|
325 |
]. |
2cfcd8eb9761
Fixes for issue #10: Extra characters inserted when typing too fast and complete-if-ambiguous is on
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
252
diff
changeset
|
326 |
^ false. |
2cfcd8eb9761
Fixes for issue #10: Extra characters inserted when typing too fast and complete-if-ambiguous is on
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
252
diff
changeset
|
327 |
|
2cfcd8eb9761
Fixes for issue #10: Extra characters inserted when typing too fast and complete-if-ambiguous is on
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
252
diff
changeset
|
328 |
"Created: / 11-08-2014 / 14:56:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2cfcd8eb9761
Fixes for issue #10: Extra characters inserted when typing too fast and complete-if-ambiguous is on
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
252
diff
changeset
|
329 |
! |
2cfcd8eb9761
Fixes for issue #10: Extra characters inserted when typing too fast and complete-if-ambiguous is on
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
252
diff
changeset
|
330 |
|
155
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
331 |
keyPressIgnored: key |
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
332 |
ignoreKeystrokes notNil ifTrue:[ |
917 | 333 |
(ignoreKeystrokes at: ignoreKeystrokesPosition) == key ifTrue:[ |
334 |
"/ Key stroke should be ignored... |
|
335 |
ignoreKeystrokesPosition := ignoreKeystrokesPosition + 1. |
|
336 |
ignoreKeystrokesPosition > ignoreKeystrokes size ifTrue:[ |
|
337 |
"/ Nil out instvars if there's no more keys to ignore. |
|
338 |
ignoreKeystrokes := ignoreKeystrokesPosition := nil. |
|
339 |
]. |
|
340 |
^ true. |
|
341 |
] ifFalse:[ |
|
342 |
"/ Nil out instvars, user typed something else!! |
|
343 |
ignoreKeystrokes := ignoreKeystrokesPosition := nil. |
|
344 |
^ false. |
|
345 |
]. |
|
155
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
346 |
]. |
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
347 |
^ false. |
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
348 |
|
d792aed09149
Initial support for ignoring keystrokes to avoid duplicate text when electric insert is active.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
349 |
"Created: / 20-01-2014 / 09:11:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
274
2cfcd8eb9761
Fixes for issue #10: Extra characters inserted when typing too fast and complete-if-ambiguous is on
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
252
diff
changeset
|
350 |
"Modified (comment): / 11-08-2014 / 14:54:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
134
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
351 |
! |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
352 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
353 |
keyPressSpace |
159
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
354 |
^ self electricInsertSnippet |
134
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
355 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
356 |
"Created: / 22-10-2013 / 01:43:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
108
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
357 |
! ! |
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
358 |
|
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
359 |
!EditSupport methodsFor:'initialization'! |
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
360 |
|
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
361 |
initializeCompletion |
219
c69943a410fd
Do not cache completion controller in edit support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
362 |
| controller | |
c69943a410fd
Do not cache completion controller in edit support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
363 |
|
917 | 364 |
(UserPreferences current smallSenseCompletionEnabled == true) ifTrue:[ |
919 | 365 |
self completionEngineClass notNil ifTrue:[ |
366 |
|textView| |
|
1019 | 367 |
|
919 | 368 |
textView := service textView. |
369 |
controller := self completionControllerClass for: textView. |
|
370 |
controller support: self. |
|
371 |
textView completionSupport: controller. |
|
372 |
]. |
|
120
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
373 |
]. |
108
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
374 |
|
219
c69943a410fd
Do not cache completion controller in edit support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
375 |
"Created: / 18-05-2014 / 12:40:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
108
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
376 |
! |
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
377 |
|
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
378 |
initializeForService:aSmallSenseService |
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
379 |
service := aSmallSenseService. |
164
3c5e63dbdb3b
Fixes for Groovy completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
159
diff
changeset
|
380 |
codeView := aSmallSenseService codeView. |
108
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
381 |
textView := aSmallSenseService textView. |
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
382 |
backspaceIsUndo := false. |
120
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
383 |
self initializeCompletion. |
108
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
384 |
|
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
385 |
"Created: / 27-09-2013 / 13:19:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
164
3c5e63dbdb3b
Fixes for Groovy completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
159
diff
changeset
|
386 |
"Modified: / 03-02-2014 / 23:28:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
387 |
! ! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
388 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
389 |
!EditSupport methodsFor:'private'! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
390 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
391 |
indentAtCursorLine |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
392 |
| line | |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
393 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
394 |
line := service textView listAt: service textView cursorLine. |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
395 |
^ line isNil ifTrue:[ |
917 | 396 |
(service textView cursorCol - 1) max: 0. |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
397 |
] ifFalse:[ |
917 | 398 |
(line indexOfNonSeparator - 1) max: 0. |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
399 |
] |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
400 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
401 |
"Created: / 25-07-2013 / 00:13:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
139
bf1538a4e7ce
Fixed off-by-one bug when computing indent level for closing curly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
137
diff
changeset
|
402 |
"Modified: / 25-10-2013 / 18:04:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
108
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
403 |
! |
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
404 |
|
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
405 |
wordBeforeCursor |
185
75738108cc3f
Support for Tab in code completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
177
diff
changeset
|
406 |
^ self wordBeforeCursorConsisitingOfCharactersMatching: [:c | c isAlphaNumeric ]. |
132
7c23c51d2cfd
Completion insertion refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
122
diff
changeset
|
407 |
|
185
75738108cc3f
Support for Tab in code completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
177
diff
changeset
|
408 |
"Created: / 27-09-2013 / 15:53:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
75738108cc3f
Support for Tab in code completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
177
diff
changeset
|
409 |
"Modified: / 31-03-2014 / 23:03:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
75738108cc3f
Support for Tab in code completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
177
diff
changeset
|
410 |
! |
75738108cc3f
Support for Tab in code completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
177
diff
changeset
|
411 |
|
75738108cc3f
Support for Tab in code completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
177
diff
changeset
|
412 |
wordBeforeCursorConsisitingOfCharactersMatching: characterMatchBlock |
75738108cc3f
Support for Tab in code completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
177
diff
changeset
|
413 |
| currentLine wordStart wordEnd | |
239
e1b7b5f0f4b7
Bug fix in completion (#updateSelection).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
234
diff
changeset
|
414 |
currentLine := textView list at: textView cursorLine ifAbsent:[ ^ '' ]. |
109
59448a46a48f
Completion refactoring (part 2).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
108
diff
changeset
|
415 |
currentLine isNil ifTrue:[ ^ '' ]. |
108
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
416 |
wordEnd := textView cursorCol - 1. |
110
5ee9a90dbed5
Bug/UX fixes for autocomplete.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
109
diff
changeset
|
417 |
wordEnd > currentLine size ifTrue:[ ^ '' ]. |
108
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
418 |
wordEnd ~~ 0 ifTrue:[ |
917 | 419 |
wordStart := wordEnd. |
420 |
[ wordStart > 0 and:[characterMatchBlock value:(currentLine at: wordStart) ] ] whileTrue:[ |
|
421 |
wordStart := wordStart - 1. |
|
422 |
]. |
|
423 |
wordStart := wordStart + 1. |
|
424 |
wordStart <= wordEnd ifTrue:[ |
|
425 |
^ currentLine copyFrom: wordStart to: wordEnd. |
|
426 |
]. |
|
108
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
427 |
]. |
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
428 |
^ '' |
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
429 |
|
185
75738108cc3f
Support for Tab in code completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
177
diff
changeset
|
430 |
"Created: / 31-03-2014 / 23:02:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
239
e1b7b5f0f4b7
Bug fix in completion (#updateSelection).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
234
diff
changeset
|
431 |
"Modified: / 17-06-2014 / 07:27:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
108
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
432 |
! ! |
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
433 |
|
134
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
434 |
!EditSupport methodsFor:'private-scanning'! |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
435 |
|
917 | 436 |
scanLineAt: lineNumber |
134
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
437 |
"Scans line at given line number. |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
438 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
439 |
Returns and array of tokens, **excluding** EOF. Each token is represented |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
440 |
by four subsequent items in the array: token type, token value, start position, end position. |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
441 |
Thus, returned array size is always multiple of 4." |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
442 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
443 |
^ self scanLineAt: lineNumber using: self scannerClass |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
444 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
445 |
"Created: / 22-10-2013 / 00:34:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
446 |
! |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
447 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
448 |
scanLineAt: lineNumber using: scannerClass |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
449 |
"Scans line at given line number using given scanner class. |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
450 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
451 |
Returns and array of tokens, **excluding** EOF. Each token is represented |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
452 |
by four subsequent items in the array: token type, token value, start position, end position. |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
453 |
Thus, returned array size is always multiple of 4." |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
454 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
455 |
| line scanner token tokenLastEndPosition | |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
456 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
457 |
scannerClass isNil ifTrue:[ ^ #() ]. |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
458 |
line := (service textView listAt: service textView cursorLine). |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
459 |
line isNil ifTrue:[ ^ #() ]. |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
460 |
scanner := scannerClass for: line string. |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
461 |
tokenLastEndPosition := 0. |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
462 |
^ OrderedCollection streamContents:[:tokens | |
917 | 463 |
[ |
464 |
[ token := scanner nextToken.token ~~ #EOF ] whileTrue:[ |
|
465 |
tokens |
|
466 |
nextPut: token; |
|
467 |
nextPut: (scanner tokenName notNil ifTrue:[scanner tokenName] ifFalse:[ scanner tokenValue printString ]); |
|
468 |
nextPut: scanner tokenStartPosition; |
|
469 |
nextPut: (tokenLastEndPosition := scanner tokenEndPosition). |
|
470 |
]. |
|
471 |
] on: Error do:[ |
|
472 |
tokens |
|
473 |
nextPut: 'Error'; |
|
474 |
nextPut: (line copyFrom: tokenLastEndPosition + 1 to: line size); |
|
475 |
nextPut: tokenLastEndPosition + 1; |
|
476 |
nextPut: line size. |
|
477 |
]. |
|
134
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
478 |
]. |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
479 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
480 |
"Created: / 22-10-2013 / 00:31:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
137
12232e62cf54
Fixes in electring snippets (both in API and Smalltalk snippets)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
135
diff
changeset
|
481 |
"Modified: / 22-10-2013 / 12:01:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
134
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
482 |
! |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
483 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
484 |
scanLineAtCursor |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
485 |
"Scans current cursor line. |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
486 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
487 |
Returns and array of tokens, **excluding** EOF. Each token is represented |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
488 |
by four subsequent items in the array: token type, token value, start position, end position. |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
489 |
Thus, returned array size is always multiple of 4." |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
490 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
491 |
^ self scanLineAt: service codeView textView cursorLine using: self scannerClass |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
492 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
493 |
"Created: / 22-10-2013 / 00:34:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
494 |
! ! |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
495 |
|
112
5c8f0eb0dd55
UX fixes for completion: do not close the completionwindow then pressing Ctrl-space
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
110
diff
changeset
|
496 |
!EditSupport class methodsFor:'documentation'! |
5c8f0eb0dd55
UX fixes for completion: do not close the completionwindow then pressing Ctrl-space
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
110
diff
changeset
|
497 |
|
863 | 498 |
version_CVS |
499 |
||
500 |
^ '$Header$' |
|
501 |
! |
|
502 |
||
112
5c8f0eb0dd55
UX fixes for completion: do not close the completionwindow then pressing Ctrl-space
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
110
diff
changeset
|
503 |
version_HG |
5c8f0eb0dd55
UX fixes for completion: do not close the completionwindow then pressing Ctrl-space
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
110
diff
changeset
|
504 |
|
5c8f0eb0dd55
UX fixes for completion: do not close the completionwindow then pressing Ctrl-space
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
110
diff
changeset
|
505 |
^ '$Changeset: <not expanded> $' |
5c8f0eb0dd55
UX fixes for completion: do not close the completionwindow then pressing Ctrl-space
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
110
diff
changeset
|
506 |
! ! |
5c8f0eb0dd55
UX fixes for completion: do not close the completionwindow then pressing Ctrl-space
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
110
diff
changeset
|
507 |