Code autocompletion in SourceCraft Code Assistant

Note

The interface language of the Visual Studio Code plugin depends on the selected IDE language.

The smart autocompletion mode explicitly supports code autocompletion for the following programming languages and frameworks:

  • C++
  • Go
  • Java
  • JavaScript/TypeScript
  • Kotlin
  • Python
  • Scala
  • SQL
  • Swift

Autocompletion may also work for other languages. For languages ​​that are less represented in public repositories, the number and quality of autocompletion prompts will be lower.

Code Assistant analyzes your code context and provides the following types of suggestions:

  • Automatic.
  • User-triggered (Ctrl + Space). In Visual Studio Code, you can also use Ctrl + Enter.

How to work with Code Assistant:

  1. Open the IDE and create a test file named server.cpp with the following contents:

    // simple web-server to work with sockets
    
    #include <iostream>
    #include <string>
    #include <sys/socket.h>
    #include <netinet/in.h>
    #include <unistd.h>
    
    using namespace std;
    
    int main() {
    
    }
    
  2. In the int main() section, start typing something, e.g., //create socket. See the Code Assistant suggestion:

    ...
    int main() {
    
    //create socket
    int sockfd = socket(AF_INET, SOCK_STREAM, 0);
    
    }
    
  3. Select an action for the suggestion:

    • Click Tab to accept the suggestion.
    • To start accepting the suggestion word by word, press Ctrl + for Windows or Linux or Command + for macOS.
    • To discard the suggestion, press Esc.
    • If there are multiple suggestions, you can switch between them using Alt + [ and Alt + ] for Windows or Linux or Option + [ and Option + ] for macOS.
    • Click Tab to accept the suggestion.
    • To discard the suggestion, press Esc.

You can also watch our Code Assistant here video tutorial .

Suggestion indicator

When generating a suggestion, the loading icon will appear to the left of the editable code. If generation stops or there is no result, you will see the (no suggestion) icon.

The suggestion indicator is enabled by default.

To enable or disable the indicator:

  1. Click the plugin icon in the bottom-right panel.
  2. In the menu that opens, select Settings.
  3. In the settings window, enable or disable Enable Empty Indicator and Enable Loading Indicator.
  1. In the top-right corner, click and select Settings....
  2. In the left-hand column, select SourceCraft Code Assistant.
  3. Enable or disable Disable suggest indicator.
  4. Click Save to save the settings.

See also

Previous
Next