microsoft / microsoft/monaco-editor
[Bug] Adding backtick to close open string adds two backticks instead of one
@hediet is already working on this.
Since Dec 18, 2024.
- Dominant language
- JavaScript
- Stars
- 46.8k
- Forks
- 4.1k
- Avg merge
- 17h 58m
- Merged PRs (30d)
- 1
Description
Reproducible in vscode.dev or in VS Code Desktop?
- Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
- Not reproducible in the monaco editor playground
Monaco Editor Playground Link
Monaco Editor Playground Code
monaco.languages.register({ id: "mySpecialLanguage" });
monaco.languages.setLanguageConfiguration('mySpecialLanguage', {
autoClosingPairs: [
{ open: "'", close: "'" },
{ open: '`', close: '`' },
],
// autoCloseBefore not helping in this case
});
monaco.editor.create(document.getElementById("container"), {
language: "mySpecialLanguage",
});
Reproduction Steps
-
type in a word string
-
type a quote (' or ") at the beginning of the string
-
type a quote at the end of the string. only one quote is added.
-
enter into a new line and type a word string
-
type a backtick (`) at the beginning of the string
-
type a backtick at the end of the string. two backticks get added, when there should only be one
https://github.com/user-attachments/assets/d955ebfb-f411-45ab-89c2-3d581e5600da
Actual (Problematic) Behavior
Adding a backtick at the end of an open string (in attempt to close it) adds two backticks instead of 1
Expected Behavior
Adding a backtick at the end of an open string should only add 1 backtick
Additional Context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.