You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何禁用VS Code中按下"."键触发的自动补全功能?

Fixing Auto-Completion on "." Press in VS Code for React

Got it, I totally get how frustrating it is when pressing "." automatically completes a suggestion instead of just showing the list—especially when you're trying to type React.Component and it jumps to a completion before you're ready. Here's how to fix this:

1. Disable Global Auto-Completion on Commit Characters

The main culprit is VS Code's default setting that lets certain characters (like ".") auto-accept suggestions. Here's how to turn it off:

  • Open VS Code Settings: Press Ctrl+, (Windows/Linux) or Cmd+, (Mac), or go to File > Preferences > Settings.
  • In the search bar, type editor.acceptSuggestionOnCommitCharacter.
  • Uncheck the box next to this setting. This will prevent any commit character (including ".") from automatically accepting the top suggestion.

2. (Optional) Apply Only to React/JSX Files

If you don't want to disable this globally and only want it for React files, you can set this per language:

  • In the Settings search bar, type [javascriptreact] (for JSX) or [typescriptreact] (for TSX).
  • Click on Edit in settings.json for the language-specific section.
  • Add this line inside the curly braces:
    "editor.acceptSuggestionOnCommitCharacter": false
    
    Your settings will look something like this:
    "[javascriptreact]": {
      "editor.acceptSuggestionOnCommitCharacter": false
    }
    

3. Verify the Fix

After changing the setting, go back to your React file:

  • Type React and you'll see the suggestion list pop up.
  • Press "." now—it won't auto-complete the top suggestion; instead, it will just add the "." and show the list of properties/methods (like Component) for you to select with Tab or Enter.

This should resolve the issue without needing to switch to alternative extensions. The setting targets VS Code's core IntelliSense behavior, which is what's causing the auto-completion on ".".

内容的提问来源于stack exchange,提问作者Marko Antonić

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 03:33:12