You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is not a bug report. (please use a different template for reporting a bug)
This issue is not a duplicate of an existing issue. (please use the search to find existing issues)
Description
For provideCompletionItems, with the completion item as below, if a user type "te or 'te, after the completion, it will be "'testing(${1:condition})' or ''testing(${1:condition})'. Is there a way to avoid this and make it just 'testing(${1:condition})'?
Playground link and code are provided and you can repro that by typing "te or 'te.
// Register a new languagemonaco.languages.register({id: "mySpecialLanguage"});// Register a tokens provider for the languagemonaco.languages.setMonarchTokensProvider("mySpecialLanguage",{tokenizer: {root: [[/\[error.*/,"custom-error"],[/\[notice.*/,"custom-notice"],[/\[info.*/,"custom-info"],[/\[[a-zA-Z 0-9:]+\]/,"custom-date"],],},});// Define a new theme that contains only rules that match this languagemonaco.editor.defineTheme("myCoolTheme",{base: "vs",inherit: false,rules: [{token: "custom-info",foreground: "808080"},{token: "custom-error",foreground: "ff0000",fontStyle: "bold"},{token: "custom-notice",foreground: "FFA500"},{token: "custom-date",foreground: "008800"},],colors: {"editor.foreground": "#000000",},});// Register a completion item provider for the new languagemonaco.languages.registerCompletionItemProvider("mySpecialLanguage",{provideCompletionItems: (model,position)=>{varword=model.getWordUntilPosition(position);varrange={startLineNumber: position.lineNumber,endLineNumber: position.lineNumber,startColumn: word.startColumn,endColumn: word.endColumn,};varsuggestions=[{label: "simpleText",kind: monaco.languages.CompletionItemKind.Text,insertText: "simpleText",range: range,},{label: "testing",kind: monaco.languages.CompletionItemKind.Keyword,insertText: "'testing(${1:condition})'",insertTextRules:
monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,range: range,},{label: "ifelse",kind: monaco.languages.CompletionItemKind.Snippet,insertText: ["if (${1:condition}) {","\t$0","} else {","\t","}",].join("\n"),insertTextRules:
monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation: "If-Else Statement",range: range,},];return{suggestions: suggestions};},});monaco.editor.create(document.getElementById("container"),{theme: "myCoolTheme",value: getCode(),language: "mySpecialLanguage",});functiongetCode(){return["[Sun Mar 7 16:02:00 2004] [notice] Apache/1.3.29 (Unix) configured -- resuming normal operations","[Sun Mar 7 16:02:00 2004] [info] Server built: Feb 27 2004 13:56:37","[Sun Mar 7 16:02:00 2004] [notice] Accept mutex: sysvsem (Default: sysvsem)","[Sun Mar 7 16:05:49 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Sun Mar 7 16:45:56 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Sun Mar 7 17:13:50 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Sun Mar 7 17:21:44 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Sun Mar 7 17:23:53 2004] statistics: Use of uninitialized value in concatenation (.) or string at /home/httpd/twiki/lib/TWiki.pm line 528.","[Sun Mar 7 17:23:53 2004] statistics: Can't create file /home/httpd/twiki/data/Main/WebStatistics.txt - Permission denied","[Sun Mar 7 17:27:37 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Sun Mar 7 17:31:39 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Sun Mar 7 17:58:00 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Sun Mar 7 18:00:09 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Sun Mar 7 18:10:09 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Sun Mar 7 18:19:01 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Sun Mar 7 18:42:29 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Sun Mar 7 18:52:30 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Sun Mar 7 18:58:52 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Sun Mar 7 19:03:58 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Sun Mar 7 19:08:55 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Sun Mar 7 20:04:35 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Sun Mar 7 20:11:33 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Sun Mar 7 20:12:55 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Sun Mar 7 20:25:31 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Sun Mar 7 20:44:48 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Sun Mar 7 20:58:27 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Sun Mar 7 21:16:17 2004] [error] [client xx.xx.xx.xx] File does not exist: /home/httpd/twiki/view/Main/WebHome","[Sun Mar 7 21:20:14 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Sun Mar 7 21:31:12 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Sun Mar 7 21:39:55 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Sun Mar 7 21:44:10 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Mon Mar 8 01:35:13 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Mon Mar 8 01:47:06 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Mon Mar 8 01:59:13 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Mon Mar 8 02:12:24 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Mon Mar 8 02:54:54 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Mon Mar 8 03:46:27 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Mon Mar 8 03:48:18 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Mon Mar 8 03:52:17 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Mon Mar 8 03:55:09 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Mon Mar 8 04:22:55 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Mon Mar 8 04:24:47 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Mon Mar 8 04:40:32 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Mon Mar 8 04:55:40 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Mon Mar 8 04:59:13 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Mon Mar 8 05:22:57 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Mon Mar 8 05:24:29 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","[Mon Mar 8 05:31:47 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed","<11>httpd[31628]: [error] [client xx.xx.xx.xx] File does not exist: /usr/local/installed/apache/htdocs/squirrelmail/_vti_inf.html in 29-Mar 15:18:20.50 from xx.xx.xx.xx","<11>httpd[25859]: [error] [client xx.xx.xx.xx] File does not exist: /usr/local/installed/apache/htdocs/squirrelmail/_vti_bin/shtml.exe/_vti_rpc in 29-Mar 15:18:20.54 from xx.xx.xx.xx",].join("\n");}
The text was updated successfully, but these errors were encountered:
Context
Description
For
provideCompletionItems
, with the completion item as below, if a user type"te
or'te
, after the completion, it will be"'testing(${1:condition})'
or''testing(${1:condition})'
. Is there a way to avoid this and make it just'testing(${1:condition})'
?Playground link and code are provided and you can repro that by typing
"te
or'te
.Specific completion item related to this:
Monaco Editor Playground Link
https://microsoft.github.io/monaco-editor/playground.html?source=v0.47.0#XQAAAAJFJAAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscyHO6c_q55Xb-rPT1GuIFKCdKF69bZ7LRIRgUhPL2LL-t-aLTil5TT4Jw0S5CZKoD9ATfrsIIWhSL9MGaWtV7Vy0W539nwXs75e6vfBicHw6WfD09pPNr4hAuIkAiuvQPJ-iqwP7lhdw4S2cJ5F1yjhFWiZPj0uxGNLAdE08cJo6WMQgS47f5rGXJaM78Ze71kg12vQIDSFReNHSsJnmHji4VW-ZQ5phvKn2auNxldAhWWRqJbutsGfAnNiXMvNzSwnONxAeMjzX-AvLz5Dn4rEnZZyA4j9ekOI5EyPayMmOUcqiuDNUZ7hSnZtk-OlOlg3upMMQi5gZ7Rckp8sf3XaFBROEMfNTBm7n56Koea4L4WSsowHFI02rjlAA3B-U4kktxoSHd6X_qxn5Uqlhf6Bku44dWPCbCWWn6pkRU0d7kKr3kruVPNpI8BOwZIUrB-DXFRvJQNz35GX7DiDq9d_MiMnrJqQ2sOPpYqWXUj8hbn7ZEpBEovxuI6dPQ1uYETmWdEutodwYedek4uNsbnH8J8LOwhUdDufhONRR4rtNSVRa5sRsilW9kdT-YDbpzAYBEn6XyFESvu_WrZuRPefRvYQuT9j7rb-X4PR4oty-q9MslbrawocbSQ4RQFLuvjErCVhKncPKp_WU-emwvNarLqEaHmphJWi4Li4wFDZekEVmoY2ULofB0Yg2FZPST_LCx2MhRoKm7X5ZMs34V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OeAM_J_6bhIBQ7eTylrzGsCNznP_1ysIb2-WEpn-fSA4vlDOR4r_a2X_MVujlJ5BO0gQCsjVIrqADqgi7hvqS_u356GnPJuKHrfDOEDuqmelEOob8NPOIikWcbihWbGRmyODU49ZtYTsC4NvwYf98qtxXs27Le5yLIqP8v-WMA
Monaco Editor Playground Code
The text was updated successfully, but these errors were encountered: