Open timdmackey opened 3 years ago
I figured out a bandaid solution to this, as I haven't tried to puzzle through a proper solution. The getProp()
and setProp()
functions in configuration.ts expect to receive objects, but onEnterRules
is an array of objects. Since the objects don't have keys (but do have indexes), my solution was to just define each rule inside the REGEXP_PROPERTIES
declaration a bunch of times. Messy, but it does the trick.
const REGEXP_PROPERTIES = [
// indentation
'indentationRules.decreaseIndentPattern',
'indentationRules.increaseIndentPattern',
'indentationRules.indentNextLinePattern',
'indentationRules.unIndentedLinePattern',
// code folding
'folding.markers.start',
'folding.markers.end',
// language's "word definition"
'wordPattern',
// on enter actions
'onEnterRules.0.beforeText',
'onEnterRules.1.beforeText',
'onEnterRules.2.beforeText',
'onEnterRules.3.beforeText',
'onEnterRules.4.beforeText',
'onEnterRules.5.beforeText',
'onEnterRules.6.beforeText',
'onEnterRules.7.beforeText',
'onEnterRules.8.beforeText',
'onEnterRules.9.beforeText'
];
When a language configuration file contains
onEnterRules
, the editor seems to choke on them any time the [Enter] key is pressed. I get an error each time saysUncaught Error: e.reg.test is not a function
, which sounds like it's attempting to apply the rules but it's not recognizing them as a proper Regular Expression.The only way I've found to fix this is to delete the onEnterRules. Are these rules explicitly unsupported, or is there something I can do to get them working? It looks like Monaco supports them by default, but perhaps they weren't implemented here when the textMate grammar support was added.