Skip to content

Conversation

ryyppy
Copy link
Member

@ryyppy ryyppy commented Dec 18, 2020

Based off #18
Fixes #17

This PR implements the same tool detection heuristic as discussed in the accompanying rescript-vscode PR.

We still need sign off by hongbo if this is the correct implementation from a compiler perspective

For those who want to try this configuration in their local setup:

  Plug 'rescript-lang/vim-rescript', {'branch': 'monorepo-support'}

Update 28th Dec:
@IwanKaramazow created a draft for a "ReScript Project Specification" (this was deemed to be too complex, we found a better solution, see next update).

Update 6th Jan, 2021:
The aforementioned specification was way too complex, the team settled on a more straightforward approach that is now merged in rescript-vscode (see code here). More details on the change can be found in this PR.

The fallback is to use the node_modules/.bin wrappers for bsc and bsb. This works, because yarn workspaces doesn't seem to touch .bin folders, so it's guaranteed to exist. It's not ideal since node wrappers cause slower process execution, but there is no other better reliable way right now.

Our solution we proposed before works just fine without the bsb wrapper downsides. Only problem was to fix project env detection on each file open etc. This is fixed now.

@ryyppy ryyppy marked this pull request as draft December 18, 2020 19:47
@ryyppy ryyppy changed the title Monorepo support (yarn workspaces) Monorepo support (e.g. yarn workspaces) Jan 6, 2021
ryyppy added 9 commits January 6, 2021 13:34
We introduce a rescript#UpdateProjectEnv() function to update the binary
paths on a per file basis. Also added an augroup in for .res / .resi files
to automatically update the environment on file open / new file creation.

Format() and Build() also do an update before executing any logic.

We also make Build() a little bit more flexible by allowing a string
argument for extra parameters.
@ryyppy ryyppy marked this pull request as ready for review January 6, 2021 13:44
@ryyppy ryyppy merged commit 0581193 into master Jan 6, 2021
@ryyppy ryyppy deleted the monorepo-support branch January 6, 2021 13:44
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.

Support for Monorepos via Yarn Workspaces

3 participants