Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

format doesn't work #5901

Closed
Saad2012 opened this issue Aug 5, 2020 · 4 comments
Closed

format doesn't work #5901

Saad2012 opened this issue Aug 5, 2020 · 4 comments

Comments

@Saad2012
Copy link

Saad2012 commented Aug 5, 2020

Type: LanguageService

Describe the bug

  • OS and Version: Linux Focal Fossa
  • VS Code Version: 1.48.0 code-insiders
  • C/C++ Extension Version: 0.30.0-insiders
  • Other extensions you installed (and if the issue persists after disabling them):
  • Does this issue involve using SSH remote to run the extension on a remote machine?: No
  • A clear and concise description of what the bug is, including information about the workspace (i.e. is the workspace a single project or multiple projects, size of the project, etc).

Steps to reproduce
format is not working

Expected behavior

Logs
Insert logs here.

Screenshots

Additional context

@Saad2012 Saad2012 changed the title formatting doesn't work format doesn't work Aug 5, 2020
@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Aug 5, 2020

Is this a regression compared to 0.29.0?

Can you provide a code sample that fails to format? What is the result of formatting int foo(){return 0;}?

We need more info on your formatting settings. With 0.30.0-insders, a new vcFormat value for C_Cpp.formatting uses a new formatting implementation, which is also used if the C_Cpp.clang_format_style is set to Visual Studio (or if the C_Cpp.clang_format_fallbackStyle is used due to no .clang-format file being found). Is the issue resolved if you change the styles to use Emulated Visual Studio?

@sean-mcmanus sean-mcmanus added more info needed The issue report is not actionable in its current state Feature: Code Formatting Language Service labels Aug 5, 2020
@Saad2012
Copy link
Author

Saad2012 commented Aug 5, 2020

after format (the new lines didn't get fixed by the format also)

void display()
{
    int i;
    printf("\n");
    if (front == -1 && rear == -1)printf("\n QUEUE IS EMPTY"); else
    {

	if (front < rear)
	{
	    for (i = front; i <= rear; i++)printf("\t         %d", queue[i]);
	}
	else






	{
	    for (i = front; i < MAX; i++)printf("\t         %d", queue[i]);
	    for (i = 0; i <= rear; i++)printf("\t         %d", queue[i]);
	}
    }
}
int foo() {
    return 0;
}

thank you for the response , I wasn't aware of these settings before .
i was just using the default settings :

 "[c]": {
      "editor.defaultFormatter": "ms-vscode.cpptools"
  },
  "editor.defaultFormatter": "vscode.configuration-editing",`

"[cpp]": {
"editor.defaultFormatter": "ms-vscode.cpptools"
},

now the format is good and back when I added "C_Cpp.clang_format_style": "Emulated Visual Studio"`

void display()
{
	int i;
	printf("\n");
	if (front == -1 && rear == -1)
		printf("\n QUEUE IS EMPTY");
	else
	{
		if (front < rear)
		{
			for (i = front; i <= rear; i++)
				printf("\t         %d", queue[i]);
		}
		else
		{
			for (i = front; i < MAX; i++)
				printf("\t         %d", queue[i]);
			for (i = 0; i <= rear; i++)
				printf("\t         %d", queue[i]);
		}
	}
}
int foo()
{
	return 0;
}

@Saad2012 Saad2012 closed this as completed Aug 5, 2020
@Saad2012
Copy link
Author

Saad2012 commented Aug 5, 2020

solved

@sean-mcmanus
Copy link
Contributor

I've filed an issue in regards to the "vcFormat" or "Visual Studio" fallback style at https://developercommunity.visualstudio.com/content/problem/1137727/cc-formatting-doesnt-work-as-expected.html .

@sean-mcmanus sean-mcmanus added this to the Tracking milestone Aug 5, 2020
@sean-mcmanus sean-mcmanus added Visual Studio Inherited from Visual Studio and removed more info needed The issue report is not actionable in its current state labels Aug 5, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Oct 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants