Skip to content

Commit

Permalink
Merge pull request #82 from janestreet/merge-with-upstream-merlin-5.2
Browse files Browse the repository at this point in the history
Merge in upstream main for 5.2 merge
  • Loading branch information
ncik-roberts authored Sep 23, 2024
2 parents a492401 + a2607a0 commit ece8c65
Show file tree
Hide file tree
Showing 525 changed files with 118,702 additions and 29,937 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/flambda-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
run: |
opam switch create 4.14.0 --yes
opam switch link 4.14.0 --yes
opam install --yes dune.3.10.0 menhir.20210419
opam install --yes dune.3.10.0 menhir.20231231
- name: Configure, build, and install flambda-backend
if: steps.cache.outputs.cache-hit != 'true'
Expand Down
104 changes: 102 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,103 @@
unreleased
==========

+ merlin binary
- A new `WRAPPING_PREFIX` configuration directive that can be used to tell Merlin
what to append to the current unit name in the presence of wrapping (#1788)
- Add `-unboxed-types` and `-no-unboxed-types` as ocaml ignored flags (#1795, fixes #1794)
- destruct: Refinement in the presence of optional arguments (#1800 #1807, fixes #1770)
- Implement new expand-node command for expanding PPX annotations (#1745)
+ editor modes
- vim: fix python-3.12 syntax warnings in merlin.py (#1798)
- vim: Dead code / doc removal for previously deleted MerlinPhrase command (#1804)

merlin 5.1
==========
Tue Jun 18 12:00:42 CEST 2024

+ merlin binary
- Support project-wide occurrences queries using index files (#1766)
- The file format is described in library `Merlin_lib.index_format`
- Two new configuration directives are introduced:
- `SOURCE_ROOT` that is used to resolve relative paths found in the
indexes.
- `INDEX` that is used to declare the list of index files Merlin should
use when looking for occurrences.
- A new `UNIT_NAME` configuration directive that can be used to tell Merlin
the correct name of the current unit in the presence of wrapping (#1776)
- Perform incremental indexation of the buffer when typing. (#1777)
- `merlin-lib.commands`: Add a `find_command_opt`` alternative to
`find_command` that does not raise (#1778)
- Prevent uid clashes by not returning PWO for defs located in the current
interface file (#1781)
- Reset uid counters when restoring the typer cache so that uids are stable
across re-typing (#1779)
- Improve the behavior on occurrences when the cursor is on a label /
constructor declaration (#1785)
+ editor modes
- emacs: add basic support for project-wide occurrences (#1766)
- vim: add basic support for project-wide occurrences (#1767, @Julow)

merlin 5.0
==========
Fri May 17 19:59:42 CET 2024

+ merlin binary
- Support for OCaml 5.2 (#1757)
- destruct: Removal of residual patterns (#1737, fixes #1560)
- Do not erase fields' names when destructing punned record fields (#1734,
fixes #1661)
- Ignore SIGPIPE in the Merlin server process (#1746)
- Fix lexing of quoted strings in comments (#1754, fixes #1753)
- Improve cursor position detection in longidents (#1756)
- Addition of a `merlin-lib.commands` library which disassociates the
execution of commands from the `new_protocol`, from the binary, allowing
it to be invoked from other projects (#1758)
- New occurrences backend: Don't index occurrences when `merlin.hide`
attribute is present. (#1768)
- Use the new `uid_to_decl` table in 5.2's cmt files to get documentation.
(#1773)

merlin 4.14
===========
Thu Feb 22 14:00:42 CET 2024

+ merlin binary
- Preliminary support for OCaml 5.2
- Some regressions in recovery and destruct are present.
- Add a "heap_mbytes" field to Merlin server responses to report heap usage (#1717)
- Add cache stats to telemetry (#1711)
- Add new SyntaxDocument command to find information about the node under the cursor (#1706)
- Fix `FLG -pp ppx.exe -as-pp/-dump-ast` use of invalid shell redirection when
direct process launch on Windows. (#1723, fixes #1722)
- Add a query_num field to the `ocamlmerlin` responses to detect server crashes (#1716)
- Jump to cases within a match statement (#1726)
- Jump to `module-type` (#1728, partially fixes #1656)
- Exposes stable functions for configuration handling and pattern variable
destruction. (#1730)
+ editor modes
- vim: load merlin under the ocamlinterface and ocamllex filetypes (#1340)
- Fix merlinpp not using binary file open (#1725, fixes #1724)

merlin 4.13.1
=============
Fri Dec 1 15:00:42 CET 2023

+ merlin binary
- Fix a follow-up issue to the preference of non-ghost nodes introduced in #1660 (#1690, fixes #1689)
- Add `-cache-lifespan` flag, that sets cache invalidation period. (#1698,
#1705)
- Ignore the new 5.1 `cmi-file` flag instead of rejecting it (#1710, fixes
#1703)
- Fix Merlin locate not fallbacking on the correct file in case of ambiguity
(@goldfirere, #1699)
- Fix Merlin reporting errors provoked by the recovery itself (#1709, fixes
#1704)
- Add support for OCaml 5.1.1 (#1714)
+ editor modes
- vim: load merlin when Vim is compiled with +python3/dyn (e.g. MacVim)
- emacs: highlight only first error line by default (#1693, fixes #1663)

merlin 4.12
===========
Tue Sep 26 17:45:42 CEST 2023
Expand Down Expand Up @@ -122,12 +222,12 @@ Fri Feb 24 16:55:42 CEST 2023
xref recognises operators and binding operators at the cursor position;
bad locations are filtered out (#1385, fixes #1410, @mattiase)
+ test suite
- Add a test for incorrect alert defaults (#1559)
- Add multiple tests for locate over ill-typed expressions (#1546)
- Add non-regression tests for other fixes in this release
- Add a test for incorrect alert defaults (#1559)

merlin 4.7.1
==========
============
Thu Dec 13 11:49:42 CEST 2022

+ merlin binary
Expand Down
14 changes: 14 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Code of Conduct

This project has adopted the [OCaml Code of Conduct](https://github.com/ocaml/code-of-conduct/blob/main/CODE_OF_CONDUCT.md).

# Enforcement

This project follows the OCaml Code of Conduct
[enforcement policy](https://github.com/ocaml/code-of-conduct/blob/main/CODE_OF_CONDUCT.md#enforcement).
To report any violations, please contact:

- Sonja Heinze <sonja [at] tarides [dot] com>
- Ulysse Gérard <ulysse [at] tarides [dot] com>
- Pizie Dust <pizie [at] tarides [dot] com>
- Xavier Van de Woestyne <xavier [at] tarides [dot] com>
118 changes: 118 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# Contributing to Merlin

Merlin is a community oriented open-source project and we encourage and value
any kind of contribution. Thanks for taking the time to contribute 🐫 !

## Code of Conduct

Merlin adheres to the OCaml Code of Conduct as stated in the [Code of Conduct
document](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this
code. Please report unacceptable behavior either to local contacts (listed in
[here](CODE_OF_CONDUCT.md)) or to someone listed in the upstream [OCaml Code of
Conduct](CODE_OF_CONDUCT.md).

## Documentation

Merlin (partial and fragmented) documentation can be found in the following
places:
- Installation instructions and editor setup can be found in the
[README.md](README.md) and the [Github Pages](https://ocaml.github.io/merlin/)
- Various topics related to editor support and configuration can be found in the
[wiki](https://github.com/ocaml/merlin/wiki).
- The Merlin protocol is described in [this
document](https://github.com/ocaml/merlin/blob/master/doc/dev/PROTOCOL.md).

Contributions to the documentation are welcome!

## Question, bug reports and feature requests

We rely on [Github's issue tracker](https://github.com/ocaml/merlin/issues) for
support questions, feature requests and bug reports.

When reporting an issue, please include a precise reproduction in the bug report
when that's possible, as it is a very useful tool to investigate. You should
also check that you are using the latest version of Merlin and that a similar
issue has not already been submitted.

## Code contributions

### Styleguides

As of today, Merlin's codebase does not use a code formatter. When contributing
code to an existing module, one should adopt the style of the surrounding code.
Please keep lines under 80 characters.

We plan to move the codebase to ocamlformat in a near future.

Changes unrelated to the issue addressed by a PR should be made in a separate
PR. Additionally, formatting changes in parts of the code not concerned by a
specific PR should be proposed in another PR.

Ideally, any opened issue should be accompanied by a test with a reproduction.
When working on a fix for an issue, the first commit should contain the test
showing the issue. Following commits should fix the issue and update the test
result accordingly.

### Menhir version

Merlin promotes the generated Menhir parser in its sources. This is done to
avoid depending on Menhir when installing Merlin. However this also means that
unnecessary diff will appear when the parser gets re-generated by a different
version of Menhir. To remove this diff please use version `20201216`:
```bash
$ opam pin menhir 20201216
```
The generated parser file should only be commited if there is an actual change
in the grammar.

### Repository organization

There is a partial overview over the repo organization with file-granularity at
[ARCHITECTURE.md](https://github.com/ocaml/merlin/blob/master/doc/dev/ARCHITECTURE.md).
Here is a more high-level overview.

#### `/src/ocaml`
Vendored OCaml typer. Also include Merlin's incremental parser and other
utilites. Changes to these modules should be kept minimal as these patches need
to be reapplied for each new version of the compiler.

#### `/src/kernel`
The backbone of merlin. Contains configuration utilities and pipeline
management. The pipeline describes the compilation workflow: parsing, ppxing and
typing.

#### `/src/frontend/query_protocol.ml`
The type description of Merlin's protocol as documented in
[PROTOCOL.md](https://github.com/ocaml/merlin/blob/master/doc/dev/PROTOCOL.md)

#### `/src/frontend/query_commands.ml`
This file contains the dispatcher: a large pattern matching that answers
Merlin's queries. Most of the time answering a query begins with getting the
Typedtree from the pipeline and calling the correct analysis functions.

#### `/src/analysis`
Contains most of Merlin logic required to answer the queries.

#### `/src/dot-protocol`
The configuration protocol that configuration servers such as
`dot-merlin-reader` or `dune ocaml-merlin` should implement.

#### `/src/dot-merlin-reader`
The historical configuration server of Merlin. It reads `.merlin` configuration
files whose syntax is [documented in the
wiki](https://github.com/ocaml/merlin/wiki/Project-configuration).

#### `/src/frontend/ocamlmerlin`
The standard Merlin frontend, composed of a long-running server and a client.
This is the frontend used by the test-suite and standard emacs and vim plugins.
For an alternative frontend, see
[ocaml-lsp-server](https://github.com/ocaml/ocaml-lsp/)

#### `/tests/test-dirs`
Merlin's behavioral test-suite. We rely on Dune's cram test framework.

#### `/emacs`
The emacs editor mode.

#### `/vim`
The vim plugin.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ preprocess:
promote:
dune promote

bench:
bench_disabled:
merl-an benchmark -p /projects/irmin -s 1 --data=merl-an_bench
echo "Top 10 slowest queries:"
jq -s "[ (map(.sample_id |= tostring)) + (map(.sample_id |= tostring)) | group_by(.sample_id)[] | select(length > 1) | add ] | sort_by( .responses[0].timing.clock) | reverse | .[:10]" merl-an_bench/query_responses.json merl-an_bench/commands.json
echo "Benchmark result:"
jq . merl-an_bench/bench.json

.PHONY: all build dev clean test promote bench
bench:
echo ""

.PHONY: all build dev clean test promote bench bench_disabled
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
⚠️ Default branch recently renamed to `main`
=======================
You can update your local clones using the following procedure:
```
git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a
```
Where `origin` is the name of the upstream remote.

----


![merlin completion in vim](https://github.com/ocaml/merlin/wiki/vim_complete.png)

[Merlin](https://ocaml.github.io/merlin/) is an editor service that provides modern IDE features for OCaml.
Expand Down Expand Up @@ -178,8 +192,8 @@ If you're a Merlin user and depend on our public API, we recommend that you cont
Next Steps
==========

To use Merlin with a multi-file project, it is necessary to have a [.merlin](https://github.com/ocaml/merlin/wiki/project-configuration) file
unless your project is built using dune.
To use Merlin with a multi-file project, it is necessary to have a [.merlin](https://github.com/ocaml/merlin/wiki/project-configuration) file,
unless your project is built using Dune.
Note that, in a project using Dune, user-created `.merlin` files will take precedence over the configuration provided by Dune to Merlin.

Read more in the [wiki](https://github.com/ocaml/merlin/wiki) to learn how to make full use of Merlin in your projects.
Expand Down
40 changes: 40 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Release procedure

## Project organization

Merlin maintains multiple branches for multiple versions of the compiler. The current active support branches are:

- `master` with support for OCaml 5.2
- `501` with support for OCaml 5.1
- `414` with support for OCaml 4.14

Development happens on the `master` branch and bug fixes that should be
backported to other supported branches should be added to the appropriate
[project](https://github.com/ocaml/merlin/projects?type=classic).

Major changes were specific to OCaml 5.2 so the subsequent releases have a major
version number at `5` (like `v5.0-502`) while support releases will stay with
the version number `4` (like `v4.15-414` or `v4.15-501`).

## Before the release

- A PR is opened with the updated changelog for each released branch. The
changelog should contain an appropriate timestamp for the release.
- Additionally, for each non-master released version, the PR also contains the
required backports.

## Release

We use `dune-release` to release Merlin.

For each released branch:
- Merge the corresponding PR.
- Run `dune-release tag v4.15-414`.
The tag should always formed in the same way:
```
"v%s-%s" merlin_version ocaml_version
```
For example: `v4.14-414`, `v5.0-502` etc.
- Run `dune-release` and follow the instructions, but say `No` when asked if a PR should be created on opam's repository.
- For multiple releases it is best to group all the releases in a single opam PR. Additionally it is often not necessary to release the `dot-merlin-package`.
- Cherry-pick the commits from every branch created by `dune-release`, make the necessary changes (like removing the `dot-merlin-reader` packages) and open the PR on opam.
35 changes: 1 addition & 34 deletions bench.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1 @@
FROM ocaml/opam:debian-11-ocaml-5.0

WORKDIR /app

RUN sudo apt-get update
RUN sudo apt-get -y install jq
COPY . .
RUN sudo chown -R opam /app
RUN eval $(opam env)

# install merlin
RUN opam install .

# install merl-an
## cache workaround: https://github.com/ocurrent/current-bench/issues/468#issuecomment-1621030354
ADD https://api.github.com/repos/pitag-ha/merl-an/git/refs/heads/main .merl-an-info
RUN opam pin -y merl-an https://github.com/pitag-ha/merl-an.git

RUN eval $(opam env)

# create directory for projects to run benchmarks on
RUN sudo mkdir /projects
RUN sudo chown opam /projects
WORKDIR /projects

# build irmin
RUN git clone https://github.com/mirage/irmin.git
WORKDIR /projects/irmin
RUN git checkout 8da4d16e7cc8beddfc8a824feca325426bae08a9
RUN sudo apt install -y gnuplot-x11 libgmp-dev pkg-config libffi-dev
RUN opam switch import /app/bench/irmin.opam.export --no-checksums
RUN opam exec -- dune build

WORKDIR /app
FROM ocaml/opam:ubuntu-20.04-ocaml-5.2
Loading

0 comments on commit ece8c65

Please sign in to comment.