monaco-editor icon indicating copy to clipboard operation
monaco-editor copied to clipboard

Using brackets and chinese to trigger code hint

Open feynmanGoat opened this issue 5 years ago • 4 comments

I have some custom keywords , when it made up by english ,it can works Now the situation is I have some custom keywords made up by "[" 、"]" and chinese like [结果.属性] , but when I input "[" or “结果”, it can not showing suggestions ; I tried use "editor.current.trigger("text", "editor.action.triggerSuggest", {});” in onDidChangeModelContent event, but when the words are not match,it always showing "no suggestions"; and I tried set "[" in triggerCharacters, but there will be two "[" those are not my expectation

so is there a correct way to trigger code hint when input brackets and chinese?

feynmanGoat avatar Mar 31 '21 08:03 feynmanGoat

OK I find a way by handle it in onDidChangeModelContent

feynmanGoat avatar Apr 08 '21 06:04 feynmanGoat

OK I find a way by handle it in onDidChangeModelContent

我遇到了同样的问题,大佬求教怎么让中文字符触发生效呀~

zhangq49 avatar Dec 27 '21 05:12 zhangq49

OK I find a way by handle it in onDidChangeModelContent

我遇到了同样的问题,大佬求教怎么让中文字符触发生效呀~

纯中文字符的话应该在createDependencyProposals里用自定义的关键字列表返回suggestions数组就行了吧,高亮的话参考文档playground的自定义主题和令牌 我之前的需求是中括号触发,这个内部完全不识别为关键字,只能在onDidChangeModelContent的回调里手动读取当前输入文本,然后字符串匹配处理了,匹配到了调editorRef.current.trigger("","editor.action.triggerSuggest", {});手动让联想面板出来

feynmanGoat avatar Dec 27 '21 10:12 feynmanGoat

学习了,多谢大佬赐教

zhangq49 avatar Dec 28 '21 06:12 zhangq49