rome / tools

Unified developer tools for JavaScript, TypeScript, and the web
https://docs.rome.tools/
MIT License
23.75k stars 664 forks source link

πŸ› VSCode extension doesn't always use `rome.json` #3088

Closed lgarron closed 2 years ago

lgarron commented 2 years ago

Environment information

VSCode Version: 1.70.2
macOS 12.5.1
rome v0.8.0-next.ff4153b
Rome VSCode extension v0.12.0

What happened?

  1. Create rome.json in the root of the project (same folder as package.json).
  2. Verify that npx rome format works.
  3. Format a file in VSCode using the Rome extension.

Example config:

{
  "formatter": {
    "indentStyle": "space",
    "indentSize": 2
  }
}

Sometimes, the extension uses rome.json successfully for formatting (in this case, format using spaces). But most of the time for me, it just seems to act as if rome.json doesn't exist, and formats using the defaults (in this case, format using tabs).

Expected result

The extension always uses rome.json.

Apologies for such a vague issue. I'd be happy to debug if I could have some hints to figure out where to look.

Code of Conduct

ematipico commented 2 years ago

How do you format your code? Do you have the format on save option enabled?

lgarron commented 2 years ago

How do you format your code? Do you have the format on save option enabled?

The same issue happens for all of the following invocations:

ematipico commented 2 years ago

I can't seem to reproduce it :(

I might try to add some more logging, maybe that would help to understand what's going on.

lgarron commented 2 years ago

I can't seem to reproduce it :(

Yeah, unfortunately, I still have this issue consistently, on two different macOS devices. :-/ I've tried using a blank settings.json for VSCode, and that doesn't seem to make a difference either.

Happy to try it with any debug logging you see fit!

lgarron commented 2 years ago

Okay, I'm still able to reproduce this in the most minimal macOS environment I can:

git clone https://github.com/cubing/cubing.js && cd cubing.js
git checkout rome-again
npm install
code .

Observed: Rome format using tabs.

Expected: Rome formats using spaces, per rome.json in the checkout.

Is it possible that the this is an issue on all macOS installations?

ematipico commented 2 years ago

I identified the issues and a PR should be ready soon. The issue is caused by the language client, that is setting up the base path differently than expected.

lgarron commented 2 years ago

I identified the issues and a PR should be ready soon. The issue is caused by the language client, that is setting up the base path differently than expected.

Thanks for the fix! 😍 Any chance I could ask for a patch release so that I can start using the extension? πŸ˜ƒ

ematipico commented 2 years ago

I identified the issues and a PR should be ready soon. The issue is caused by the language client, that is setting up the base path differently than expected.

Thanks for the fix! 😍 Any chance I could ask for a patch release so that I can start using the extension? πŸ˜ƒ

We're preparing for a release, which will be next week :)

lgarron commented 2 years ago

I was glad to try the new release! I'm sorry to say that it doesn't seem to be any better at using rome.json. It managed to do so initially, but now I can't get it to do so at all. πŸ˜”

This is using stable VSCode with no rome.lspBin config.

lgarron commented 2 years ago

Okay, I figured it out, my rome.json format was no longer valid for the latest LSP.

lgarron commented 1 year ago

Is it possible there was a regression for this? I've had issues again for the last few weeks, and I can't figure out how to fix it.

ematipico commented 1 year ago

Is it possible there was a regression for this? I've had issues again for the last few weeks, and I can't figure out how to fix it.

From last week? (latest release) Feel free to open a new issue.

lgarron commented 1 year ago

From last week? (latest release) Feel free to open a new issue.

It looks like this is because the rome.json format changed again, and the extension doesn't provide any indication that it silently upgraded to an incompatible syntax.

https://github.com/rome/tools/discussions/3218 would be the best permanent approach I can see.