Topic on Extension talk:CodeEditor

He7d3r (talkcontribs)

If a script was created without the CodeEditor, and uses tabs for indentation, when we edit the code using the gadget it mess up with the alignment. See this example, where the added lines were indented using the CodeEditor, but they are converted to spaces while the tabs in the other lines are not. The result is a script wich looks good while we are editing it, but it awful after the page is saved.

He7d3r (talkcontribs)

Hmm, I'll have to check how ace handles tabs by default... right now I don't think I'm changing the tab settings from default.

This post was posted by He7d3r, but signed as Brion VIBBER.

Rillke (talkcontribs)

On the one hand there are the Coding conventions that recommend tab chars and on the other hand this editor that inserts 4 spaces!? What game do you play here?

Rillke (talkcontribs)
// Make CodeEditor using TAB
(function () {
	var tb1 = document.getElementById('wpTextbox1');
	if (!tb1) return;
 
	mw.hook( "codeEditor.configure" ).add(function( editorSession ) {
			var ce,
				we = $(tb1).data('wikiEditor-context');
 
			// Wiki editor?
			if (!we) return;
 
			// Code editor plugged in?
			ce = we.codeEditor;
			if (!ce) return;

			// Do something with the editor (ce)

 			// Set tab indention to 3 (uncomment next line if wanted)
			// editorSession.setTabSize(3);

 			// Disable "soft tabs"
			editorSession.setUseSoftTabs(false);
	});
})();

+2 hours of research within code that is not following the documentation rules set out for JavaScript for this crappy solution.

Reply to "Tabs"