tools
tools copied to clipboard
🐛 Single-line comment below a JSX prop triggers different formatting
Environment information
CLI:
Version: 10.0.0
Color support: true
Platform:
CPU Architecture: aarch64
OS: macos
Environment:
ROME_LOG_DIR: unset
NO_COLOR: unset
TERM: "xterm-256color"
Rome Configuration:
Status: loaded
Formatter disabled: false
Linter disabled: false
Workspace:
Open Documents: 0
Discovering running Rome servers...
Running Rome Server: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ The client isn't connected to any server but rage discovered this running Rome server.
Server:
Version: 10.0.0
Name: rome_lsp
CPU Architecture: aarch64
OS: macos
Workspace:
Open Documents: 0
Other Active Server Workspaces:
Workspace:
Open Documents: 1
Client Name: Visual Studio Code
Client Version: 1.73.0
Note: I got the following error at the end of the output of rome rage
├─5070384ms INFO rome_lsp::server Starting Rome Language Server...
├─5070385ms ERROR tower_lsp::transport failed to encode message: failed to encode response: Socket is not connected (os error 57)
What happened?
Adding a single-line comment below a prop affects formatting in a strange way.
Here is the link to playground: https://play.rome.tools/?code=function+Component%28%29+%7B%0A++return+%28%0A++++%3CTest%0A++++++prop%3D%7Bvalue%7D%0A++++++%2F%2F+comment%0A++++%2F%3E%0A++%29%3B%0A%7D%0A&lineWidth=80&indentStyle=space"eStyle=single"eProperties=as-needed&trailingComma=all&indentWidth=2&sourceType=module&enabledNurseryRules=true&typescript=false&jsx=true#ZgB1AG4AYwB0AGkAbwBuACAAQwBvAG0AcABvAG4AZQBuAHQAKAApACAAewAKACAAIAByAGUAdAB1AHIAbgAgACgACgAgACAAIAAgADwAVABlAHMAdAAKACAAIAAgACAAIAAgAHAAcgBvAHAAPQB7AHYAYQBsAHUAZQB9AAoAIAAgACAAIAAgACAALwAvACAAYwBvAG0AbQBlAG4AdAAKACAAIAAgACAALwA+AAoAIAAgACkAOwAKAH0ACgA=
Input code:
function Component() {
return (
<Test
prop={value}
// comment
/>
);
}
Prettier:
function Component() {
return (
<Test
prop={value}
// comment
/>
);
}
Rome:
function Component() {
return (
<Test
prop={
value
}
// comment
/>
);
}
Expected result
Single-line comments should not affect formatting of surrounding code.
Code of Conduct
- [X] I agree to follow Rome's Code of Conduct