<commit_before>"
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 >> availableControllers [
	^NECController withAllSubclasses copyWithout: NECWorkspaceController
]

{ #category : #accessing }
NECPreferences class >> availablePopupShortcuts [
	^ {
		Character space shift. 
		Character tab asKeyCombination}
]

{ #category : #accessing }
NECPreferences class >> backgroundColor [ 
	^backgroundColor ifNil: [ 
		backgroundColor := (Smalltalk ui theme settings menuColor ifNil: [ Color white ]) ]
]

{ #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 : #private }
NECPreferences class >> currentController [ 
	^ (Smalltalk tools hasToolNamed: #codeCompletion)
		ifTrue: [ Smalltalk tools codeCompletion ]
		ifFalse: [ nil ]
]

{ #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 [
	
	^ false
]

{ #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 := false.
	useEnterToAccept := true.
	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 := Smalltalk ui theme settings menuColor ifNil: [ Color white ].
	popupShowWithShortcut := self defaultPopupShortcut.
	popupShowAutomatic := self defaultPopupShowAutomatic.
	popupAutomaticDelay := self defaultPopupDelay.
	spaceAfterCompletion := true
]

{ #category : #accessing }<commit_msg>22388 Ecompletion: enable "Use navigation keys for extended completion functionality" https://pharo.fogbugz.com/f/cases/22388/Ecompletion-enable-Use-navigation-keys-for-extended-completion-functionality<commit_after>"
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 >> availableControllers [
	^NECController withAllSubclasses copyWithout: NECWorkspaceController
]

{ #category : #accessing }
NECPreferences class >> availablePopupShortcuts [
	^ {
		Character space shift. 
		Character tab asKeyCombination}
]

{ #category : #accessing }
NECPreferences class >> backgroundColor [ 
	^backgroundColor ifNil: [ 
		backgroundColor := (Smalltalk ui theme settings menuColor ifNil: [ Color white ]) ]
]

{ #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 : #private }
NECPreferences class >> currentController [ 
	^ (Smalltalk tools hasToolNamed: #codeCompletion)
		ifTrue: [ Smalltalk tools codeCompletion ]
		ifFalse: [ nil ]
]

{ #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 [
	
	^ false
]

{ #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 := true.
	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 := Smalltalk ui theme settings menuColor ifNil: [ Color white ].
	popupShowWithShortcut := self defaultPopupShortcut.
	popupShowAutomatic := self defaultPopupShowAutomatic.
	popupAutomaticDelay := self defaultPopupDelay.
	spaceAfterCompletion := true
]

{ #category : #accessing }
{'fraction_non_alphanumeric': 0.1168724279835391, 'fraction_numerical': 0.0021947873799725653, 'mean_word_length': 4.951836734693877, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 95, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1873375', 'n_tokens_mistral': 2309, 'n_tokens_neox': 2196, 'n_words': 534}