Home  >  Article  >  Development Tools  >  How to set up code auto-completion in vscode

How to set up code auto-completion in vscode

下次还敢
下次还敢Original
2024-04-03 03:09:191514browse

VSCode’s code auto-completion function can be set up through the following steps: 1. Open settings; 2. Search for “auto-completion”; 3. Enable “auto-completion”; 4. Adjust the source of suggestions; 5. Adjust suggestion matching; 6. Enable suggestion delay; 7. Customize suggestion sorting; 8. Adjust suggestion trigger conditions.

How to set up code auto-completion in vscode

How to set up VSCode’s code auto-completion

Visual Studio Code (VSCode) is a popular code The editor provides powerful code auto-completion function, which can greatly improve coding efficiency. The following are the steps to set up VSCode auto-completion:

1. Open Settings

  • Click the gear icon (Settings) button in the lower left, or use the shortcut key Ctrl , (Windows/Linux) or Cmd , (macOS) Open Settings.

2. Search for "auto-complete"

  • In the settings search bar, enter "auto-complete" to filter related settings.

3. Enable "Autocomplete"

  • Under "Editor: Autocomplete", make sure "Enable Autocomplete" The checkbox is checked.

4. Adjust the source of suggestions

  • Under "Editor: Autocomplete", you can configure the source of autocomplete suggestions source. By default, VSCode will make suggestions from:

    • Current file
    • Opened files
    • Installed extensions
  • These sources can be enabled or disabled as needed.

5. Adjust suggested matching

  • Under "Editor: Autocomplete", you can also configure how to match suggestions text. The following options are available:

    • Prefix match: Suggestions will be an exact match to the text being typed.
    • Substring matching: It is recommended to include the text being typed as a substring.
    • Fuzzy Match: Suggestions will be similar to the text you are typing.
  • Choose the matching method that best suits your coding style.

6. Enable suggestion delay

  • Under "Editor: Autocompletion", the "Delay" option allows specifying a delay in autocompletion The number of milliseconds that require a key press before the prompt appears. This prevents autocomplete hints from popping up unnecessarily.

7. Customize suggested sorting

  • Under "Editor: Autocomplete", the "Suggested sorting" option allows Customize the sort order of autocomplete suggestions. Suggestions can be sorted based on the following factors:

    • Recent
    • Name
    • Type
    • Distance

8. Adjust the triggering conditions for suggestions

  • #Under "Editor: Autocomplete", you can configure the triggering conditions for the automatic completion prompts. . The following options are available:

    • Only after typing characters
    • After trigger character
    • Next to trigger character
  • ## Choose the most appropriate trigger condition according to your needs.

The above is the detailed content of How to set up code auto-completion in vscode. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn