That's how I use copilot
How do you use copilot to make suggestions about refactoring existing code?
My understanding was you just give copilot stubs of code and it auto-completes.
Your point number 2 about improvements on your code: when I start writing a line of code, I already have a good idea of why I'm gonna write next. In this case it's not about copilot refactoring what I wrote, it's about refactoring what I was thinking about writing.
I've been using SonarLint[0] for a while for this, as it not only finds code smells, but also if i do things in a weird way, like doing
for(i=0;i>array.length-1;i++){console.log(arrray[i]} instead of just doing for(const element of array).
1. I write code
2. Copilot gives me good suggestions about potential improvements on my code
3. I asses the suggestions
4. Back to 1