Hi Marjin
Thanks for fixing the CJK issue. We upgrade @codemirror /view and @codemirror /autocompletes but one of our integration test catches the auto-completion stopped working. The only change is package version change as detailed here:
opened 05:55AM - 25 Feb 22 UTC
Hi!
We saw the CJK issue
(see: https://discuss.codemirror.net/t/entering-… cjk-with-placeholder-causes-problems-with-the-first-character/3876/11 )
and upgrade to
```
"@codemirror/autocomplete": "^0.19.13",
"@codemirror/basic-setup": "^0.19.1",
"@codemirror/closebrackets": "^0.19.1",
"@codemirror/lang-javascript": "^0.19.7",
"@codemirror/lang-json": "^0.19.1",
"@codemirror/lang-sql": "^0.19.4",
"@codemirror/state": "^0.19.2",
"@codemirror/theme-one-dark": "^0.19.0",
"@codemirror/view": "^0.19.45",
```
The master (before change) versions are:
```
"@codemirror/autocomplete": "^0.19.3",
"@codemirror/basic-setup": "^0.19.1",
"@codemirror/closebrackets": "^0.19.0",
"@codemirror/lang-javascript": "^0.19.2",
"@codemirror/lang-json": "^0.19.1",
"@codemirror/lang-sql": "^0.19.4",
"@codemirror/state": "^0.19.2",
"@codemirror/theme-one-dark": "^0.19.0",
"@codemirror/view": "^0.19.9",
```
However one of our integration test catches that the auto-completes stopped working after the upgrade. Here's the code (stripping irrelevant part). I added comment in the code for easier understanding
```
const extensions: Extension[] = [
autocompletion({
override: [
async (ctx) => {
console.log("enters auto-completes!"); // this line is not consoled any more after upgrading. Works fine before
const code = ctx.state.doc.toString();
// do not trigger completion in this case
if (!isInsideCurlyBraces(code, ctx.pos)) {
return null;
}
// either the word before pos is a word or a dot
const word = ctx.matchBefore(/\w*[.]?/);
console.log("here!"); // not printed.
if (word && word.from === word.to) {
return null;
}
const completionResult = await getCompletions(
ctx.state.doc.toString(),
ctx.pos
);
return completionResult;
},
],
}),
EditorView.lineWrapping,
defaultHighlightStyle.fallback,
fixedHeightEditor,
closeBrackets(),
];
console.log(extensions);
if (placeholder) {
extensions.push(extendPlaceholder(placeholder));
}
if (mode === "javascript") {
extensions.push(javascript());
} else if (mode === "sql") {
extensions.push(sql());
}
extensions.push(
EditorView.updateListener.of((update) => {
const doc = update.state.doc.toString();
onChange(doc.toString());
})
);
// use value to initialize code-mirror
const state = EditorState.create({
doc: value,
extensions,
});
const view = new EditorView({ state, parent: currentEditor });
```
Could you shed some light on if this is a regression or maybe API change that we need to take care of?
Could this be a regression in any case or API changes that we need to adapt?
Thanks a lot in advance
marijn
February 25, 2022, 8:32am
2
Just opening an issue is enough, you don’t need to also cross-post it to the forum.
1 Like
understood. Thought for SEO purpose it’s easier for others to search for. Will not cross post in the future