Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

馃悰 JSON file format with VSCode (save on format) do not match formatter #4630

Open
1 task done
fearless23 opened this issue Jun 28, 2023 · 2 comments
Open
1 task done
Labels
S-To triage Status: user report of a possible bug that needs to be triaged

Comments

@fearless23
Copy link

fearless23 commented Jun 28, 2023

Environment information

CLI:
  Version:                      12.1.3
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           windows

Environment:
  ROME_LOG_DIR:                 unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v18.16.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "npm/9.5.1"

Rome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    true
  VCS disabled:                 true

Workspace:
  Open Documents:               0

Discovering running Rome servers...

Running Rome Server: 鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣鈹佲攣

i The client isn't connected to any server but rage discovered this running Rome server.

Server:
  Version:                      12.1.3
  Name:                         rome_lsp
  CPU Architecture:             x86_64
  OS:                           windows

Workspace:
  Open Documents:               0

Other Active Server Workspaces:

Workspace:
  Open Documents:               2
  Client Name:                  Visual Studio Code
  Client Version:               1.79.2

What happened?

  1. Following is the .vscode/settings.json contents
{
  "[typescript]": {
    "editor.defaultFormatter": "rome.rome"
  },
  "[json]": {
    "editor.defaultFormatter": "rome.rome"
  },
  "editor.codeActionsOnSave": {
    "source.fixAll": true,
    "source.organizeImports.rome": true
  },
  "editor.formatOnSave": true,
  "editor.defaultFormatter": "rome.rome",
  "typescript.tsdk": "./node_modules/typescript/lib",
  "typescript.enablePromptUseWorkspaceTsdk": true
}
  1. Following is the sample JSON file ( in this case tsconfig.json), let call this V1
{
	"compilerOptions": {
		"lib": ["ES2023"],
		"baseUrl": ".",
		"target": "ES2022",
		... other properties
	}
}

On Pressing Ctrl+S after editing this file, it is converted to following and , let call this V2

{
	"compilerOptions": {
		"lib": [
			"ES2023"
		],
		"baseUrl": ".",
		"target": "ES2022",
		... other properties
	}
}

Whereas, running rome format . --write, convert it back to V1. Thus, rome ci will fail if using V2.

Expected result

Expected to have same behavior from Rome CLI and Rome VSCode (Feature / format on save) extension, regarding JSON file formatting.

Code of Conduct

  • I agree to follow Rome's Code of Conduct
@fearless23 fearless23 added the S-To triage Status: user report of a possible bug that needs to be triaged label Jun 28, 2023
@fearless23 fearless23 changed the title 馃悰 <TITLE> 馃悰 JSON file format with VSCode (save on format) do not match formatter Jun 28, 2023
@ematipico
Copy link
Contributor

The rage command shows that you're not using the VSCode extension. Do you know which version of the extension you have installed?

@fearless23
Copy link
Author

@ematipico updated the rome rage output, earlier it was truncated

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
S-To triage Status: user report of a possible bug that needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants