Skip to content

External config readers#1123

Merged
voodoos merged 48 commits intoocaml:masterfrom
voodoos:external-config-rebased
Jun 19, 2020
Merged

External config readers#1123
voodoos merged 48 commits intoocaml:masterfrom
voodoos:external-config-rebased

Conversation

@voodoos
Copy link
Copy Markdown
Collaborator

@voodoos voodoos commented Apr 6, 2020

Twin PR: ocaml/dune#3395

This PR is based on @trefis external-config branch.

This branch adds an external reader for config files to merlin. Merlin communicates with this reader to get configuration information.

This PR implements a simple communication protocol between a config provider and merlin via standard inputs and outputs.

Processed config files are encoded as S-expressions, for exemple:

(("S" "/.../..../") ("B" "/.../.../") ...)

This S-expression is then sent as a canonical s-expression by the config provider to merlin.

This choice of protocol should allow an easy communication with a future "dune/merlin communicator".

Todo

  • Improve error handling

@voodoos
Copy link
Copy Markdown
Collaborator Author

voodoos commented May 12, 2020

@trefis , @let-def : This PR should be ready for review.

If you want to test it you need to pin the corresponding dune PR:
https://github.com/voodoos/dune.git#merlin-abs-paths

From a user perspective this new version of Merlin does not require the latest dune as .merlin files will be loaded as usual (but with the new dot-merlin-reader) when they are present.
However the test suite will fail without the new dune PR because most of the tests do not have .merlin files and the closest config file in the tree is a dune file. Thus merlin tries to start the new dune configuration server and reports a failure.

@voodoos voodoos force-pushed the external-config-rebased branch from 9c0ed79 to 1f20e5e Compare June 4, 2020 10:01
@voodoos voodoos force-pushed the external-config-rebased branch from b94901a to eef4a79 Compare June 17, 2020 09:55
@voodoos voodoos merged commit 7a45a1f into ocaml:master Jun 19, 2020
rgrinberg added a commit to rgrinberg/merlin that referenced this pull request Jul 5, 2020
EduardoRFS pushed a commit to EduardoRFS/merlin that referenced this pull request Aug 8, 2020
* WIP: do not link with findlib

* WIP: a separate executable that reads and preprocess .merlin files

* WIP: start simplifying mconfig_dot

* WIP: merlin call external executable

* WIP: don't forget to flush…

* so there's that

* activate logger for Mconfig_dot

* some logging

* tests: dot-merlin-reader in PATH

* add a way for the producer of the config to notify of errors

Add a test for that new functionality.

* propagate config failures to error command

* fix dot-merlin-reader dune package field

* Update makefile

* travis: dot-merlin-reader as extra dep

* tests are limited to merlin package

* dot-merlin-reader.opam: relax ocaml constraint

* gitignore

* New module implementing the CSEXP-based comm. protocol

* Use the protocol to interact with the `dot_merlin_reader`

* Cleaner input reader

* Add dune configurator option

* WIP: Make old-protocol work

* Remove ref to config.findlib after rebase

* Update opam file

* Tests update after rebase

* Add fixme comment

* Remove obsolete todo

* Add non-regression test for check-config

* Restore `check-configuration` behavior

* Restore old-protocol "project get" behavior

* Update csexp dependency

* 4.02 compat

* Add a "config" error_source

* Make protocol error config failures

* Messages are csexp, no need for newlines.

* Debug zombie process

* set close on exec on shared sockets to prevent leaking fds into spawned processes

* Edit opam file

* Remove findlib occurence

* SHAME, SHAME, SHAME

* Base dune detection on `dune-project` files

* Fix tests

* Update Opam Files

* Correct failing test

* Remove debug comment

* Remove outdated comments from dot-merlin-reader

* Start `dune ocmal-merlin` with `--no-print-directory`

* Display findlib init error when using packages

Co-authored-by: Thomas Refis <thomas.refis@gmail.com>
Co-authored-by: Frédéric Bour <fred@tarides.com>
EduardoRFS pushed a commit to EduardoRFS/merlin that referenced this pull request Aug 8, 2020
EduardoRFS pushed a commit to EduardoRFS/merlin that referenced this pull request Aug 8, 2020
* WIP: do not link with findlib

* WIP: a separate executable that reads and preprocess .merlin files

* WIP: start simplifying mconfig_dot

* WIP: merlin call external executable

* WIP: don't forget to flush…

* so there's that

* activate logger for Mconfig_dot

* some logging

* tests: dot-merlin-reader in PATH

* add a way for the producer of the config to notify of errors

Add a test for that new functionality.

* propagate config failures to error command

* fix dot-merlin-reader dune package field

* Update makefile

* travis: dot-merlin-reader as extra dep

* tests are limited to merlin package

* dot-merlin-reader.opam: relax ocaml constraint

* gitignore

* New module implementing the CSEXP-based comm. protocol

* Use the protocol to interact with the `dot_merlin_reader`

* Cleaner input reader

* Add dune configurator option

* WIP: Make old-protocol work

* Remove ref to config.findlib after rebase

* Update opam file

* Tests update after rebase

* Add fixme comment

* Remove obsolete todo

* Add non-regression test for check-config

* Restore `check-configuration` behavior

* Restore old-protocol "project get" behavior

* Update csexp dependency

* 4.02 compat

* Add a "config" error_source

* Make protocol error config failures

* Messages are csexp, no need for newlines.

* Debug zombie process

* set close on exec on shared sockets to prevent leaking fds into spawned processes

* Edit opam file

* Remove findlib occurence

* SHAME, SHAME, SHAME

* Base dune detection on `dune-project` files

* Fix tests

* Update Opam Files

* Correct failing test

* Remove debug comment

* Remove outdated comments from dot-merlin-reader

* Start `dune ocmal-merlin` with `--no-print-directory`

* Display findlib init error when using packages

Co-authored-by: Thomas Refis <thomas.refis@gmail.com>
Co-authored-by: Frédéric Bour <fred@tarides.com>
EduardoRFS pushed a commit to EduardoRFS/merlin that referenced this pull request Aug 8, 2020
rgrinberg added a commit to rgrinberg/merlin that referenced this pull request Aug 27, 2020
rgrinberg added a commit to rgrinberg/merlin that referenced this pull request Aug 28, 2020
rgrinberg added a commit to rgrinberg/merlin that referenced this pull request Sep 3, 2020
voodoos added a commit to voodoos/opam-repository that referenced this pull request Sep 16, 2020
CHANGES:

Wed Sep 16 15:00:42 CEST 2020

  + merlin binary
    - fix completion of pattern matchings with exception patterns (ocaml/merlin#1169)
    - delegate configuration reading to external programs via a simple protocol
    and create a new package `dot-merlin-reader` with a binary that reads
    `.merlin` files. (ocaml/merlin#1123, ocaml/merlin#1152)
voodoos added a commit to voodoos/merlin that referenced this pull request Nov 5, 2020
voodoos added a commit to voodoos/merlin that referenced this pull request Nov 5, 2020
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.

3 participants