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

Tweak project root heuristics #29

Conversation

BlueHotDog
Copy link
Contributor

This is based off the work of: #16
I wanted to suggest a couple of conventions and organization practices as this project is expected to grow:

  • I've started moving logic related to Project to "Project.ts"
  • this is very personal, but i generally dislike a grab-bag files like utils.ts, they end-up being a catch all for various logic that fits no-where instead of forcing developers to think where things belong - So i extracted file related helpers to fs_helpers.

The benefit of having things like Project/File/ and various other Domain Contextes is that they're by definition easier to test.
What do you guys think?
If you like it, i would love to proceed and organize Server.ts

@IwanKaramazow
Copy link
Contributor

@BlueHotDog would you be willing to set some tests up for this, before I take a look at this?

@BlueHotDog
Copy link
Contributor Author

Sure! i think it would be great to add contribution guidelines. how do i run tests? what tests should i write? do we have code-coverage?

@BlueHotDog
Copy link
Contributor Author

@IwanKaramazow hey, could you please give me a quick rundown on how tests are structured currently and what i should run to satisfy the project requirements(happy to add them myself to the readme)

@IwanKaramazow
Copy link
Contributor

@BlueHotDog Sorry for the late reply, turns out there are no tests in place yet. Will have to take care of that first

@BlueHotDog
Copy link
Contributor Author

NP, maybe we can manually test it and merge it meanwhile? we can't adopt it right now since we use a monorepo

@BlueHotDog
Copy link
Contributor Author

Hi guys, whats the ETA on this?
We're waiting for this PR to land to be able to use the extension on our monorepo. how can we push this?

@IwanKaramazow
Copy link
Contributor

@BlueHotDog taking a look at this now, can you rebase on master?

@IwanKaramazow
Copy link
Contributor

Also does this work locally on your setup? Server doesn't seem to start with this branch, might be something on my computer?

Iwan and others added 4 commits December 16, 2020 11:19
The project root means "this is a folder containing node_modules/bs-platform/{platform}/bsc.exe".
This path needs to be correct because it drives the formatter.

The previous heuristics seemed to fail in the case users where using yarn workspaces.
Yarn workspaces seem to have the following layout:
```
/root
  /node_modules
  - package.json
  - yarn.lock
  /folder1
    /node_modules
    - package.json
    - bsconfig.json
```

The compiler seems to be located in the `node_modules` under the root and not in the `node_modules` of `folder1`.
By searching for `bscPartialPath` instead of the nearest `bsconfig.json`,
we can correctly determine the root.
the "build root" represents the nearest directory containing a "bsconfig.json" file.
"bsconfig.json" can be used to locate the nearest build artefacts and .compiler.log for diagnostics.
@BlueHotDog BlueHotDog force-pushed the tweak-project-root-heuristics branch from 16d68b7 to ce51fac Compare December 16, 2020 09:26
@BlueHotDog
Copy link
Contributor Author

@IwanKaramazow well, this was stale so a bunch of breaking changes merged to master.
Just rebased and checked locally and it seems to work. We're still blocked from using the extension until this lands. Can we please check/merge this so no more conflicts arise? this seems like a very reasonable thing to add.

@IwanKaramazow
Copy link
Contributor

@BlueHotDog I formalised the different cases in #51
Once Hongbo gives his approval, we can go ahead and merge this.

@BlueHotDog
Copy link
Contributor Author

hey guys, any way i can help with this? really want to contribute to this project..(and also start actually using the new syntax)

@chenglou
Copy link
Member

chenglou commented Jan 6, 2021

Hey BlueHotDog! We'd like to avoid early compartmentalization because the editor's various use-cases are still not well defined, so the compartmentalization is more harmful than beneficial. For example, this would have made #59 and subsequent cleanups harder. Thankfully that one was merged first, which obsoletes most of this PR's cleanup actually (it's a good thing). Independent of this PR, one thing is that we don't want to have a notion of an editor "project". This is a concept that doesn't fit well into many's workflow (e.g. the moment you open a new tab on a file that isn't part of a project) and certainly goes against most other LSP-enabled editors' usages (though we also try to only use LSP for vscode and vim, due to LSP being not ideal in general).

Thanks for the effort though =)

@chenglou chenglou closed this Jan 6, 2021
@chenglou
Copy link
Member

chenglou commented Jan 6, 2021

Though we should write down this latter part somewhere more prominent.

@BlueHotDog
Copy link
Contributor Author

thanks for the elaborate response @chenglou . two questions:

  • does this now support monorepo?
  • I think that thinking about the editor/extension domain is a good idea, even if that thinking will be through some documents vs code. specifically for new-comers(like me) that will be able to learn the concepts without the need to understand the technical stuff(maybe worth a different issue to discuss).

@chenglou
Copy link
Member

chenglou commented Jan 6, 2021

Yeah 1.0.4 supports monorepo formatting now

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

Successfully merging this pull request may close these issues.

None yet

3 participants