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

JSON error when formatting with .editorconfig #12921

Closed
YifanAtBioRoboLab opened this issue Nov 4, 2024 · 2 comments
Closed

JSON error when formatting with .editorconfig #12921

YifanAtBioRoboLab opened this issue Nov 4, 2024 · 2 comments
Assignees
Labels
bug Feature: Code Formatting fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix regression A bug that didn't exist in a previous release
Milestone

Comments

@YifanAtBioRoboLab
Copy link

Environment

  • OS and Version: Windows 11 Pro 23H2
  • VS Code Version: 1.95.1
  • C/C++ Extension Version: v1.22.10
  • If using SSH remote, specify OS of remote machine: No SSH involve

Bug Summary and Steps to Reproduce

Bug Summary:
When .editorconfig file presents in the project, formatting c++ code will result in JSON error: conversion mismatch shown in debug output penal. As a result, the extension uses default vcFormat setting to format.

This is reproducible in version 1.22.0 or above. For version before 1.22.0 the formatting has no issue handling editorconfig file and can format code as desired.

Steps to reproduce:

  1. Install and enable C/C++ extension version v1.22.10
  2. In Preference: Open Settings(UI), ensure 'C_Cpp: Clang_format_style' set to 'file' and 'C_Cpp: Formatting' set to 'default'
  3. Unzip format_test.zip to a test folder
  4. Open format_test folder with Vscode
  5. Open test.cpp.
  6. Right click code, select 'Format Document'
  7. In 'Output' window's dropdown list, select C/C++
  8. See error:

Expected behavior:
No JSON error displayed and in C++ code, 'else' should stay in the same line with '}'

Configuration and Logs

Database safe to open.
LSP: (received) cpptools/formatDocument: file:///c%3A/workspace/format_test/test.cpp (id: 12)
LSP: (invoked) cpptools/formatDocument: file:///c%3A/workspace/format_test/test.cpp (id: 12)
JSON error: editorConfigSettings.cpp_indent_braces: conversion mismatch
JSON error: editorConfigSettings.cpp_indent_preserve_within_parentheses: conversion mismatch
JSON error: editorConfigSettings.cpp_indent_case_labels: conversion mismatch
JSON error: editorConfigSettings.cpp_indent_case_contents: conversion mismatch
JSON error: editorConfigSettings.cpp_indent_case_contents_when_block: conversion mismatch
JSON error: editorConfigSettings.cpp_indent_lambda_braces_when_parameter: conversion mismatch
JSON error: editorConfigSettings.cpp_indent_access_specifiers: conversion mismatch
JSON error: editorConfigSettings.cpp_indent_namespace_contents: conversion mismatch
JSON error: editorConfigSettings.cpp_indent_preserve_comments: conversion mismatch
JSON error: editorConfigSettings.cpp_new_line_scope_braces_on_separate_lines: conversion mismatch
JSON error: editorConfigSettings.cpp_new_line_close_brace_same_line_empty_type: conversion mismatch
JSON error: editorConfigSettings.cpp_new_line_close_brace_same_line_empty_function: conversion mismatch
JSON error: editorConfigSettings.cpp_new_line_before_catch: conversion mismatch
JSON error: editorConfigSettings.cpp_new_line_before_else: conversion mismatch
JSON error: editorConfigSettings.cpp_new_line_before_while_in_do_while: conversion mismatch
JSON error: editorConfigSettings.cpp_space_within_parameter_list_parentheses: conversion mismatch
JSON error: editorConfigSettings.cpp_space_between_empty_parameter_list_parentheses: conversion mismatch
JSON error: editorConfigSettings.cpp_space_after_keywords_in_control_flow_statements: conversion mismatch
JSON error: editorConfigSettings.cpp_space_within_control_flow_statement_parentheses: conversion mismatch
JSON error: editorConfigSettings.cpp_space_before_lambda_open_parenthesis: conversion mismatch
JSON error: editorConfigSettings.cpp_space_within_cast_parentheses: conversion mismatch
JSON error: editorConfigSettings.cpp_space_after_cast_close_parenthesis: conversion mismatch
JSON error: editorConfigSettings.cpp_space_within_expression_parentheses: conversion mismatch
JSON error: editorConfigSettings.cpp_space_before_block_open_brace: conversion mismatch
JSON error: editorConfigSettings.cpp_space_between_empty_braces: conversion mismatch
JSON error: editorConfigSettings.cpp_space_before_initializer_list_open_brace: conversion mismatch
JSON error: editorConfigSettings.cpp_space_within_initializer_list_braces: conversion mismatch
JSON error: editorConfigSettings.cpp_space_preserve_in_initializer_list: conversion mismatch
JSON error: editorConfigSettings.cpp_space_before_open_square_bracket: conversion mismatch
JSON error: editorConfigSettings.cpp_space_within_square_brackets: conversion mismatch
JSON error: editorConfigSettings.cpp_space_before_empty_square_brackets: conversion mismatch
JSON error: editorConfigSettings.cpp_space_between_empty_square_brackets: conversion mismatch
JSON error: editorConfigSettings.cpp_space_group_square_brackets: conversion mismatch
JSON error: editorConfigSettings.cpp_space_within_lambda_brackets: conversion mismatch
JSON error: editorConfigSettings.cpp_space_between_empty_lambda_brackets: conversion mismatch
JSON error: editorConfigSettings.cpp_space_before_comma: conversion mismatch
JSON error: editorConfigSettings.cpp_space_after_comma: conversion mismatch
JSON error: editorConfigSettings.cpp_space_remove_around_member_operators: conversion mismatch
JSON error: editorConfigSettings.cpp_space_before_inheritance_colon: conversion mismatch
JSON error: editorConfigSettings.cpp_space_before_constructor_colon: conversion mismatch
JSON error: editorConfigSettings.cpp_space_remove_before_semicolon: conversion mismatch
JSON error: editorConfigSettings.cpp_space_after_semicolon: conversion mismatch
JSON error: editorConfigSettings.cpp_space_remove_around_unary_operator: conversion mismatch
Formatting document: file:///c%3A/workspace/format_test/test.cpp
Formatting Engine: vcFormat

Other Extensions

No response

Additional context

No response

@sean-mcmanus
Copy link
Contributor

This was a regression from #12579 .

@sean-mcmanus sean-mcmanus assigned sean-mcmanus and unassigned Colengms Nov 5, 2024
@sean-mcmanus sean-mcmanus modified the milestones: 1.23, 1.23.1 Nov 5, 2024
@sean-mcmanus sean-mcmanus moved this to Pull Request in cpptools Nov 5, 2024
@sean-mcmanus sean-mcmanus assigned Colengms and unassigned sean-mcmanus Nov 5, 2024
@Colengms Colengms added the fixed Check the Milestone for the release in which the fix is or will be available. label Nov 5, 2024
@sean-mcmanus sean-mcmanus modified the milestones: 1.23.1, 1.22.11 Nov 5, 2024
@sean-mcmanus
Copy link
Contributor

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Feature: Code Formatting fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix regression A bug that didn't exist in a previous release
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants