author | Claus Gittinger <cg@exept.de> |
Fri, 22 Nov 2019 15:57:21 +0100 | |
branch | cvs_MAIN |
changeset 1114 | 48012e286ec1 |
parent 1108 | 1cf3e0f5b3c8 |
permissions | -rw-r--r-- |
1094 | 1 |
"{ Encoding: utf8 }" |
2 |
||
252
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
3 |
" |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
4 |
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
|
5 |
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
|
6 |
|
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
7 |
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
|
8 |
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
|
9 |
License as published by the Free Software Foundation; either |
917 | 10 |
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
|
11 |
|
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
12 |
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
|
13 |
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
|
14 |
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
|
15 |
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
|
16 |
|
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
17 |
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
|
18 |
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
|
19 |
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
|
20 |
" |
249
8bc64027b189
Package renamed to stx:goodies/smallsense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
239
diff
changeset
|
21 |
"{ Package: 'stx:goodies/smallsense' }" |
64
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 |
"{ NameSpace: SmallSense }" |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
24 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
25 |
Object subclass:#EditSupport |
164
3c5e63dbdb3b
Fixes for Groovy completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
159
diff
changeset
|
26 |
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
|
27 |
completionEnvironment snippets ignoreKeystrokes |
43bee6463c53
Introduced notion of `environment` to completion context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
186
diff
changeset
|
28 |
ignoreKeystrokesPosition' |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
29 |
classVariableNames:'' |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
30 |
poolDictionaries:'' |
67
020b7461b15e
Package structure reorganization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
64
diff
changeset
|
31 |
category:'SmallSense-Core-Services' |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
32 |
! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
33 |
|
252
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
34 |
!EditSupport class methodsFor:'documentation'! |
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 |
copyright |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
37 |
" |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
38 |
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
|
39 |
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
|
40 |
|
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
41 |
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
|
42 |
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
|
43 |
License as published by the Free Software Foundation; either |
917 | 44 |
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
|
45 |
|
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
46 |
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
|
47 |
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
|
48 |
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
|
49 |
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
|
50 |
|
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
51 |
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
|
52 |
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
|
53 |
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
|
54 |
" |
feba6ee5c814
Added copyright notice and license information (LGPL2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
249
diff
changeset
|
55 |
! ! |
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
|
56 |
|
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
57 |
!EditSupport class methodsFor:'instance creation'! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
58 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
59 |
forLanguage: aProgrammingLanguage |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
60 |
aProgrammingLanguage notNil ifTrue:[ |
917 | 61 |
aProgrammingLanguage isSmalltalk ifTrue:[ |
62 |
^ SmalltalkEditSupport new |
|
63 |
]. |
|
64 |
(aProgrammingLanguage askFor: #isJava) ifTrue:[ |
|
65 |
^ JavaEditSupport new |
|
66 |
]. |
|
67 |
(aProgrammingLanguage askFor: #isGroovy) ifTrue:[ |
|
68 |
^ GroovyEditSupport new |
|
69 |
] |
|
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
70 |
]. |
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 |
^GenericEditSupport new. |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
73 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
74 |
"Created: / 24-07-2013 / 23:20:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
122 | 75 |
"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
|
76 |
! ! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
77 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
78 |
!EditSupport methodsFor:'accessing'! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
79 |
|
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 |
codeView |
164
3c5e63dbdb3b
Fixes for Groovy completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
159
diff
changeset
|
81 |
^ 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
|
82 |
|
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 |
"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
|
84 |
"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
|
85 |
! |
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
|
86 |
|
213
360f02a38ae9
Use EditSupport>>environment to allow environment customization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
205
diff
changeset
|
87 |
environment |
360f02a38ae9
Use EditSupport>>environment to allow environment customization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
205
diff
changeset
|
88 |
"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
|
89 |
|
360f02a38ae9
Use EditSupport>>environment to allow environment customization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
205
diff
changeset
|
90 |
^ service environment |
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 |
"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
|
93 |
! |
360f02a38ae9
Use EditSupport>>environment to allow environment customization.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
205
diff
changeset
|
94 |
|
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
95 |
language |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
96 |
^ self subclassResponsibility. |
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 |
"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
|
99 |
! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
100 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
101 |
service |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
102 |
^ service |
164
3c5e63dbdb3b
Fixes for Groovy completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
159
diff
changeset
|
103 |
! |
3c5e63dbdb3b
Fixes for Groovy completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
159
diff
changeset
|
104 |
|
3c5e63dbdb3b
Fixes for Groovy completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
159
diff
changeset
|
105 |
textView |
3c5e63dbdb3b
Fixes for Groovy completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
159
diff
changeset
|
106 |
^ textView |
3c5e63dbdb3b
Fixes for Groovy completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
159
diff
changeset
|
107 |
|
3c5e63dbdb3b
Fixes for Groovy completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
159
diff
changeset
|
108 |
"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
|
109 |
! ! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
110 |
|
120
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
111 |
!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
|
112 |
|
205
43bee6463c53
Introduced notion of `environment` to completion context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
186
diff
changeset
|
113 |
completionControllerClass |
43bee6463c53
Introduced notion of `environment` to completion context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
186
diff
changeset
|
114 |
"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
|
115 |
|
43bee6463c53
Introduced notion of `environment` to completion context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
186
diff
changeset
|
116 |
^ CompletionController |
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 |
"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
|
119 |
! |
43bee6463c53
Introduced notion of `environment` to completion context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
186
diff
changeset
|
120 |
|
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 |
completionEngineClass |
917 | 122 |
"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
|
123 |
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
|
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 |
^ nil |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
126 |
|
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
127 |
"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
|
128 |
! |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
129 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
130 |
scannerClass |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
131 |
"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
|
132 |
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
|
133 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
134 |
^ nil |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
135 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
136 |
"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
|
137 |
! ! |
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
138 |
|
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
139 |
!EditSupport methodsFor:'editing'! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
140 |
|
917 | 141 |
electricDeleteCharacterAtCol: col |
159
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
142 |
textView deleteCharAtLine: textView cursorLine col: col |
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 |
"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
|
145 |
! |
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
146 |
|
917 | 147 |
electricDeleteCharacterAtLine:line col: col |
159
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
148 |
textView deleteCharAtLine: line col: col |
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 |
"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
|
151 |
! |
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
152 |
|
917 | 153 |
electricDo:aBlock |
919 | 154 |
| completionSupport | |
155 |
||
156 |
(completionSupport := textView completionSupport) notNil ifTrue:[ |
|
157 |
completionSupport |
|
158 |
stopCompletionProcess; |
|
159 |
closeCompletionView. |
|
159
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
160 |
]. |
89
8ff5fb2b27bf
Improvement in (Smalltalk)EditSupport.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
161 |
textView hasSelection ifTrue:[ |
919 | 162 |
textView undoableDo:[ textView deleteSelection ]. |
89
8ff5fb2b27bf
Improvement in (Smalltalk)EditSupport.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
163 |
]. |
1108 | 164 |
textView undoableDo:aBlock. |
89
8ff5fb2b27bf
Improvement in (Smalltalk)EditSupport.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
165 |
backspaceIsUndo := true. |
8ff5fb2b27bf
Improvement in (Smalltalk)EditSupport.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
166 |
|
8ff5fb2b27bf
Improvement in (Smalltalk)EditSupport.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
167 |
"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
|
168 |
"Modified: / 22-10-2013 / 03:15:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1108 | 169 |
"Modified: / 11-09-2019 / 16:26:31 / Stefan Vogel" |
89
8ff5fb2b27bf
Improvement in (Smalltalk)EditSupport.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
170 |
! |
8ff5fb2b27bf
Improvement in (Smalltalk)EditSupport.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
67
diff
changeset
|
171 |
|
917 | 172 |
electricInsert:text |
159
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
173 |
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
|
174 |
|
f40d2ac07f38
Electric editing for Smalltalk: autoinsert space fter assignment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
134
diff
changeset
|
175 |
"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
|
176 |
! |
f40d2ac07f38
Electric editing for Smalltalk: autoinsert space fter assignment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
134
diff
changeset
|
177 |
|
917 | 178 |
electricInsert:stringOrLines advanceCursorBy:offsetOrNil |
179 |
^ self |
|
180 |
electricInsert:stringOrLines |
|
181 |
advanceCursorBy:offsetOrNil |
|
182 |
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
|
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 |
"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
|
185 |
"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
|
186 |
! |
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 |
|
917 | 188 |
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
|
189 |
"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
|
190 |
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
|
191 |
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
|
192 |
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
|
193 |
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
|
194 |
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
|
195 |
(electrically) inserted). |
144
a43236d0c411
Indentation fixes for electric-inserted code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
139
diff
changeset
|
196 |
|
a43236d0c411
Indentation fixes for electric-inserted code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
139
diff
changeset
|
197 |
`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
|
198 |
`offsetOrNil` could be either integer (cursor is then advanced by |
917 | 199 |
offsetOrNil characters after **begining** of inserted text) |
200 |
or point (x,y, cursor is then advanced by x lines after current |
|
201 |
line and by y characters after beggining of the inserted text |
|
202 |
(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
|
203 |
`ignoreKeystrokeSequence` a sequenceable collection of keys (in a form |
917 | 204 |
as passed to #keyPress:x:y: method." |
205 |
||
159
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
206 |
| lineOffset colOffset newCursorCol newCursorLine advanceCursor | |
144
a43236d0c411
Indentation fixes for electric-inserted code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
139
diff
changeset
|
207 |
|
a43236d0c411
Indentation fixes for electric-inserted code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
139
diff
changeset
|
208 |
advanceCursor := false. |
a43236d0c411
Indentation fixes for electric-inserted code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
139
diff
changeset
|
209 |
offsetOrNil notNil ifTrue:[ |
917 | 210 |
lineOffset := offsetOrNil isPoint ifTrue:[ |
211 |
offsetOrNil x |
|
212 |
] ifFalse:[ 0 ]. |
|
213 |
colOffset := offsetOrNil isPoint ifTrue:[ |
|
214 |
offsetOrNil y |
|
215 |
] ifFalse:[ |
|
216 |
offsetOrNil |
|
217 |
]. |
|
218 |
newCursorLine := textView cursorLine + lineOffset. |
|
219 |
newCursorCol := (lineOffset == 0 |
|
220 |
ifTrue:[ textView cursorCol ] |
|
221 |
ifFalse:[ 0 ]) + colOffset. |
|
222 |
advanceCursor := true. |
|
144
a43236d0c411
Indentation fixes for electric-inserted code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
139
diff
changeset
|
223 |
]. |
917 | 224 |
self |
225 |
electricDo:[ |
|
226 |
stringOrLines isString ifTrue:[ |
|
227 |
"/ Simple strin |
|
228 |
textView insertStringAtCursor:stringOrLines. |
|
229 |
] ifFalse:[ |
|
230 |
"/ C |
|
231 |
textView insertLines:stringOrLines withCR:false. |
|
232 |
]. |
|
233 |
advanceCursor ifTrue:[ |
|
234 |
(textView cursorLine ~~ newCursorLine |
|
235 |
or:[ textView cursorCol ~~ newCursorCol ]) |
|
236 |
ifTrue:[ textView cursorLine:newCursorLine col:newCursorCol. ]. |
|
237 |
]. |
|
238 |
]. |
|
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 |
ignoreKeystrokeSequence notEmptyOrNil ifTrue:[ |
917 | 240 |
ignoreKeystrokes := ignoreKeystrokeSequence. |
241 |
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
|
242 |
]. |
144
a43236d0c411
Indentation fixes for electric-inserted code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
139
diff
changeset
|
243 |
|
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
|
244 |
"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
|
245 |
"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
|
246 |
"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
|
247 |
! |
12232e62cf54
Fixes in electring snippets (both in API and Smalltalk snippets)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
135
diff
changeset
|
248 |
|
917 | 249 |
electricInsert:text ignoreKeystrokes:ignore |
250 |
self |
|
251 |
electricInsert:text |
|
252 |
advanceCursorBy:nil |
|
253 |
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
|
254 |
|
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
|
255 |
"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
|
256 |
! |
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
|
257 |
|
917 | 258 |
electricInsertBlockOpenedBy:openText closedBy:closeText |
919 | 259 |
| completionSupport indent lines autoIndent | |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
260 |
|
919 | 261 |
(completionSupport := textView completionSupport) notNil ifTrue:[ |
262 |
completionSupport |
|
263 |
stopCompletionProcess; |
|
264 |
closeCompletionView. |
|
159
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
265 |
]. |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
266 |
indent := self indentAtCursorLine. |
159
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
267 |
autoIndent := textView autoIndent. |
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
268 |
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
|
269 |
[ |
919 | 270 |
textView undoableDo:[ |
271 |
lines := Array |
|
272 |
with:openText ? '' |
|
273 |
with:'' |
|
274 |
with:((String new:indent withAll:Character space) , closeText). |
|
275 |
self electricInsert:lines advanceCursorBy:1 @ (indent + 5) |
|
276 |
]. |
|
1019 | 277 |
] ensure:[ |
278 |
textView autoIndent:autoIndent |
|
919 | 279 |
]. |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
280 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
281 |
"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
|
282 |
"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
|
283 |
! |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
284 |
|
159
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
285 |
electricInsertSnippet |
134
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
286 |
^ false |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
287 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
288 |
"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
|
289 |
! ! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
290 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
291 |
!EditSupport methodsFor:'event handling'! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
292 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
293 |
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
|
294 |
"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
|
295 |
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
|
296 |
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
|
297 |
|
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 |
IMPORTANT: Never ever call `^ super keyPress: key x:x y:y in: view`, |
1019 | 299 |
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
|
300 |
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
|
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 |
|
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
|
303 |
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
|
304 |
|
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
|
305 |
(self keyPressIgnored: key) ifTrue:[ |
1019 | 306 |
^ 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
|
307 |
]. |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
308 |
|
134
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
309 |
key == Character space ifTrue:[ |
1019 | 310 |
^ self electricInsertSnippet |
134
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
311 |
]. |
109
59448a46a48f
Completion refactoring (part 2).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
108
diff
changeset
|
312 |
|
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
313 |
^false |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
314 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
315 |
"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
|
316 |
"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
|
317 |
! |
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
|
318 |
|
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
|
319 |
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
|
320 |
"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
|
321 |
ignoreKeystrokes notNil ifTrue:[ |
917 | 322 |
ignoreKeystrokesPosition := ignoreKeystrokesPosition + 1. |
323 |
ignoreKeystrokesPosition > ignoreKeystrokes size ifTrue:[ |
|
324 |
"/ Nil out instvars if there's no more keys to ignore. |
|
325 |
ignoreKeystrokes := ignoreKeystrokesPosition := nil. |
|
326 |
]. |
|
327 |
^ 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
|
328 |
]. |
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 |
^ 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
|
330 |
|
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
|
331 |
"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
|
332 |
! |
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
|
333 |
|
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
|
334 |
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
|
335 |
ignoreKeystrokes notNil ifTrue:[ |
917 | 336 |
(ignoreKeystrokes at: ignoreKeystrokesPosition) == key ifTrue:[ |
337 |
"/ Key stroke should be ignored... |
|
338 |
ignoreKeystrokesPosition := ignoreKeystrokesPosition + 1. |
|
339 |
ignoreKeystrokesPosition > ignoreKeystrokes size ifTrue:[ |
|
340 |
"/ Nil out instvars if there's no more keys to ignore. |
|
341 |
ignoreKeystrokes := ignoreKeystrokesPosition := nil. |
|
342 |
]. |
|
343 |
^ true. |
|
344 |
] ifFalse:[ |
|
345 |
"/ Nil out instvars, user typed something else!! |
|
346 |
ignoreKeystrokes := ignoreKeystrokesPosition := nil. |
|
347 |
^ false. |
|
348 |
]. |
|
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
|
349 |
]. |
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
|
350 |
^ 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
|
351 |
|
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
|
352 |
"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
|
353 |
"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
|
354 |
! |
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 |
keyPressSpace |
159
289c7ef539af
Improved support for electric bracket.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
157
diff
changeset
|
357 |
^ self electricInsertSnippet |
134
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
358 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
359 |
"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
|
360 |
! ! |
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
361 |
|
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
362 |
!EditSupport methodsFor:'initialization'! |
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
363 |
|
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
364 |
initializeCompletion |
219
c69943a410fd
Do not cache completion controller in edit support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
365 |
| controller | |
c69943a410fd
Do not cache completion controller in edit support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
366 |
|
917 | 367 |
(UserPreferences current smallSenseCompletionEnabled == true) ifTrue:[ |
919 | 368 |
self completionEngineClass notNil ifTrue:[ |
369 |
|textView| |
|
1019 | 370 |
|
919 | 371 |
textView := service textView. |
372 |
controller := self completionControllerClass for: textView. |
|
373 |
controller support: self. |
|
374 |
textView completionSupport: controller. |
|
375 |
]. |
|
120
4fefce92f5bb
Initial support for Java/Groovy completion and for mixed-language completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
376 |
]. |
108
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
377 |
|
219
c69943a410fd
Do not cache completion controller in edit support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
378 |
"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
|
379 |
! |
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
380 |
|
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
381 |
initializeForService:aSmallSenseService |
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
382 |
service := aSmallSenseService. |
164
3c5e63dbdb3b
Fixes for Groovy completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
159
diff
changeset
|
383 |
codeView := aSmallSenseService codeView. |
108
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
384 |
textView := aSmallSenseService textView. |
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
385 |
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
|
386 |
self initializeCompletion. |
108
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
387 |
|
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
388 |
"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
|
389 |
"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
|
390 |
! ! |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
391 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
392 |
!EditSupport methodsFor:'private'! |
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 |
indentAtCursorLine |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
395 |
| line | |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
396 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
397 |
line := service textView listAt: service textView cursorLine. |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
398 |
^ line isNil ifTrue:[ |
917 | 399 |
(service textView cursorCol - 1) max: 0. |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
400 |
] ifFalse:[ |
917 | 401 |
(line indexOfNonSeparator - 1) max: 0. |
64
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
402 |
] |
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
403 |
|
2257d7223898
All classes moved to namespace SmallSense.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
404 |
"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
|
405 |
"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
|
406 |
! |
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
407 |
|
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
408 |
wordBeforeCursor |
1094 | 409 |
^ textView wordBeforeCursor. |
132
7c23c51d2cfd
Completion insertion refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
122
diff
changeset
|
410 |
|
185
75738108cc3f
Support for Tab in code completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
177
diff
changeset
|
411 |
"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
|
412 |
"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
|
413 |
! |
75738108cc3f
Support for Tab in code completion.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
177
diff
changeset
|
414 |
|
1094 | 415 |
wordBeforeCursorConsisitingOfCharactersMatching:characterMatchBlock |
416 |
^ textView wordBeforeCursorConsisitingOfCharactersMatching:characterMatchBlock |
|
108
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
417 |
! ! |
71471dc81e77
Completion refactoring (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
100
diff
changeset
|
418 |
|
134
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
419 |
!EditSupport methodsFor:'private-scanning'! |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
420 |
|
917 | 421 |
scanLineAt: lineNumber |
134
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
422 |
"Scans line at given line number. |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
423 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
424 |
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
|
425 |
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
|
426 |
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
|
427 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
428 |
^ self scanLineAt: lineNumber using: self scannerClass |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
429 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
430 |
"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
|
431 |
! |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
432 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
433 |
scanLineAt: lineNumber using: scannerClass |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
434 |
"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
|
435 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
436 |
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
|
437 |
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
|
438 |
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
|
439 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
440 |
| line scanner token tokenLastEndPosition | |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
441 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
442 |
scannerClass isNil ifTrue:[ ^ #() ]. |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
443 |
line := (service textView listAt: service textView cursorLine). |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
444 |
line isNil ifTrue:[ ^ #() ]. |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
445 |
scanner := scannerClass for: line string. |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
446 |
tokenLastEndPosition := 0. |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
447 |
^ OrderedCollection streamContents:[:tokens | |
917 | 448 |
[ |
449 |
[ token := scanner nextToken.token ~~ #EOF ] whileTrue:[ |
|
450 |
tokens |
|
451 |
nextPut: token; |
|
452 |
nextPut: (scanner tokenName notNil ifTrue:[scanner tokenName] ifFalse:[ scanner tokenValue printString ]); |
|
453 |
nextPut: scanner tokenStartPosition; |
|
454 |
nextPut: (tokenLastEndPosition := scanner tokenEndPosition). |
|
455 |
]. |
|
456 |
] on: Error do:[ |
|
457 |
tokens |
|
458 |
nextPut: 'Error'; |
|
459 |
nextPut: (line copyFrom: tokenLastEndPosition + 1 to: line size); |
|
460 |
nextPut: tokenLastEndPosition + 1; |
|
461 |
nextPut: line size. |
|
462 |
]. |
|
134
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
463 |
]. |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
464 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
465 |
"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
|
466 |
"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
|
467 |
! |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
468 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
469 |
scanLineAtCursor |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
470 |
"Scans current cursor line. |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
471 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
472 |
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
|
473 |
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
|
474 |
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
|
475 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
476 |
^ 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
|
477 |
|
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
478 |
"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
|
479 |
! ! |
e34ee6ceb7c8
Initial support for "electric snippets".
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
480 |
|
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
|
481 |
!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
|
482 |
|
863 | 483 |
version_CVS |
484 |
||
485 |
^ '$Header$' |
|
486 |
! |
|
487 |
||
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
|
488 |
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
|
489 |
|
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
|
490 |
^ '$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
|
491 |
! ! |
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
|
492 |