From da286438be12a68eb3da318ebfe4400e7cb9f588 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 30 Jun 2017 11:22:11 +0100 Subject: [PATCH] Don't trigger autocomplete when editing existing environment --- .../aceEditor/auto-complete/AutoCompleteManager.coffee | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager.coffee index cbcdc2eac7..48a6404a82 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager.coffee @@ -12,6 +12,9 @@ define [ else return null + getCommandNameFromFragment = (commandFragment) -> + commandFragment?.match(/\\(\w+)\{/)?[1] + class AutoCompleteManager constructor: (@$scope, @editor, @element, @labelsManager) -> @suggestionManager = new SuggestionManager() @@ -122,6 +125,9 @@ define [ range = new Range(end.row, 0, end.row, end.column) lineUpToCursor = @editor.getSession().getTextRange(range) commandFragment = getLastCommandFragment(lineUpToCursor) + commandName = getCommandNameFromFragment(commandFragment) + if commandName in ['begin', 'end'] + return # Check that this change was made by us, not a collaborator # (Cursor is still one place behind) # NOTE: this is also the case when a user backspaces over a highlighted region