From 238cea453b1839a3d124f8f06396154d1ce7f3d7 Mon Sep 17 00:00:00 2001 From: Oskar Hane Date: Wed, 7 Dec 2016 15:31:54 +0100 Subject: [PATCH 1/2] Revert "We don't want indentations in Cypher" This reverts commit 774ea6e0064155ae19b682c06c05b85d39701e49. --- app/components/codemirror-cypher/index.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/components/codemirror-cypher/index.js b/app/components/codemirror-cypher/index.js index efb249b573e..9b2490014c5 100644 --- a/app/components/codemirror-cypher/index.js +++ b/app/components/codemirror-cypher/index.js @@ -118,7 +118,18 @@ return style; }, indent: function(state, textAfter) { - return 0; + var firstChar = textAfter && textAfter.charAt(0); + var context = state.context; + if (/[\]\}]/.test(firstChar)) { + while (context && context.type === "pattern") { + context = context.prev; + } + } + var closing = context && firstChar === context.type; + if (!context) return 0; + if (context.type === "keywords") return CodeMirror.commands.newlineAndIndent; + if (context.align) return context.col + (closing ? 0 : 1); + return context.indent + (closing ? 0 : indentUnit); } }; }); From 964b7777374a69ae0a1f86a430a8c80fd3b1243c Mon Sep 17 00:00:00 2001 From: Oskar Hane Date: Wed, 7 Dec 2016 15:34:04 +0100 Subject: [PATCH 2/2] Disable smartIndent --- app/views/partials/editor.jade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/partials/editor.jade b/app/views/partials/editor.jade index 519592d7265..e3ee97566a7 100644 --- a/app/views/partials/editor.jade +++ b/app/views/partials/editor.jade @@ -21,7 +21,7 @@ .view-editor span(ng-class="{'one-line': editorOneLine, 'disable-highlighting': disableHighlighting}") .prompt.code-style $ - ui-codemirror('ui-codemirror-opts'="{gutters:['cypher-hints'], theme: 'neo', mode: 'cypher', autofocus: true, lineNumbers: true, lineWrapping: true, onLoad: codemirrorLoaded}", + ui-codemirror('ui-codemirror-opts'="{gutters:['cypher-hints'], theme: 'neo', mode: 'cypher', autofocus: true, lineNumbers: true, lineWrapping: true, onLoad: codemirrorLoaded, smartIndent: false}", ng-model='editor.content', placeholder='{{motd.tip}}' )