Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix autocomplete prefix for custom identifierRegexes
Hi, Ace team! My team has been using a fork of Ace, and I'm hoping to merge some of our changes upstream so that we can return to using your official releases. The engineer who originally accomplished this work has long since departed my team, so forgive me for this somewhat rote transcription of his working notes. > This was sent upstream in #2352, > but closed because fcebd0f > seemed to address the same issue. That fix unfortunately does not > work as we need, and fails the behavior described in our test named > `test leading @ not duplicated on autocomplete` > > The root cause: Autocomplete prefix can be wrong for completions with > a custom identifierRegex because `Autocompleter.base` is computed > relative to a prefix computed for the default identifierRegex. Below, I reproduce the test my colleague referred to. ``` 'test leading @ not duplicated on autocomplete': function (test) { editor.setValue(''); editor.navigateFileStart(); var text = 'view: users { derived_table: { sql: @{;; } }'; exec('insertstring', 1, text); editor.moveCursorTo(0, 38); editor.getValue(); attachedSymbolsToSession(text, editor.session, { const: 'value' }); editor.execCommand('startAutocomplete'); var completion = editor.completer.completions.filtered.filter(function(completion) { return completion.caption === '@{const}'; }); test.ok(completion[0]); editor.completer.insertMatch(completion[0]); test.equal(editor.getValue(), 'view: users { derived_table: { sql: @{const};; } }'); test.done(); }, ```
- Loading branch information