tools icon indicating copy to clipboard operation
tools copied to clipboard

🐛 Multiworkspace setup: VSCode extension can't find rome.json

Open gudleik opened this issue 2 years ago • 9 comments

Environment information

From About VSCode:

Version: 1.72.2
Commit: d045a5eda657f4d7b676dedbfa7aab8207f8a075
Date: 2022-10-12T22:15:55.763Z
Electron: 19.0.17
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin arm64 22.1.0
Sandboxed: No

Rome VSCode extension: v0.17.20221028

What happened?

Monorepo structure

apps/
  frontend/
  backend/
packages/
  pkg-a/
  pkg-b/
package.json
rome.json

Rome can't detect rome.json as it only looks for the file in apps/ or packages/. From rome server log:

├─41780092ms INFO rome_lsp::server Attempting to load the configuration from 'rome.json' file
├─41780092ms INFO rome_service::configuration Attempting to load the configuration file at path "/Users/gudleik/code/monorepo/apps/rome.json"
├─41780092ms ERROR rome_service::configuration Could not find the file configuration at "/Users/gudleik/code/monorepo/apps/rome.json"

Symlinking rome.json into apps and packages seems to work.

Expected result

Rome should be able to find the rome.json from the workspace root

Code of Conduct

  • [X] I agree to follow Rome's Code of Conduct

gudleik avatar Oct 31 '22 08:10 gudleik

Thanks for reporting this issue.

What folder did you open in VS Code? The mono repo folder, apps or packages?

MichaReiser avatar Oct 31 '22 08:10 MichaReiser

We open vscode using a vscode workspace config file from the workspace root: code ./project.code-workspace.

gudleik avatar Oct 31 '22 09:10 gudleik

We open vscode using a vscode workspace config file from the workspace root: code ./project.code-workspace.

I'm having difficulties understanding the setup. Are you referring to this VS Code functionality?

Is the Monorepo structure that you shared the structure on the filesystem or what you configured in VS Code?

Would it possible for you to share the VS Code workspace configuration with us?

MichaReiser avatar Oct 31 '22 09:10 MichaReiser

I'm having difficulties understanding the setup. Are you referring to this VS Code functionality?

Yes. Rome seems to work fine when starting without using the workspace config, ie code . (where . is the project root).

Our workspace config has this configuration:

{
  "folders": [
    {
      "name": "apps",
      "path": "apps"
    },
    {
      "name": "packages",
      "path": "packages"
    },
    {
      "name": "tests",
      "path": "tests"
    },
    {
      "name": "devops",
      "path": "devops"
    },
    {
      "name": "root",
      "path": "."
    }
  ]
}

If I re-arrange the folders and put root on top, rome finds rome.json and everything works fine.

gudleik avatar Oct 31 '22 10:10 gudleik

This issue is stale because it has been open 14 days with no activity.

github-actions[bot] avatar Nov 14 '22 12:11 github-actions[bot]

The suggested workaround does not work on my side. VSCodium 1.76.0 Release 23062. My projectstructure is simular to the one in the original post. Except that I have a .vsode directory in the root where the workspace definiton lies. Moving the definiton to the root does not resolve the issue.

woifes avatar Mar 06 '23 19:03 woifes

The next version of Rome will auto discover the configuration file automatically, that will solve the issue

ematipico avatar Mar 06 '23 19:03 ematipico

The extension doesn't seem to pick on multi-root workspaces. I have a setup like this:

project
  - rome.json
  - project.workspace
  /backend
    - rome.json
  /frontend

With workspace file:

{
  "folders": [
    {
      "path": ".",
      "name": "project"
    },
    {
      "path": "backend",
      "name": "backend"
    },
    {
      "path": "frontend",
      "name": "frontend"
    }
  ],
}

The project and backend folders have separate installations of rome in their package.json and different configs, but the extension only picks up on the config in project folder even if I browse the code in the backend. The CLI calls do respect their related configs and this creates a situation where I get nagged about errors in IDE when the CLI tool doesn't.

GabenGar avatar Apr 09 '23 17:04 GabenGar

Thank you for the feedback. The extension is not ready yet to support multiple projects inside a workspace.

That will be solved once Rome will have this awareness

ematipico avatar Apr 10 '23 09:04 ematipico