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

fix: ocamlformat-rpc initialization #1132

Merged
merged 1 commit into from
Jun 11, 2023

Conversation

rgrinberg
Copy link
Member

if [get_process] is alled concurrently, the ivar might be filled twice.

Fixes #1115

Signed-off-by: Rudi Grinberg [email protected]

@rgrinberg rgrinberg added this to the 1.16.0 milestone Jun 10, 2023
@coveralls
Copy link

coveralls commented Jun 10, 2023

Pull Request Test Coverage Report for Build 3842

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 4 of 5 (80.0%) changed or added relevant lines in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.004%) to 17.349%

Changes Missing Coverage Covered Lines Changed/Added Lines %
ocaml-lsp-server/src/ocamlformat_rpc.ml 4 5 80.0%
Files with Coverage Reduction New Missed Lines %
ocaml-lsp-server/src/import.ml 1 35.9%
Totals Coverage Status
Change from base Build 3838: -0.004%
Covered Lines: 4072
Relevant Lines: 23471

💛 - Coveralls

@mariusdkm
Copy link

I'm getting this error when trying to build this PR, using opam reinstall ocaml-lsp-server --working-dir --update-invariant. (after I pinned the git repo locally)
I'm using --update-invariant, because otherwise I will get this error:

  * No agreement on the version of ocaml:
    - (invariant) → ocaml-base-compiler = 5.0.0 → ocaml = 5.0.0
    - ocaml-lsp-server >= 1.15.1-5.0 → ocaml < 4.15
    You can temporarily relax the switch invariant with `--update-invariant'
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫 
[ERROR] The compilation of ocaml-lsp-server.1.15.1-5.0 failed at "dune build -j 7 ocaml-lsp-server.install --release".

#=== ERROR while compiling ocaml-lsp-server.1.15.1-5.0 ========================#
# context     2.1.3 | macos/arm64 | ocaml-base-compiler.4.14.1 | pinned(git+file:///Users/myuser/Downloads/ocaml-lsp#ps/rr/fix__ocamlformat_rpc_initialization#95cb5643)
# path        ~/.opam/5.0.0/.opam-switch/build/ocaml-lsp-server.1.15.1-5.0
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -j 7 ocaml-lsp-server.install --release
# exit-code   1
# env-file    ~/.opam/log/ocaml-lsp-server-71853-4e0fa8.env
# output-file ~/.opam/log/ocaml-lsp-server-71853-4e0fa8.out
### output ###
# [...]
# submodules/lev/lev/vendor/ev.c:5275:14: warning: left operand of comma operator has no effect [-Wunused-value]
#     assert (("libev: loop to be embedded is not embeddable", backend & ev_embeddable_backends ()));
#              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/assert.h:99:25: note: expanded from macro 'assert'
#     (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __ASSERT_FILE_NAME, __LINE__, #e) : (void)0)
#                         ^
# 32 warnings generated.
# (cd _build/default && /Users/myuser/.opam/5.0.0/bin/ocamlopt.opt -w -40 -alert -unstable -g -I ocaml-lsp-server/src/.ocaml_lsp_server.objs/byte -I ocaml-lsp-server/src/.ocaml_lsp_server.objs/native -I /Users/myuser/.opam/5.0.0/lib/chrome-trace -I /Users/myuser/.opam/5.0.0/lib/csexp -I /Users/myuser/.opam/5.0.0/lib/dune-build-info -I /Use[...]
# File "ocaml-lsp-server/src/merlin_config.ml", line 221, characters 2-26:
# 221 |   Merlin_dot_protocol.Make
#         ^^^^^^^^^^^^^^^^^^^^^^^^
# Error: Unbound module Merlin_dot_protocol.Make

@rgrinberg
Copy link
Member Author

I think it's because this repo is using a submodule. I don't know how to make opam pull the submodule as well unfortunately.

@mariusdkm
Copy link

mariusdkm commented Jun 11, 2023

Oh, I didn't notice the submodule. I just ran git submodule update --init --recursive and then I had to pin it again and then everything compiled.
So far the lsp didn't crash anymore.
Thanks!
(now I can finally do my functional programming exercises I'm supposed to be doing in ocaml)

if [get_process] is alled concurrently, the ivar might be filled twice.

Fixes #1115

Signed-off-by: Rudi Grinberg <[email protected]>

<!-- ps-id: d5c77719-29a5-4b46-92e8-c09f6453ba56 -->
@rgrinberg rgrinberg force-pushed the ps/rr/fix__ocamlformat_rpc_initialization branch from 95cb564 to bc1e93a Compare June 11, 2023 16:58
@rgrinberg rgrinberg merged commit 16c2d41 into master Jun 11, 2023
rgrinberg added a commit to rgrinberg/opam-repository that referenced this pull request Jun 18, 2023
CHANGES:

## Fixes

- Disable code lens by default. The support can be re-enabled by explicitly
  setting it in the configuration. (ocaml/ocaml-lsp#1134)

- Fix initilization of `ocamlformat-rpc` in some edge cases when ocamlformat is
  initialized concurrently (ocaml/ocaml-lsp#1132)

- Kill unnecessary `$ dune ocaml-merlin` with SIGTERM rather than SIGKILL
  (ocaml/ocaml-lsp#1124)

- Refactor comment parsing to use `odoc-parser` and `cmarkit` instead of
  `octavius` and `omd` (ocaml/ocaml-lsp#1088)

  This allows users who migrated to omd 2.X to install ocaml-lsp-server in the
  same opam switch.

  We also slightly improved markdown generation support and fixed a couple in
  the generation of inline heading and module types.

- Allow opening documents that were already open. This is a workaround for
  neovim's lsp client (ocaml/ocaml-lsp#1067)

- Disable type annotation for functions (ocaml/ocaml-lsp#1054)

- Respect codeActionLiteralSupport capability (ocaml/ocaml-lsp#1046)

- Fix a document syncing issue when utf-16 is the position encoding (ocaml/ocaml-lsp#1004)

- Disable "Type-annotate" action for code that is already annotated.
  ([ocaml/ocaml-lsp#1037](ocaml/ocaml-lsp#1037)), fixes
  [ocaml/ocaml-lsp#1036](ocaml/ocaml-lsp#1036)

- Fix semantic highlighting of long identifiers when using preprocessors
  ([ocaml/ocaml-lsp#1049](ocaml/ocaml-lsp#1049), fixes
  [ocaml/ocaml-lsp#1034](ocaml/ocaml-lsp#1034))

- Fix the type of DocumentSelector in cram document registration (ocaml/ocaml-lsp#1068)

- Accept the `--clientProcessId` command line argument. (ocaml/ocaml-lsp#1074)

- Accept `--port` as a synonym for `--socket`. (ocaml/ocaml-lsp#1075)

- Fix connecting to dune rpc on Windows. (ocaml/ocaml-lsp#1080)

## Features

- Add "Remove type annotation" code action. (ocaml/ocaml-lsp#1039)

- Support settings through `didChangeConfiguration` notification (ocaml/ocaml-lsp#1103)

- Add "Extract local" and "Extract function" code actions. (ocaml/ocaml-lsp#870)

- Depend directly on `merlin-lib` 4.9 (ocaml/ocaml-lsp#1070)
@rgrinberg rgrinberg deleted the ps/rr/fix__ocamlformat_rpc_initialization branch May 11, 2024 23:22
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.

ocaml-lsp-server crash in Emacs
3 participants