Bug 482157 - codeEdit: Need way to customize the editor settings during the create() API call.
Summary: codeEdit: Need way to customize the editor settings during the create() API c...
Status: RESOLVED FIXED
Alias: None
Product: Orion (Archived)
Classification: ECD
Component: Editor (show other bugs)
Version: 10.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 11.0   Edit
Assignee: libing wang CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-13 14:46 EST by libing wang CLA
Modified: 2016-05-09 10:29 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description libing wang CLA 2015-11-13 14:46:40 EST
Need way to customize the editor settings during the create() API call.
Comment 1 libing wang CLA 2015-11-13 14:51:14 EST
As mentioned in the bug 481916, a user wants to enable the content assist auto trigger. The current way to do that is to use the call as below:
editorViewer.settings.contentAssistAutoTrigger = true;

But we should figure out a better way to allow user to configure all the editor settings values to a set of default values. We may end up with a preference service.
Comment 2 Carolyn MacLeod CLA 2016-04-19 10:39:06 EDT
Please see bug 491938. 
.editorConfig might be helpful here.
Comment 3 libing wang CLA 2016-04-27 12:16:58 EDT
(In reply to Carolyn MacLeod from comment #2)
> Please see bug 491938. 
> .editorConfig might be helpful here.

I am working on this right now...
In org.eclipse.orion.client.ui/web/orion/editorPreferences.js, we already have a default object:
	var defaults = {
		autoSave: true,
		autoSaveVisible: true,
		autoSaveLocalVisible: true,
		autoSaveTimeout: 250,
		autoSaveTimeoutVisible: true,
		themeVisible: true,
		themeLocalVisible: true,
		fontSizeVisible: true,
		fontSizeLocalVisible: true,
		autoLoad: true,
		autoLoadVisible: true,
		saveDiffs: true,
		saveDiffsVisible: true,
		contentAssistAutoTrigger: true,
		contentAssistAutoTriggerVisible: true,
		showOccurrences: true,
		showOccurrencesVisible: true,
		autoPairParentheses: true,
		autoPairParenthesesVisible: true,
		autoPairBraces: true,
		autoPairBracesVisible: true,
		autoPairSquareBrackets: true,
		autoPairSquareBracketsVisible: true,
		autoPairAngleBrackets: false,
		autoPairAngleBracketsVisible: true,
		autoPairQuotations: true,
		autoPairQuotationsVisible: true,
		autoCompleteComments: true,
		autoCompleteCommentsVisible: true,
		smartIndentation: true,
		smartIndentationVisible: true,
		trimTrailingWhiteSpace: false,
		trimTrailingWhiteSpaceVisible: true,
		tabSize: 4,
		tabSizeVisible: true,
		expandTab: false,
		expandTabVisible: true,
		scrollAnimation: true,
		scrollAnimationVisible: true,
		scrollAnimationTimeout: 300,
		scrollAnimationTimeoutVisible: true,
		annotationRuler: true,
		annotationRulerVisible: true,
		lineNumberRuler: true,
		lineNumberRulerVisible: true,
		foldingRuler: true,
		foldingRulerVisible: true,
		overviewRuler: true,
		overviewRulerVisible: true,
		zoomRuler: false,
		zoomRulerVisible: true,
		zoomRulerLocalVisible: true,
		showWhitespaces: false,
		showWhitespacesVisible: true,
		wordWrap: false,
		wordWrapVisible: true,
		showMargin: false,
		showMarginVisible: true,
		marginOffset: 80,
		marginOffsetVisible: true,
		keyBindings: "Default",
		keyBindingsVisible: true,
		keyBindingsLocalVisible: true,
		diffService: false,
		diffServiceVisible: false
	};

We should just allow user to pass a SUBSET of this object during the widget creation, and merge the subset back to the default.
For the signature of the param, we may either go with a simple object or a fancier "preference" object.
Comment 5 libing wang CLA 2016-05-09 10:29:57 EDT
*** Bug 491938 has been marked as a duplicate of this bug. ***