If you select code between horizontal lines and click Refactor (VA) -> Extract Method, VAX will propose to create method with return type void, whereas it could be deduced that this method should return lineLength.
Thanks!
#include <windows.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
// Select this text and click Refactor (VA) -> Extract Method
// VAX will create "void MyMethod()" whereas I expect "unsigned MyMethod()"
// to return variable lineLength which is used later in printf.
//-----------------------------------------------
HANDLE hInput = GetStdHandle(STD_OUTPUT_HANDLE);
if (hInput == INVALID_HANDLE_VALUE)
printf("GetStdHandle(STD_OUTPUT_HANDLE) failed.");
CONSOLE_SCREEN_BUFFER_INFOEX csbie;
csbie.cbSize = sizeof(csbie);
unsigned lineLength;
if (!GetConsoleScreenBufferInfoEx(hInput, &csbie))
{
printf("GetConsoleScreenBufferInfoEx() failed.");
lineLength = 80;
}
else
lineLength = csbie.dwSize.X;
//-----------------------------------------------
printf("%u\\n", lineLength);
return 0;
}
Visual Assist version 10.9.2074.
Visual Studio 2015 Community.