Visual Studio Code对同一文件中的单词自动完成

Visual Studio Code对同一文件中的单词自动完成

问题描述:

[注意:我已经按照建议的此处尝试过javascript.suggest.alwaysAllWords,但是建议的设置只是在Code 1.8.1 for macOS中给了我Unknown configuration setting.]

[Note: I've already tried javascript.suggest.alwaysAllWords as proposed here, but the suggested settings just give me Unknown configuration setting in Code 1.8.1 for macOS.]

自动完成功能在Visual Studio Code中对我来说很好,但仅适用于外部模块中的代码.这对于它的价值而言是个很棒的选择,但是我真的错过了Sublime的基于缓冲区的自动完成功能,该功能实际上将当前打开的缓冲区中的任何单词都包含为自动完成选项.

Autocomplete works fine for me in Visual Studio Code, but only for code in outside modules. That's great for what it's worth, but I'm really missing the buffer-based autocomplete from Sublime which essentially includes any word in a currently-open buffer as an autocomplete option.

例如,当我输入以下内容时:

For example, when I type this:

hashToPage : String -> Page
hashT

我希望自动完成功能提供oPage作为hashT的完成.相反,我必须重新输入整个字符串.

I want autocomplete to offer up oPage as a completion for hashT. Instead, I have to retype the entire string.

是否可以调整设置以包含当前页面中的单词?

(或者所有打开的缓冲区,还是索引我创建的变量和函数名称的任何方法?)

(Or all open buffers, or any approach that indexes variable and function names that I've created?)

在Internet上搜索,我发现了以下选项:

Searching the internet I found the following option:

"editor.quickSuggestions": {
  "other": true,
  "comments": false,
  "strings": false
},

解决此问题并正确地为我工作:

Fix like this and that worked for me correctly:

"editor.quickSuggestions": {
  "other": true,
  "comments": true,
  "strings": true
},