visual-studio-code - VSCode extension: code completion of custom language only triggers when invoked
问题描述
I'm the author of the Language support for CloudFormation templates extension. It provides code completion, but right now this is, against my intention, only triggered when invoked (when pressing ctrl+space). I suspect this is because the identifiers in the language are encapsulated in quotes, and VSCode is treating them as strings. However, when I set "strings" to true in "editor.quickSuggestions", the code completion still only works when invoked.
I've tried changing the syntax highlighting grammar so it no longer registers anything as a string, but that did not work. I've also tried specifying a 'wordPattern' in the language configuration that included the quotes, but without luck. (Here's the documentation on word patterns)
解决方案
我发现了问题。我指定的 wordPattern 是“[a-zA-Z]*”,所以当输入“ba[cursorPosition]”时,VS Code 不会触发自动补全,因为它会认为“ba”是一个单词并且光标在中间这个词,此时显然它不会触发自动完成。
将 wordPattern 更改为 "[a-zA-Z]* 解决了该问题。
推荐阅读
- flutter - 升级 Flutter 版本后运行 pod install 时出现 Flutter 错误
- wordpress - GTranslate wordpress 登录不适用于其他语言
- angular - 使用 Webpack for Angular 构建的构建中缺少 :host {} css
- jenkins - 如何在`AsyncResourceDisposer.doStopTracking()`中使用`StaplerResponse rsp`
- javascript - Angular:TypeError:未定义不是对象(评估'navigator.permission.query')
- python - pandas 多索引索引切片范围
- azure-data-factory - Azure 数据工厂分页不起作用
- c# - Mongodb .net fluent api:带有枚举字段的项目聚合
- python - 堆叠音频帧以进行分类
- c# - 如何在 conda env 中从 linux 中的 C# 脚本启动节点?