Skip to content

Commit

Permalink
Merge branch 'main' of github.com:/reasonml/reason-react into 19
Browse files Browse the repository at this point in the history
* 'main' of github.com:/reasonml/reason-react:
  Install melange.5.0.0-52 in CI (#882)
  Update deps (#876)
  update setup-ocaml to v3 (#878)
  • Loading branch information
davesnx committed Feb 26, 2025
2 parents 0bc3400 + 3ad0d01 commit e9a07d7
Show file tree
Hide file tree
Showing 13 changed files with 349 additions and 6,752 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/opam.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
key: opam-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('**.opam') }}

- name: Use OCaml ${{ matrix.ocaml-compiler }}
uses: ocaml/setup-ocaml@v2
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
dune-cache: true
Expand Down
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ format-check: ## Checks if format is correct

.PHONY: install
install: ## Update the package dependencies when new deps are added to dune-project
@opam install . --deps-only --with-test
# --force is needed because we are installing react@19 while other dependencies
# require react@18. It's a good workaround to bypass the npm validation error
# and test the rc versions of React
@opam install . --deps-only --with-test --with-dev-setup
@npm install --force

.PHONY: init
Expand Down
12 changes: 8 additions & 4 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,23 @@
(depends
ocaml
(melange
(>= 3.0.0))
(or
(>= 3.0.0)
(and
(= 5.0.0-52)
:with-test)))
(reason-react-ppx
(= :version))
(reason
(>= 3.12.0))
(ocaml-lsp-server :with-dev-setup)
(opam-check-npm-deps
(and
(= 1.0.0)
(= 3.0.1)
:with-dev-setup))
(ocamlformat
(and
(= 0.24.0)
(= 0.27.0)
:with-dev-setup))))

(package
Expand All @@ -64,5 +68,5 @@
(merlin :with-test)
(ocamlformat
(and
(= 0.24.0)
(= 0.27.0)
:with-dev-setup))))
246 changes: 25 additions & 221 deletions ppx/test/hover.t
Original file line number Diff line number Diff line change
Expand Up @@ -25,232 +25,36 @@ Test some locations in reason-react components, reproduces #840

Let's test hovering over parts of the component

`React.string`:
`React.string`

$ ocamlmerlin single type-enclosing -position 3:25 -verbosity 0 \
> -filename component.ml < component.ml | jq '.value'
[
{
"start": {
"line": 3,
"col": 17
},
"end": {
"line": 3,
"col": 29
},
"type": "string -> React.element",
"tail": "no"
> -filename component.ml < component.ml | jq '.value[0]'
{
"start": {
"line": 3,
"col": 17
},
{
"start": {
"line": 3,
"col": 17
},
"end": {
"line": 3,
"col": 33
},
"type": "React.element",
"tail": "no"
"end": {
"line": 3,
"col": 29
},
{
"start": {
"line": 2,
"col": 2
},
"end": {
"line": 4,
"col": 15
},
"type": "React.element array",
"tail": "no"
},
{
"start": {
"line": 2,
"col": 2
},
"end": {
"line": 4,
"col": 15
},
"type": "React.element",
"tail": "no"
},
{
"start": {
"line": 2,
"col": 2
},
"end": {
"line": 4,
"col": 15
},
"type": "React.element option",
"tail": "no"
},
{
"start": {
"line": 2,
"col": 2
},
"end": {
"line": 4,
"col": 15
},
"type": "ReactDOM.domProps",
"tail": "no"
},
{
"start": {
"line": 2,
"col": 2
},
"end": {
"line": 4,
"col": 15
},
"type": "React.element",
"tail": "no"
},
{
"start": {
"line": 1,
"col": 32
},
"end": {
"line": 4,
"col": 15
},
"type": "bar:int -> React.element",
"tail": "no"
},
{
"start": {
"line": 1,
"col": 27
},
"end": {
"line": 4,
"col": 15
},
"type": "foo:string -> bar:int -> React.element",
"tail": "no"
}
]
"type": "string -> React.element",
"tail": "no"
}

The `foo` variable inside the component body

$ ocamlmerlin single type-enclosing -position 3:31 -verbosity 0 \
> -filename component.ml < component.ml | jq '.value'
[
{
"start": {
"line": 3,
"col": 30
},
"end": {
"line": 3,
"col": 33
},
"type": "string",
"tail": "no"
},
{
"start": {
"line": 3,
"col": 17
},
"end": {
"line": 3,
"col": 33
},
"type": "React.element",
"tail": "no"
},
{
"start": {
"line": 2,
"col": 2
},
"end": {
"line": 4,
"col": 15
},
"type": "React.element array",
"tail": "no"
},
{
"start": {
"line": 2,
"col": 2
},
"end": {
"line": 4,
"col": 15
},
"type": "React.element",
"tail": "no"
},
{
"start": {
"line": 2,
"col": 2
},
"end": {
"line": 4,
"col": 15
},
"type": "React.element option",
"tail": "no"
},
{
"start": {
"line": 2,
"col": 2
},
"end": {
"line": 4,
"col": 15
},
"type": "ReactDOM.domProps",
"tail": "no"
},
{
"start": {
"line": 2,
"col": 2
},
"end": {
"line": 4,
"col": 15
},
"type": "React.element",
"tail": "no"
},
{
"start": {
"line": 1,
"col": 32
},
"end": {
"line": 4,
"col": 15
},
"type": "bar:int -> React.element",
"tail": "no"
},
{
"start": {
"line": 1,
"col": 27
},
"end": {
"line": 4,
"col": 15
},
"type": "foo:string -> bar:int -> React.element",
"tail": "no"
}
]
> -filename component.ml < component.ml | jq '.value[0]'
{
"start": {
"line": 3,
"col": 30
},
"end": {
"line": 3,
"col": 33
},
"type": "string",
"tail": "no"
}
Loading

0 comments on commit e9a07d7

Please sign in to comment.