/
NECPreferences.class.st
323 lines (278 loc) · 8.39 KB
/
NECPreferences.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
"
I control the preferences for completion framework.
It is the same for NECompletion and NOCompletion (and other potential completion algorithms should be configured here too)
"
Class {
#name : #NECPreferences,
#superclass : #Object,
#classInstVars : [
'enabled',
'caseSensitive',
'smartCharacters',
'smartCharactersMapping',
'backgroundColor',
'expandPrefixes',
'captureNavigationKeys',
'useEnterToAccept',
'popupShowAutomatic',
'popupAutomaticDelay',
'popupShowWithShortcut',
'spaceAfterCompletion',
'smartCharactersWithSingleSpace',
'smartCharactersWithDoubleSpace'
],
#category : #'NECompletion-Model'
}
{ #category : #private }
NECPreferences class >> availableEngines [
^ CompletionEngine withAllSubclasses
]
{ #category : #accessing }
NECPreferences class >> availablePopupShortcuts [
^ {Character space shift . Character tab asKeyCombination}
]
{ #category : #private }
NECPreferences class >> availableSorters [
^ CompletionSorter subclasses
]
{ #category : #accessing }
NECPreferences class >> backgroundColor [
^ backgroundColor
]
{ #category : #accessing }
NECPreferences class >> backgroundColor: aColor [
backgroundColor := aColor
]
{ #category : #accessing }
NECPreferences class >> captureNavigationKeys [
^ captureNavigationKeys
]
{ #category : #accessing }
NECPreferences class >> captureNavigationKeys: aBoolean [
captureNavigationKeys := aBoolean
]
{ #category : #accessing }
NECPreferences class >> caseSensitive [
^ caseSensitive
]
{ #category : #accessing }
NECPreferences class >> caseSensitive: aBoolean [
caseSensitive := aBoolean
]
{ #category : #defaults }
NECPreferences class >> defaultBackgroundColor [
^ self theme menuColor
]
{ #category : #defaults }
NECPreferences class >> defaultPopupDelay [
^ 200
]
{ #category : #defaults }
NECPreferences class >> defaultPopupShortcut [
^ Character tab asShortcut
]
{ #category : #defaults }
NECPreferences class >> defaultPopupShowAutomatic [
^ true
]
{ #category : #defaults }
NECPreferences class >> defaultSpaceAfterCompletion [
^ true
]
{ #category : #defaults }
NECPreferences class >> defaultUseEnterToAccept [
^ true
]
{ #category : #accessing }
NECPreferences class >> enabled [
^ enabled
]
{ #category : #accessing }
NECPreferences class >> enabled: aBoolean [
enabled := aBoolean.
]
{ #category : #accessing }
NECPreferences class >> expandPrefixes [
^ expandPrefixes
]
{ #category : #accessing }
NECPreferences class >> expandPrefixes: aBoolean [
expandPrefixes := aBoolean
]
{ #category : #'class initialization' }
NECPreferences class >> initialize [
enabled := true.
caseSensitive := true.
smartCharacters := true.
expandPrefixes := true.
captureNavigationKeys := true.
useEnterToAccept := self defaultUseEnterToAccept.
smartCharactersMapping := Dictionary new.
smartCharactersMapping
at: $( put: $) -> true;
at: $[ put: $] -> true;
at: ${ put: $} -> true;
at: $" put: $" -> true;
at: $' put: $' -> true;
at: $< put: $> -> false;
at: $| put: $| -> false.
smartCharactersWithSingleSpace := ''.
smartCharactersWithDoubleSpace := '[]{}'.
backgroundColor := self defaultBackgroundColor.
popupShowWithShortcut := self defaultPopupShortcut.
popupShowAutomatic := self defaultPopupShowAutomatic.
popupAutomaticDelay := self defaultPopupDelay.
spaceAfterCompletion := true
]
{ #category : #accessing }
NECPreferences class >> popupAutomaticDelay [
^ popupAutomaticDelay
]
{ #category : #accessing }
NECPreferences class >> popupAutomaticDelay: anObject [
popupAutomaticDelay := anObject
]
{ #category : #accessing }
NECPreferences class >> popupShowAutomatic [
^ popupShowAutomatic
]
{ #category : #accessing }
NECPreferences class >> popupShowAutomatic: aBoolean [
popupShowAutomatic := aBoolean
]
{ #category : #accessing }
NECPreferences class >> popupShowWithShortcut [
^ popupShowWithShortcut
]
{ #category : #accessing }
NECPreferences class >> popupShowWithShortcut: anObject [
popupShowWithShortcut := anObject
]
{ #category : #settings }
NECPreferences class >> settingsOn: aBuilder [
<systemsettings>
(aBuilder setting: #'Code Completion')
target: self;
parentName: #codeBrowsing;
selector: #enabled;
default: true;
iconName: #smallConfigurationIcon;
description: 'Enable or disable code completion in browsers, debuggers and workspaces.';
with: [
| availableControllers availableSorters |
availableControllers := self availableEngines.
availableControllers size > 1
ifTrue: [
(aBuilder pickOne: #completionEngineClass)
order: -1;
label: 'CompletionEngine';
target: RubSmalltalkEditor;
getSelector: #completionEngineClass;
setSelector: #completionEngineClass:;
domainValues: availableControllers ].
availableSorters := self availableSorters.
availableSorters size > 1
ifTrue: [
(aBuilder pickOne: #completionSorter)
order: -1;
label: 'Sorter';
target: CompletionContext;
getSelector: #sorterClass;
setSelector: #sorterClass:;
domainValues: availableSorters ].
(aBuilder setting: #backgroundColor)
default: (Color
r: 0.823069403714565
g: 0.823069403714565
b: 0.823069403714565 alpha: 1.0);
label: 'Background Color'.
(aBuilder setting: #useEnterToAccept)
label: 'Use ENTER to accept a suggested completion';
default: self defaultUseEnterToAccept.
(aBuilder setting: #captureNavigationKeys)
default: true;
label: 'Use navigation keys for extended completion functionality'.
(aBuilder setting: #caseSensitive)
label: 'Case Sensitive';
default: true;
description: 'Decide if you want eCompletion to be case sensitive or not.'.
(aBuilder setting: #smartCharacters)
label: 'Smart Characters';
default: true;
description: 'Decide if you want eCompletion to use smart characters, e.g, to automatically close brackets.'.
(aBuilder setting: #smartCharactersWithSingleSpace)
label: 'Smart Characters with Single Space';
default: '';
description: 'Enumerate the characters which are automatically inserted with a single space in between.'.
(aBuilder setting: #smartCharactersWithDoubleSpace)
label: 'Smart Characters with Double Space';
default: '[]{}';
description: 'Enumerate the characters which are automatically inserted with a two spaces in between.'.
(aBuilder setting: #popupShowAutomatic)
default: self defaultPopupShowAutomatic;
label: 'Popup is automatic'.
(aBuilder setting: #popupAutomaticDelay)
default: self defaultPopupDelay;
label: 'Popup appearance delay'.
(aBuilder pickOne: #popupShowWithShortcut)
default: self defaultPopupShortcut;
label: 'Popup appears with this shortcut';
domainValues: self availablePopupShortcuts.
(aBuilder setting: #spaceAfterCompletion)
default: self defaultSpaceAfterCompletion;
label: 'Put a space after completion'
].
]
{ #category : #accessing }
NECPreferences class >> smartCharacters [
^ smartCharacters
]
{ #category : #accessing }
NECPreferences class >> smartCharacters: aBoolean [
smartCharacters := aBoolean
]
{ #category : #accessing }
NECPreferences class >> smartCharactersMapping [
^ smartCharactersMapping
]
{ #category : #accessing }
NECPreferences class >> smartCharactersMapping: aDictionary [
smartCharactersMapping := aDictionary
]
{ #category : #accessing }
NECPreferences class >> smartCharactersWithDoubleSpace [
^ smartCharactersWithDoubleSpace
]
{ #category : #accessing }
NECPreferences class >> smartCharactersWithDoubleSpace: aString [
smartCharactersWithDoubleSpace := aString
]
{ #category : #accessing }
NECPreferences class >> smartCharactersWithSingleSpace [
^ smartCharactersWithSingleSpace
]
{ #category : #accessing }
NECPreferences class >> smartCharactersWithSingleSpace: aString [
smartCharactersWithSingleSpace := aString
]
{ #category : #accessing }
NECPreferences class >> spaceAfterCompletion [
^ spaceAfterCompletion
]
{ #category : #accessing }
NECPreferences class >> spaceAfterCompletion: anObject [
spaceAfterCompletion := anObject
]
{ #category : #accessing }
NECPreferences class >> theme [
self flag: #SmalltalkReference.
^ Smalltalk ui theme
]
{ #category : #accessing }
NECPreferences class >> useEnterToAccept [
^ useEnterToAccept
]
{ #category : #accessing }
NECPreferences class >> useEnterToAccept: aBoolean [
useEnterToAccept := aBoolean
]