如何使VS Code的自动完成更严格? [英] How to make VS Code's auto-complete more strict?

查看:127
本文介绍了如何使VS Code的自动完成更严格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢Visual Studio Code,但是它的Intellisense自动完成功能使我发疯,并且我用它打错了很多字。所以我觉得我一定用错了。

I love Visual Studio Code, but its Intellisense auto-complete drives me crazy and I make more typos with it than it helps. So I feel I must be using it wrong.

这个问题很难解释,所以下面有一个屏幕截图:

The problem is very hard to explain, so I have a screenshot below:

我键入 thi 。我希望/希望/希望自动完成功能会查找连续顺序包含 thi 的任何自动完成功能。但事实并非如此。相反,它将查找任何内容,其中包含字母 t h i 。他们不必彼此相邻,甚至不需要从 t 开始。

I typed in thi. I would hope/expect/want that autocomplete would only look for anything to autocomplete that contains thi in consecutive order. But it does not. Instead it looks for anything with the letters t, h, and i in them. They needn't be next to each other, nor does the thing of interest even need to start with t.

我想驯服自动完成以仅查找连续的字母。有没有办法做到这一点? (我的大部分工作都使用Python,Javascript和SQL,但我希望配置是跨语言的。)

I would like to "tame" auto-complete to only find consecutive letters. Is there a way to do this? (I use Python, Javascript, and SQL for most of my work, but I'm hoping the config is cross-language.)

理想情况下,我想要自动-完成(a)要求所有字母都连续,(b)要求感兴趣的事物以这些字母开头,并且(c)忽略大小写。但是到目前为止,对我来说最重要的问题是解决(a)。

Ideally, I would like the auto-complete to (a) require all letters be consecutive, (b) not require the thing of interest to start with those letters, and (c) ignore upper/lower case. But by far the most important issue to me is resolving (a).

推荐答案

您遇到的问题是其中添加的一个功能 2017年11月更新。当前无法关闭模糊自动完成功能,但是此问题当前在 GitHub ,然后将添加更改此行为的设置。

The issue you are having is a feature added in November 2017 update. There is currently no way to turn off fuzzy autocomplete, but the issue is currently open on GitHub and the setting to change this behavior will be added.

与此同时,您可以使用以下设置调整自动填充功能:

In the meantime you can tweak your autocomplete with these settings:

"editor.wordBasedSuggestions": false,
"javascript.nameSuggestions": false,
"editor.snippetSuggestions": "bottom" / inline, none
"editor.suggestSelection: "recentlyUsedByPrefix"

来自官方文档


使用最后一个选项 recentlyUsedByPrefix 时,VS Code会记住为特定前缀(部分文本)选择了哪个项目,例如,如果键入co然后选择控制台,下次您键入 co <​​/ code>时,他的建议控制台将被预先选择。

这使您可以快速将各种前缀映射到不同的建议,例如


co->控制台 con-> const

When using the last option, recentlyUsedByPrefix, VS Code remembers which item was selected for a specific prefix (partial text). For example, if you typed co and then selected console, the next time you typed co, the suggestion console would be pre-selected.
This lets you quickly map various prefixes to different suggestions, for example:
co -> console and con -> const.

也许:

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

它并不能完全解决您的问题,但它是您无需深入了解VS就可以获得的最接近的问题代码源并创建扩展。

It doesn't solve your problem completely, but it's the closest you can get without digging through VS Code source and creating an extension.

这篇关于如何使VS Code的自动完成更严格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆