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

🐛 biome format issues with cr on windows #4789

Closed
1 task done
sibouras opened this issue Dec 24, 2024 · 6 comments
Closed
1 task done

🐛 biome format issues with cr on windows #4789

sibouras opened this issue Dec 24, 2024 · 6 comments
Labels
S-Needs repro Status: needs a reproduction S-Needs triage Status: this issue needs to be triaged

Comments

@sibouras
Copy link

Environment information

CLI:
  Version:                      1.9.4
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           windows

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  NO_COLOR:                     unset
  TERM:                         unset
  JS_RUNTIME_VERSION:           unset
  JS_RUNTIME_NAME:              unset
  NODE_PACKAGE_MANAGER:         unset

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

Workspace:
  Open Documents:               0

What happened?

this is a copy of an issue i opened in helix

Summary

when copying multiline text on windows and then replacing the selection with space+R the carriage return cr doesn't get removed which causes bugs in biome formatting, pasting with space+p which trims cr works fine though

Reproduction Steps

sample code to copy

const people = [
	{ name: "one", year: 2000 },
	{ name: "two", year: 2001 },
	{ name: "three", year: 2002 },
	{ name: "four", year: 2003 },
];
hx-biome-bug.mp4

I tried this:

  1. open helix, paste the sample text and save
  2. biome format , no cr is showing(expected)
  3. replace the selection with space+R
  4. biome format shows cr
  5. run fmt multiple times and biome gets confused

this is my config

[[language]]
name = "javascript"
language-servers = [
  { name = 'biome' },
  { name = 'typescript-language-server', except-features = ['format'] },
]

[language-server.biome]
command = "biome"
args = ["lsp-proxy"]
required-root-patterns = ["biome.json", "biome.jsonc"]

Expected result

expected format to handle cr

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@dyc3
Copy link
Contributor

dyc3 commented Dec 24, 2024

Is it just a carriage return (cr)? AFAIK, that's not a valid newline.

It doesn't look like helix is required to reproduce this, can you provide a reproduction repo?

@dyc3 dyc3 added the S-Needs repro Status: needs a reproduction label Dec 24, 2024
Copy link
Contributor

Hello @sibouras, please provide a minimal reproduction. You can use one of the following options:

  • Provide a link to our playground, if it's applicable.
  • Provide a link to GitHub repository. To easily create a reproduction, you can use our interactive CLI via npm create @biomejs/biome-reproduction

Issues marked with S-Needs repro will be closed if they have no activity within 3 days.

@github-actions github-actions bot removed the S-Needs triage Status: this issue needs to be triaged label Dec 24, 2024
@sibouras
Copy link
Author

not sure how to reproduce this since the cr doesn't show in the playground

the bug only happens when running :format inside helix, if i run biome format --write test.js the cr gets removed, also noticed that i need to be in a git repo for helix to respect biome.json

biome-format.mp4

@ematipico
Copy link
Member

@sibouras please create a repository, the automated message tells you how to.

@sibouras
Copy link
Author

@ematipico ematipico added the S-Needs triage Status: this issue needs to be triaged label Dec 24, 2024
@sibouras
Copy link
Author

the issue is fixed helix-editor/helix@c262fe4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-Needs repro Status: needs a reproduction S-Needs triage Status: this issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

3 participants