cancel
Showing results for 
Search instead for 
Did you mean: 

I'm not used to the automatic code completion feature at present

t_j_l
Visitor

I'm not used to the automatic code completion feature at present. For example, the "for" code block is written as "for (init-statement; condition; inc-expression) {}". Could it be modified to have the code block written as "for (int i=0; i<size; i++) {}"? This would be much more convenient. Do you have such a configuration?

1 REPLY 1
Nawres GHARBI
ST Employee

Hi @t_j_l 

Thanks for the feedback we will try to add such snippet automatically in our extension, otherwise to have this in the code auto completion you have to add a snippet, please follow these steps: 

1- open command palette by CTRL+shift+P

2- search for menu "snippets: configure snippets" and name your snippet file

3- add this snippet (you can change the prefix and description as you want

 

    "C for loop": {
        "scope": "c,cpp",
        "prefix": "fori",
        "body": [
            "for (int i = 0; i < ${1:size}; i++) {",
            "    $0",
            "}"
        ],
        "description": "C-style for loop: for (int i=0; i<size; i++) {}"
    }
 
4- reload VSCode to have your snippet functional