vmsynkov-zz / colonize

Visual Studio Code extension
GNU General Public License v3.0
38 stars 19 forks source link

Fixes keypress not accepting current Intellisense autocomplete #2

Closed bbugh closed 7 years ago

bbugh commented 7 years ago

If one of the shortcut keys is pressed while there is an Intellisense suggestion selected, the suggestion currently will not be completed. This PR executes the vscode command to accept the current suggestion before running the cursor change command.


// Starting code: 
_myVar = something;
DoSomething(_myV)

// Current functionality, Alt+Enter
DoSomething(_myV);
// cursor here, no autocomplete

// Patch functionality, Alt+Enter
DoSomething(_myVar);
// cursor here, _myVar was autocompleted based on currently selected Intellisense
vmsynkov-zz commented 7 years ago

Hey, i tried this one and seems like it works only inside parentheses.

var myVar  = 1;

console.log(myVar);
//here works fine

var wop = 555 + my;
// but in this case nothing happens
vmsynkov-zz commented 7 years ago

I figured out now how to make it work.

vscode.commands.executeCommand('acceptSelectedSuggestion').then(()=>{
// do the insertion and cursor stuff here
})