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

Get "No Elm workspace contains..." with nested projects #94

Open
chadselph opened this issue Apr 5, 2020 · 15 comments
Open

Get "No Elm workspace contains..." with nested projects #94

chadselph opened this issue Apr 5, 2020 · 15 comments
Labels
enhancement New feature or request
Milestone

Comments

@chadselph
Copy link

I checked out the elm-3d-scene project from here https://github.com/ianmackenzie/elm-3d-scene and when I was inside the examples, elm-format was not happening on save.

Expected Behavior

Elm formatting to work on a file in the examples/ directory in elm-3d-scene.

Current Behavior

Elm format does not work on files in the examples/ sub directory.

Possible Solution

It's probably because it finds the elm.json in the parent folder and then never looks for the elm.json in the examples folder.

Steps to Reproduce (for bugs)

  1. git clone https://github.com/ianmackenzie/elm-3d-scene.git
  2. code elm-3d-scene
  3. Go into examples/ (any file)
  4. Put some spaces before a line and save.
@razzeee
Copy link
Member

razzeee commented Apr 5, 2020

Yeah, it's not supposed to work like that, you want to open the examples either as another vscode workspace or as another vscode window.

@razzeee
Copy link
Member

razzeee commented Apr 9, 2020

I guess the sensible thing here would be to document this in the FAQ https://github.com/elm-tooling/elm-language-client-vscode#faq and close this issue thereafter.

@MedeaMelana
Copy link

I ran into this today. Why does this work this way? Requiring an inner project to be opened in its own window seems arbitrary to me.

The extension seems to handle projects that are siblings just fine, so there doesn't seem to be a problem with having multiple Elm projects within the same VS window per se.

@razzeee
Copy link
Member

razzeee commented Aug 29, 2020

The extension seems to handle projects that are siblings just fine, so there doesn't seem to be a problem with having multiple Elm projects within the same VS window per se.

The problem is, that your editor window is not able to choose between the elm projects, should it open in the context of the parent or in the context of the child?

@razzeee razzeee added the enhancement New feature or request label Aug 29, 2020
@MedeaMelana
Copy link

I would say, the context of the child, because it is the more specific one. It means you can have another project inside a bigger one and have the extension use the config of the subproject. It also means that there is a chance for each config to be used (depending on the file's location), whereas if you pick the parent context, there is no file location that would use the child config.

@razzeee
Copy link
Member

razzeee commented Sep 1, 2020

I would like to have it the other way around, as it makes no sense to me, that I end up not finding references to the child project otherwise.

@mewhit
Copy link

mewhit commented Nov 16, 2020

And what about tests folder ? I get same error, what is the workaround, if i want features provided by elm-languag-client for all my tests ?

@razzeee
Copy link
Member

razzeee commented Nov 16, 2020

haven't really looked into that

@marcosh
Copy link

marcosh commented Oct 21, 2022

Runned into this issue myself. I agree that the closest elm.json (i.e. the child one) should be considered. Another option is to try both... if the parent one fails, then you try the child one

@ymtszw
Copy link

ymtszw commented Jun 16, 2023

An unconfirmed idea, does elm-ls work with multiple Elm apps inside a root project, as long as they are NOT nested?

Example:

root/
|- package.json
|- package-lock.json
|- ...
|- workspace-app/
|  |- elm.json
|  |- src/Main.elm
|  `- ...
|- workspace-review/
|  |- elm.json
|  |- src/ReviewConfig.elm
|  `- ...
|- workspace-generator/
|  |- elm.json
|  |- src/GeneratorConfig.elm
|  `- ...
`- ...

My intuition says yes, but not tried yet.
If it works, this style can be considered as a sort-of-workaround. Assuming the root project's package.json utilizes npm workspaces for consolidated deps management.

@ymtszw
Copy link

ymtszw commented Jun 16, 2023

I have a project with nested Elm apps (one root Elm app and two child Elm apps directories) and a quick test has shown this indeed works!
What I did was temporarily move out elm.json of root Elm app, reload VSCode, and open Elm files from two different child Elm apps within one single VSCode instance.
Files from both Elm apps can be correctly handled by elm-ls. Completions, format, code lens, everything works fine.

@vladimirlogachev
Copy link

https://github.com/VladimirLogachev/elm-format-problem

This repo illustrates elm formatting issues.

When the repo is opened as a workspace, formatting doesn't work properly.

It only works for one of the apps, randomly app1 or app2.

Extension output:

[Error - 12:17:09 AM] Error: No Elm workspace contains /Users/user/projects/elm-format-problem/app2/src/Main.elm delayed processing of request

@razzeee
Copy link
Member

razzeee commented Jun 22, 2023

That seems to be a different problem, as those projects are not nested. I would guess the client gets something wrong and talks to the wrong server. As you can see, that the other server updates the text files correctly.

@vladimirlogachev
Copy link

Sure!
I just considered this discussion to be the closest to my problem and posted my example here.
Should I create another issue?

@razzeee
Copy link
Member

razzeee commented Jun 25, 2023

Yes, but I'm not sure when I can look at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants
@chadselph @MedeaMelana @marcosh @ymtszw @razzeee @mewhit @vladimirlogachev and others