Search code examples
autocompletequotesace-editor

How to implement the "auto pairing of quotes" feature in custom mode in ace-editor


I want to add "auto pairing of quotes" feature in my custom mode. I find the solution that add editor.setBehavioursEnabled(true), but it seems like only work for existing mode. I know I perhaps miss some code in my custom mode. Can anyone point out which code is response for this feature.


Solution

  • You could use cstyle behavior similar to the way javascript mode does see https://github.com/ajaxorg/ace/blob/v1.1.9/lib/ace/mode/javascript.js#L47 https://github.com/ajaxorg/ace/blob/v1.1.9/lib/ace/mode/behaviour/cstyle.js