Explorar el Código

Merge pull request #1672 from sharelatex/ns-input-autocomplete

improve autocomplete when inserting over existing arguments

GitOrigin-RevId: 8d1401cca141348dd33b965c92e120cf66350d7e
Simon Detheridge hace 7 años
padre
commit
61cd448832

+ 14 - 0
services/web/public/src/ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager.js

@@ -382,6 +382,20 @@ define([
                         )
                       }
                     }
+                    const inArgument = lineBeyondCursor.match(
+                      /^([\w._-]+)\}(.*)/
+                    )
+                    if (inArgument) {
+                      const argumentRightOfCursor = inArgument[1]
+                      const afterArgument = inArgument[2]
+                      if (afterArgument) {
+                        rightRange.end.column =
+                          rightRange.start.column +
+                          argumentRightOfCursor.length +
+                          1
+                      }
+                      editor.session.remove(rightRange)
+                    }
                   }
                 }
                 // finally, insert the match