Open MrCoder opened 1 year ago
It's still under testing, but it seems to work in the "Linter and cross binding demo" with the update I just committed.
Currently, when you input "()", you get "())", which does not follow the specification.
https://github.com/logue/vue-codemirror6/blob/master/src/components/CodeMirror.ts#L442
I found that this watcher updates the CodeMirror content even if the update is exactly caused by CodeMirror itself, this might making CodeMirror think there are additional manipulations between the two input( (
and )
), so it will not trigger the second step
.
It is necessary to check the update source, If the update comes from CodeMirror, then don't dispatch the update back to CodeMirror.
I have fixed it in #22
Hi @logue, do mind merging @dyon21 's PR #22 ? I have tested it and that works very well. I have a product that uses this component. It is much appreciated if the fix is released as soon as possible.
Merged. There are also cases where you use it to customize the line separator, so we also fixed that.
According to the specification (https://codemirror.net/docs/ref/#autocomplete.closeBrackets), the default "automatic bracket closing" should be like this:
(
, then)
is automatically inserted;)
, the cursor moves over that bracket.The example has the same behaviour as explained: https://codemirror.net/try/
It does not seem to work in the same way at https://logue.dev/vue-codemirror6/ with
basic
lang=javascript
.Specifically, the second step, when you type
)
, the character is inserted.