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

LSP Issues #7

Open
benbellick opened this issue Sep 13, 2024 · 7 comments
Open

LSP Issues #7

benbellick opened this issue Sep 13, 2024 · 7 comments

Comments

@benbellick
Copy link

Hey! Thanks for the awesome work :)

One reason I'm interested in this project is because LSP support for ReasonML is not working as expected on react components. So I tried cloning this template and fired up my lsp, which is Emacs' Eglot (using ocamllsp). And I encountered the following error immediately on startup:

[jsonrpc] e[12:10:55.998] --> initialize[1] {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"processId":75247,"clientInfo":{"name":"Eglot","version":"1.16"},"rootPath":"/Users/benjaminbellick/work/melange-mlx-template/","rootUri":"file:///Users/benjaminbellick/work/melange-mlx-template","initializationOptions":{},"capabilities":{"workspace":{"applyEdit":true,"executeCommand":{"dynamicRegistration":false},"workspaceEdit":{"documentChanges":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":false},"configuration":true,"workspaceFolders":true},"textDocument":{"synchronization":{"dynamicRegistration":false,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":false,"completionItem":{"snippetSupport":true,"deprecatedSupport":true,"resolveSupport":{"properties":["documentation","details","additionalTextEdits"]},"tagSupport":{"valueSet":[1]}},"contextSupport":true},"hover":{"dynamicRegistration":false,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":false,"signatureInformation":{"parameterInformation":{"labelOffsetSupport":true},"documentationFormat":["markdown","plaintext"],"activeParameterSupport":true}},"references":{"dynamicRegistration":false},"definition":{"dynamicRegistration":false,"linkSupport":true},"declaration":{"dynamicRegistration":false,"linkSupport":true},"implementation":{"dynamicRegistration":false,"linkSupport":true},"typeDefinition":{"dynamicRegistration":false,"linkSupport":true},"documentSymbol":{"dynamicRegistration":false,"hierarchicalDocumentSymbolSupport":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},"documentHighlight":{"dynamicRegistration":false},"codeAction":{"dynamicRegistration":false,"resolveSupport":{"properties":["edit","command"]},"dataSupport":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"isPreferredSupport":true},"formatting":{"dynamicRegistration":false},"rangeFormatting":{"dynamicRegistration":false},"rename":{"dynamicRegistration":false},"inlayHint":{"dynamicRegistration":false},"publishDiagnostics":{"relatedInformation":false,"codeDescriptionSupport":false,"tagSupport":{"valueSet":[1,2]}}},"window":{"showDocument":{"support":true},"workDoneProgress":true},"general":{"positionEncodings":["utf-32","utf-8","utf-16"]},"experimental":{}},"workspaceFolders":[{"uri":"file:///Users/benjaminbellick/work/melange-mlx-template","name":"~/work/melange-mlx-template/"}]}}
[jsonrpc] e[12:10:56.042] <-- initialize[1] {"id":1,"jsonrpc":"2.0","result":{"capabilities":{"codeActionProvider":{"codeActionKinds":["quickfix","refactor.inline","construct","destruct (enumerate cases)","inferred_intf","put module name in identifiers","remove module name from identifiers","remove type annotation","type-annotate"]},"codeLensProvider":{"resolveProvider":false},"completionProvider":{"resolveProvider":true,"triggerCharacters":[".","#"]},"declarationProvider":true,"definitionProvider":true,"documentFormattingProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"executeCommandProvider":{"commands":["ocamllsp/view-metrics","ocamllsp/open-related-source","ocamllsp/show-document-text","ocamllsp/show-merlin-config","dune/promote"]},"experimental":{"ocamllsp":{"interfaceSpecificLangId":true,"handleSwitchImplIntf":true,"handleInferIntf":true,"handleTypedHoles":true,"handleWrappingAstNode":true,"diagnostic_promotions":true,"handleHoverExtended":true,"handleMerlinCallCompatible":true,"handleTypeEnclosing":true,"handleGetDocumentation":true}},"foldingRangeProvider":true,"hoverProvider":true,"inlayHintProvider":true,"positionEncoding":"utf-8","referencesProvider":true,"renameProvider":{"prepareProvider":true},"selectionRangeProvider":true,"semanticTokensProvider":{"full":{"delta":true},"legend":{"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"],"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator","decorator"]}},"signatureHelpProvider":{"triggerCharacters":[" ","~","?",":","("]},"textDocumentSync":{"change":2,"openClose":true,"save":{"includeText":false},"willSave":false,"willSaveWaitUntil":false},"typeDefinitionProvider":true,"workspace":{"workspaceFolders":{"changeNotifications":true,"supported":true}},"workspaceSymbolProvider":true},"serverInfo":{"name":"ocamllsp","version":"1.19.0"}}}
[jsonrpc] e[12:10:56.042] --> initialized {"jsonrpc":"2.0","method":"initialized","params":{}}
[jsonrpc] e[12:10:56.045] --> textDocument/didOpen {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///Users/benjaminbellick/work/melange-mlx-template/src/ReactApp.mlx","version":0,"languageId":"ocaml","text":"module App = struct\n  let[@react.component] make () =\n    [\"Hello \" ^ World.name ^ \"!\"; \"This is React!!\"]\n    |> List.map (fun greeting -> <h1 key=greeting> (React.string greeting) </h1>)\n    |> Array.of_list\n    |> React.array\nend\n\nlet () =\n  match ReactDOM.querySelector \"#root\" with\n  | Some element ->\n    let root = ReactDOM.Client.createRoot element in\n    ReactDOM.Client.render root <App />\n  | None ->\n    Js.Console.error \"Failed to start React: couldn't find the #root element\"\n"}}}
[jsonrpc] e[12:10:56.048] --> textDocument/didOpen {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///Users/benjaminbellick/work/melange-mlx-template/src/Hello.ml","version":0,"languageId":"ocaml","text":"let () = Js.log (\"Hello \" ^ World.name ^ \"!!\")\n"}}}
[jsonrpc] e[12:10:56.049] --> workspace/didChangeConfiguration {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{}}}
[stderr]  detached: /-----------------------------------------------------------------------
[stderr]  | Internal error: Uncaught exception.
[stderr]  | Unix.Unix_error(Unix.ENOENT, "create_process", "ocamlmerlin-mlx")
[stderr]  | Raised by primitive operation at Unix.create_process_gen.(fun) in file "unix.ml", line 922, characters 15-68
[stderr]  | Called from Stdlib__Fun.protect in file "fun.ml", line 34, characters 8-15
[stderr]  | Re-raised at Stdlib__Fun.protect in file "fun.ml", line 39, characters 6-52
[stderr]  | Called from Unix.create_process in file "unix.ml" (inlined), line 925, characters 2-66
[stderr]  | Called from Merlin_extend__Extend_driver.run in file "src/extend/extend_driver.ml", lines 26-28, characters 4-32
[stderr]  | Called from Merlin_kernel__Mreader_extend.start in file "src/kernel/mreader_extend.ml", line 52, characters 15-52
[stderr]  | Called from CamlinternalLazy.do_force_block in file "camlinternalLazy.ml", line 49, characters 17-27
[stderr]  | Re-raised at CamlinternalLazy.do_force_block in file "camlinternalLazy.ml", line 56, characters 4-11
[stderr]  | Called from CamlinternalLazy.force_lazy_block in file "camlinternalLazy.ml" (inlined), line 78, characters 27-67
[stderr]  | Called from Merlin_kernel__Mreader.try_with_reader in file "src/kernel/mreader.ml", line 107, characters 6-17
[stderr]  | Called from Merlin_kernel__Mreader.parse in file "src/kernel/mreader.ml", lines 166-167, characters 8-48
[stderr]  | Called from Merlin_kernel__Mpipeline.Reader_phase.f.(fun) in file "src/kernel/mpipeline.ml", line 156, characters 17-60
[stderr]  | Called from Merlin_kernel__Phase_cache.With_cache.apply in file "src/kernel/phase_cache.ml", line 33, characters 21-34
[stderr]  | Called from Merlin_kernel__Mpipeline.process in file "src/kernel/mpipeline.ml", lines 278-279, characters 12-48
[stderr]  | Called from CamlinternalLazy.do_force_block in file "camlinternalLazy.ml", line 49, characters 17-27
[stderr]  | Re-raised at CamlinternalLazy.do_force_block in file "camlinternalLazy.ml", line 56, characters 4-11
[stderr]  | Called from CamlinternalLazy.force_lazy_block in file "camlinternalLazy.ml" (inlined), line 78, characters 27-67
[stderr]  | Called from Merlin_kernel__Mpipeline.timed_lazy in file "src/kernel/mpipeline.ml", line 17, characters 10-22
[stderr]  | Re-raised at Merlin_kernel__Mpipeline.timed_lazy in file "src/kernel/mpipeline.ml", line 19, characters 34-49
[stderr]  | Called from CamlinternalLazy.do_force_block in file "camlinternalLazy.ml", line 49, characters 17-27
[stderr]  | Re-raised at CamlinternalLazy.do_force_block in file "camlinternalLazy.ml", line 56, characters 4-11
[stderr]  | Called from CamlinternalLazy.force_lazy_block in file "camlinternalLazy.ml" (inlined), line 78, characters 27-67
[stderr]  | Called from Merlin_kernel__Mpipeline.process in file "src/kernel/mpipeline.ml", lines 288-292, characters 10-12
[stderr]  | Called from CamlinternalLazy.do_force_block in file "camlinternalLazy.ml", line 49, characters 17-27
[stderr]  | Re-raised at CamlinternalLazy.do_force_block in file "camlinternalLazy.ml", line 56, characters 4-11
[stderr]  | Called from CamlinternalLazy.force_lazy_block in file "camlinternalLazy.ml" (inlined), line 78, characters 27-67
[stderr]  | Called from Merlin_kernel__Mpipeline.timed_lazy in file "src/kernel/mpipeline.ml", line 17, characters 10-22
[stderr]  | Re-raised at Merlin_kernel__Mpipeline.timed_lazy in file "src/kernel/mpipeline.ml", line 19, characters 34-49
[stderr]  | Called from CamlinternalLazy.do_force_block in file "camlinternalLazy.ml", line 49, characters 17-27
[stderr]  | Re-raised at CamlinternalLazy.do_force_block in file "camlinternalLazy.ml", line 56, characters 4-11
[stderr]  | Called from CamlinternalLazy.force_lazy_block in file "camlinternalLazy.ml" (inlined), line 78, characters 27-67
[stderr]  | Called from Merlin_kernel__Mpipeline.process in file "src/kernel/mpipeline.ml", line 312, characters 10-44
[stderr]  | Called from CamlinternalLazy.do_force_block in file "camlinternalLazy.ml", line 49, characters 17-27
[stderr]  | Re-raised at CamlinternalLazy.do_force_block in file "camlinternalLazy.ml", line 56, characters 4-11
[stderr]  | Called from CamlinternalLazy.force_lazy_block in file "camlinternalLazy.ml" (inlined), line 78, characters 27-67
[stderr]  | Called from Merlin_kernel__Mpipeline.timed_lazy in file "src/kernel/mpipeline.ml", line 17, characters 10-22
[stderr]  | Called from Merlin_kernel__Mpipeline.timed_lazy in file "src/kernel/mpipeline.ml", line 17, characters 10-22
[jsonrpc] e[12:10:56.375] <-- textDocument/publishDiagnostics {"params":{"diagnostics":[],"uri":"file:///Users/benjaminbellick/work/melange-mlx-template/src/Hello.ml"},"method":"textDocument/publishDiagnostics","jsonrpc":"2.0"}
[stderr]  | Re-raised at Merlin_kernel__Mpipeline.timed_lazy in file "src/kernel/mpipeline.ml", line 19, characters 34-49
[stderr]  | Called from CamlinternalLazy.do_force_block in file "camlinternalLazy.ml", line 49, characters 17-27
[stderr]  | Re-raised at CamlinternalLazy.do_force_block in file "camlinternalLazy.ml", line 56, characters 4-11
[stderr]  | Called from Merlin_kernel__Mpipeline.typer_result in file "src/kernel/mpipeline.ml" (inlined), line 141, characters 21-30
[stderr]  | Called from Query_commands.dispatch in file "src/frontend/query_commands.ml", line 671, characters 16-47
[stderr]  | Called from Ocaml_lsp_server__Diagnostics.merlin_diagnostics.(fun) in file "ocaml-lsp-server/src/diagnostics.ml", line 298, characters 12-52
[stderr]  | Called from Merlin_utils__Std.let_ref in file "src/utils/std.ml", line 695, characters 8-12
[stderr]  | Re-raised at Merlin_utils__Std.let_ref in file "src/utils/std.ml", line 697, characters 30-39
[stderr]  | Called from Merlin_utils__Misc.try_finally in file "src/utils/misc.ml", line 45, characters 8-15
[stderr]  | Re-raised at Merlin_utils__Misc.try_finally in file "src/utils/misc.ml", line 62, characters 10-24
[stderr]  | Called from Stdlib__Fun.protect in file "fun.ml", line 34, characters 8-15
[stderr]  | Re-raised at Stdlib__Fun.protect in file "fun.ml", line 39, characters 6-52
[stderr]  | Called from Merlin_kernel__Mocaml.with_state in file "src/kernel/mocaml.ml", line 18, characters 8-38
[stderr]  | Re-raised at Merlin_kernel__Mocaml.with_state in file "src/kernel/mocaml.ml", line 20, characters 42-53
[stderr]  | Called from Ocaml_lsp_server__Document.Single_pipeline.use_with_config.(fun) in file "ocaml-lsp-server/src/document.ml", line 161, characters 20-75
[stderr]  | Called from Stdune__Exn_with_backtrace.try_with in file "otherlibs/stdune/src/exn_with_backtrace.ml", line 9, characters 8-12
[stderr]  | Re-raised at Stdune__Exn.raise_with_backtrace in file "otherlibs/stdune/src/exn.ml" (inlined), line 38, characters 27-56
[stderr]  | Called from Stdune__Exn_with_backtrace.reraise in file "otherlibs/stdune/src/exn_with_backtrace.ml", line 20, characters 33-71
[stderr]  | Called from Fiber__Core.O.(>>|).(fun) in file "fiber/src/core.ml", line 250, characters 36-41
[stderr]  | Called from Fiber__Scheduler.exec in file "fiber/src/scheduler.ml", line 73, characters 8-11
[stderr]  \-----------------------------------------------------------------------
[stderr]  
[jsonrpc] e[12:10:56.567] --> textDocument/hover[2] {"jsonrpc":"2.0","id":2,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///Users/benjaminbellick/work/melange-mlx-template/src/ReactApp.mlx"},"position":{"line":9,"character":8}}}
[jsonrpc] e[12:10:56.569] --> textDocument/documentHighlight[3] {"jsonrpc":"2.0","id":3,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///Users/benjaminbellick/work/melange-mlx-template/src/ReactApp.mlx"},"position":{"line":9,"character":8}}}
[jsonrpc] e[12:10:56.570] --> textDocument/signatureHelp[4] {"jsonrpc":"2.0","id":4,"method":"textDocument/signatureHelp","params":{"textDocument":{"uri":"file:///Users/benjaminbellick/work/melange-mlx-template/src/ReactApp.mlx"},"position":{"line":9,"character":8}}}
[jsonrpc] e[12:10:56.597] <-- textDocument/hover[2] {"id":2,"jsonrpc":"2.0","error":{"data":{"exn":"Unix.Unix_error(Unix.ENOENT, \"create_process\", \"ocamlmerlin-mlx\")","backtrace":"Raised by primitive operation at Unix.create_process_gen.(fun) in file \"unix.ml\", line 922, characters 15-68\nCalled from Stdlib__Fun.protect in file \"fun.ml\", line 34, characters 8-15\nRe-raised at Stdlib__Fun.protect in file \"fun.ml\", line 39, characters 6-52\nCalled from Unix.create_process in file \"unix.ml\" (inlined), line 925, characters 2-66\nCalled from Merlin_extend__Extend_driver.run in file \"src/extend/extend_driver.ml\", lines 26-28, characters 4-32\nCalled from Merlin_kernel__Mreader_extend.start in file \"src/kernel/mreader_extend.ml\", line 52, characters 15-52\nCalled from CamlinternalLazy.do_force_block in file \"camlinternalLazy.ml\", line 49, characters 17-27\nRe-raised at CamlinternalLazy.do_force_block in file \"camlinternalLazy.ml\", line 56, characters 4-11\nCalled from CamlinternalLazy.force_lazy_block in file \"camlinternalLazy.ml\" (inlined), line 78, characters 27-67\nCalled from Merlin_kernel__Mreader.try_with_reader in file \"src/kernel/mreader.ml\", line 107, characters 6-17\nCalled from Merlin_kernel__Mreader.parse in file \"src/kernel/mreader.ml\", lines 166-167, characters 8-48\nCalled from Merlin_kernel__Mpipeline.Reader_phase.f.(fun) in file \"src/kernel/mpipeline.ml\", line 156, characters 17-60\nCalled from Merlin_kernel__Phase_cache.With_cache.apply in file \"src/kernel/phase_cache.ml\", line 33, characters 21-34\nCalled from Merlin_kernel__Mpipeline.process in file \"src/kernel/mpipeline.ml\", lines 278-279, characters 12-48\nCalled from CamlinternalLazy.do_force_block in file \"camlinternalLazy.ml\", line 49, characters 17-27\nRe-raised at CamlinternalLazy.do_force_block in file \"camlinternalLazy.ml\", line 56, characters 4-11\nCalled from CamlinternalLazy.force_lazy_block in file \"camlinternalLazy.ml\" (inlined), line 78, characters 27-67\nCalled from Merlin_kernel__Mpipeline.timed_lazy in file \"src/kernel/mpipeline.ml\", line 17, characters 10-22\nRe-raised at Merlin_kernel__Mpipeline.timed_lazy in file \"src/kernel/mpipeline.ml\", line 19, characters 34-49\nCalled from CamlinternalLazy.do_force_block in file \"camlinternalLazy.ml\", line 49, characters 17-27\nRe-raised at CamlinternalLazy.do_force_block in file \"camlinternalLazy.ml\", line 56, characters 4-11\nCalled from Merlin_kernel__Mpipeline.reader_parsetree in file \"src/kernel/mpipeline.ml\" (inlined), line 127, characters 25-35\nCalled from Ocaml_lsp_server__Hover_req.handle.(fun) in file \"ocaml-lsp-server/src/hover_req.ml\", line 440, characters 27-62\nCalled from Merlin_utils__Std.let_ref in file \"src/utils/std.ml\", line 695, characters 8-12\nRe-raised at Merlin_utils__Std.let_ref in file \"src/utils/std.ml\", line 697, characters 30-39\nCalled from Merlin_utils__Misc.try_finally in file \"src/utils/misc.ml\", line 45, characters 8-15\nRe-raised at Merlin_utils__Misc.try_finally in file \"src/utils/misc.ml\", line 62, characters 10-24\nCalled from Stdlib__Fun.protect in file \"fun.ml\", line 34, characters 8-15\nRe-raised at Stdlib__Fun.protect in file \"fun.ml\", line 39, characters 6-52\nCalled from Merlin_kernel__Mocaml.with_state in file \"src/kernel/mocaml.ml\", line 18, characters 8-38\nRe-raised at Merlin_kernel__Mocaml.with_state in file \"src/kernel/mocaml.ml\", line 20, characters 42-53\nCalled from Ocaml_lsp_server__Document.Single_pipeline.use_with_config.(fun) in file \"ocaml-lsp-server/src/document.ml\", line 161, characters 20-75\nCalled from Stdune__Exn_with_backtrace.try_with in file \"otherlibs/stdune/src/exn_with_backtrace.ml\", line 9, characters 8-12\nRe-raised at Stdune__Exn.raise_with_backtrace in file \"otherlibs/stdune/src/exn.ml\" (inlined), line 38, characters 27-56\nCalled from Stdune__Exn_with_backtrace.reraise in file \"otherlibs/stdune/src/exn_with_backtrace.ml\", line 20, characters 33-71\nCalled from Fiber__Core.O.(>>|).(fun) in file \"fiber/src/core.ml\", line 250, characters 36-41\nCalled from Fiber__Scheduler.exec in file \"fiber/src/scheduler.ml\", line 73, characters 8-11\nRe-raised at Stdune__Exn.raise_with_backtrace in file \"otherlibs/stdune/src/exn.ml\" (inlined), line 38, characters 27-56\nCalled from Stdune__Exn_with_backtrace.reraise in file \"otherlibs/stdune/src/exn_with_backtrace.ml\", line 20, characters 33-71\nCalled from Fiber__Scheduler.exec in file \"fiber/src/scheduler.ml\", line 73, characters 8-11\n"},"code":-32603,"message":"uncaught exception"}}
[jsonrpc] i[12:10:56.598] [2] error -32603 ignored: uncaught exception ignored
[jsonrpc] e[12:10:56.610] <-- textDocument/documentHighlight[3] {"id":3,"jsonrpc":"2.0","error":{"data":{"exn":"Unix.Unix_error(Unix.ENOENT, \"create_process\", \"ocamlmerlin-mlx\")","backtrace":"Raised by primitive operation at Unix.create_process_gen.(fun) in file \"unix.ml\", line 922, characters 15-68\nCalled from Stdlib__Fun.protect in file \"fun.ml\", line 34, characters 8-15\nRe-raised at Stdlib__Fun.protect in file \"fun.ml\", line 39, characters 6-52\nCalled from Unix.create_process in file \"unix.ml\" (inlined), line 925, characters 2-66\nCalled from Merlin_extend__Extend_driver.run in file \"src/extend/extend_driver.ml\", lines 26-28, characters 4-32\nCalled from Merlin_kernel__Mreader_extend.start in file \"src/kernel/mreader_extend.ml\", line 52, characters 15-52\nCalled from CamlinternalLazy.do_force_block in file \"camlinternalLazy.ml\", line 49, characters 17-27\nRe-raised at CamlinternalLazy.do_force_block in file \"camlinternalLazy.ml\", line 56, characters 4-11\nCalled from CamlinternalLazy.force_lazy_block in file \"camlinternalLazy.ml\" (inlined), line 78, characters 27-67\nCalled from Merlin_kernel__Mreader.try_with_reader in file \"src/kernel/mreader.ml\", line 107, characters 6-17\nCalled from Merlin_kernel__Mreader.parse in file \"src/kernel/mreader.ml\", lines 166-167, characters 8-48\nCalled from Merlin_kernel__Mpipeline.Reader_phase.f.(fun) in file \"src/kernel/mpipeline.ml\", line 156, characters 17-60\nCalled from Merlin_kernel__Phase_cache.With_cache.apply in file \"src/kernel/phase_cache.ml\", line 33, characters 21-34\nCalled from Merlin_kernel__Mpipeline.process in file \"src/kernel/mpipeline.ml\", lines 278-279, characters 12-48\nCalled from CamlinternalLazy.do_force_block in file \"camlinternalLazy.ml\", line 49, characters 17-27\nRe-raised at CamlinternalLazy.do_force_block in file \"camlinternalLazy.ml\", line 56, characters 4-11\nCalled from CamlinternalLazy.force_lazy_block in file \"camlinternalLazy.ml\" (inlined), line 78, characters 27-67\nCalled from Merlin_kernel__Mpipeline.timed_lazy in file \"src/kernel/mpipeline.ml\", line 17, characters 10-22\nRe-raised at Merlin_kernel__Mpipeline.timed_lazy in file \"src/kernel/mpipeline.ml\", line 19, characters 34-49\nCalled from CamlinternalLazy.do_force_block in file \"camlinternalLazy.ml\", line 49, characters 17-27\nRe-raised at CamlinternalLazy.do_force_block in file \"camlinternalLazy.ml\", line 56, characters 4-11\nCalled from CamlinternalLazy.force_lazy_block in file \"camlinternalLazy.ml\" (inlined), line 78, characters 27-67\nCalled from Merlin_kernel__Mpipeline.process in file \"src/kernel/mpipeline.ml\", lines 288-292, characters 10-12\nCalled from CamlinternalLazy.do_force_block in file \"camlinternalLazy.ml\", line 49, characters 17-27\nRe-raised at CamlinternalLazy.do_force_block in file \"camlinternalLazy.ml\", line 56, characters 4-11\nCalled from CamlinternalLazy.force_lazy_block in file \"camlinternalLazy.ml\" (inlined), line 78, characters 27-67\nCalled from Merlin_kernel__Mpipeline.timed_lazy in file \"src/kernel/mpipeline.ml\", line 17, characters 10-22\nRe-raised at Merlin_kernel__Mpipeline.timed_lazy in file \"src/kernel/mpipeline.ml\", line 19, characters 34-49\nCalled from CamlinternalLazy.do_force_block in file \"camlinternalLazy.ml\", line 49, characters 17-27\nRe-raised at CamlinternalLazy.do_force_block in file \"camlinternalLazy.ml\", line 56, characters 4-11\nCalled from Merlin_kernel__Mpipeline.final_config in file \"src/kernel/mpipeline.ml\" (inlined), line 139, characters 22-29\nCalled from Query_commands.dispatch in file \"src/frontend/query_commands.ml\", line 799, characters 17-48\nCalled from Merlin_utils__Std.let_ref in file \"src/utils/std.ml\", line 695, characters 8-12\nRe-raised at Merlin_utils__Std.let_ref in file \"src/utils/std.ml\", line 697, characters 30-39\nCalled from Merlin_utils__Misc.try_finally in file \"src/utils/misc.ml\", line 45, characters 8-15\nRe-raised at Merlin_utils__Misc.try_finally in file \"src/utils/misc.ml\", line 62, characters 10-24\nCalled from Stdlib__Fun.protect in file \"fun.ml\", line 34, characters 8-15\nRe-raised at Stdlib__Fun.protect in file \"fun.ml\", line 39, characters 6-52\nCalled from Merlin_kernel__Mocaml.with_state in file \"src/kernel/mocaml.ml\", line 18, characters 8-38\nRe-raised at Merlin_kernel__Mocaml.with_state in file \"src/kernel/mocaml.ml\", line 20, characters 42-53\nCalled from Ocaml_lsp_server__Document.Single_pipeline.use_with_config.(fun) in file \"ocaml-lsp-server/src/document.ml\", line 161, characters 20-75\nCalled from Stdune__Exn_with_backtrace.try_with in file \"otherlibs/stdune/src/exn_with_backtrace.ml\", line 9, characters 8-12\nRe-raised at Stdune__Exn.raise_with_backtrace in file \"otherlibs/stdune/src/exn.ml\" (inlined), line 38, characters 27-56\nCalled from Stdune__Exn_with_backtrace.reraise in file \"otherlibs/stdune/src/exn_with_backtrace.ml\", line 20, characters 33-71\nCalled from Fiber__Core.O.(>>|).(fun) in file \"fiber/src/core.ml\", line 250, characters 36-41\nCalled from Fiber__Scheduler.exec in file \"fiber/src/scheduler.ml\", line 73, characters 8-11\nRe-raised at Stdune__Exn.raise_with_backtrace in file \"otherlibs/stdune/src/exn.ml\" (inlined), line 38, characters 27-56\nCalled from Stdune__Exn_with_backtrace.reraise in file \"otherlibs/stdune/src/exn_with_backtrace.ml\", line 20, characters 33-71\nCalled from Fiber__Scheduler.exec in file \"fiber/src/scheduler.ml\", line 73, characters 8-11\n"},"code":-32603,"message":"uncaught exception"}}
[jsonrpc] i[12:10:56.610] [3] error -32603 ignored: uncaught exception ignored
[jsonrpc] e[12:10:56.620] <-- textDocument/signatureHelp[4] {"id":4,"jsonrpc":"2.0","error":{"data":{"exn":"Unix.Unix_error(Unix.ENOENT, \"create_process\", \"ocamlmerlin-mlx\")","backtrace":"Raised by primitive operation at Unix.create_process_gen.(fun) in file \"unix.ml\", line 922, characters 15-68\nCalled from Stdlib__Fun.protect in file \"fun.ml\", line 34, characters 8-15\nRe-raised at Stdlib__Fun.protect in file \"fun.ml\", line 39, characters 6-52\nCalled from Unix.create_process in file \"unix.ml\" (inlined), line 925, characters 2-66\nCalled from Merlin_extend__Extend_driver.run in file \"src/extend/extend_driver.ml\", lines 26-28, characters 4-32\nCalled from Merlin_kernel__Mreader_extend.start in file \"src/kernel/mreader_extend.ml\", line 52, characters 15-52\nCalled from CamlinternalLazy.do_force_block in file \"camlinternalLazy.ml\", line 49, characters 17-27\nRe-raised at CamlinternalLazy.do_force_block in file \"camlinternalLazy.ml\", line 56, characters 4-11\nCalled from CamlinternalLazy.force_lazy_block in file \"camlinternalLazy.ml\" (inlined), line 78, characters 27-67\nCalled from Merlin_kernel__Mreader.try_with_reader in file \"src/kernel/mreader.ml\", line 107, characters 6-17\nCalled from Merlin_kernel__Mreader.parse in file \"src/kernel/mreader.ml\", lines 166-167, characters 8-48\nCalled from Merlin_kernel__Mpipeline.Reader_phase.f.(fun) in file \"src/kernel/mpipeline.ml\", line 156, characters 17-60\nCalled from Merlin_kernel__Phase_cache.With_cache.apply in file \"src/kernel/phase_cache.ml\", line 33, characters 21-34\nCalled from Merlin_kernel__Mpipeline.process in file \"src/kernel/mpipeline.ml\", lines 278-279, characters 12-48\nCalled from CamlinternalLazy.do_force_block in file \"camlinternalLazy.ml\", line 49, characters 17-27\nRe-raised at CamlinternalLazy.do_force_block in file \"camlinternalLazy.ml\", line 56, characters 4-11\nCalled from CamlinternalLazy.force_lazy_block in file \"camlinternalLazy.ml\" (inlined), line 78, characters 27-67\nCalled from Merlin_kernel__Mpipeline.timed_lazy in file \"src/kernel/mpipeline.ml\", line 17, characters 10-22\nRe-raised at Merlin_kernel__Mpipeline.timed_lazy in file \"src/kernel/mpipeline.ml\", line 19, characters 34-49\nCalled from CamlinternalLazy.do_force_block in file \"camlinternalLazy.ml\", line 49, characters 17-27\nRe-raised at CamlinternalLazy.do_force_block in file \"camlinternalLazy.ml\", line 56, characters 4-11\nCalled from Merlin_kernel__Mpipeline.reader_comments in file \"src/kernel/mpipeline.ml\" (inlined), line 128, characters 24-34\nCalled from Ocaml_lsp_server__Check_for_comments.position_in_comment.(fun) in file \"ocaml-lsp-server/src/check_for_comments.ml\", line 16, characters 4-38\nCalled from Merlin_utils__Std.let_ref in file \"src/utils/std.ml\", line 695, characters 8-12\nRe-raised at Merlin_utils__Std.let_ref in file \"src/utils/std.ml\", line 697, characters 30-39\nCalled from Merlin_utils__Misc.try_finally in file \"src/utils/misc.ml\", line 45, characters 8-15\nRe-raised at Merlin_utils__Misc.try_finally in file \"src/utils/misc.ml\", line 62, characters 10-24\nCalled from Stdlib__Fun.protect in file \"fun.ml\", line 34, characters 8-15\nRe-raised at Stdlib__Fun.protect in file \"fun.ml\", line 39, characters 6-52\nCalled from Merlin_kernel__Mocaml.with_state in file \"src/kernel/mocaml.ml\", line 18, characters 8-38\nRe-raised at Merlin_kernel__Mocaml.with_state in file \"src/kernel/mocaml.ml\", line 20, characters 42-53\nCalled from Ocaml_lsp_server__Document.Single_pipeline.use_with_config.(fun) in file \"ocaml-lsp-server/src/document.ml\", line 161, characters 20-75\nCalled from Stdune__Exn_with_backtrace.try_with in file \"otherlibs/stdune/src/exn_with_backtrace.ml\", line 9, characters 8-12\nRe-raised at Stdune__Exn.raise_with_backtrace in file \"otherlibs/stdune/src/exn.ml\" (inlined), line 38, characters 27-56\nCalled from Stdune__Exn_with_backtrace.reraise in file \"otherlibs/stdune/src/exn_with_backtrace.ml\", line 20, characters 33-71\nCalled from Fiber__Core.O.(>>|).(fun) in file \"fiber/src/core.ml\", line 250, characters 36-41\nCalled from Fiber__Scheduler.exec in file \"fiber/src/scheduler.ml\", line 73, characters 8-11\nRe-raised at Stdune__Exn.raise_with_backtrace in file \"otherlibs/stdune/src/exn.ml\" (inlined), line 38, characters 27-56\nCalled from Stdune__Exn_with_backtrace.reraise in file \"otherlibs/stdune/src/exn_with_backtrace.ml\", line 20, characters 33-71\nCalled from Fiber__Scheduler.exec in file \"fiber/src/scheduler.ml\", line 73, characters 8-11\n"},"code":-32603,"message":"uncaught exception"}}
[jsonrpc] i[12:10:56.621] [4] error -32603 ignored: uncaught exception ignored

Any idea why this is going on? I saw this announcement of the project which mentioned the LSP functioning, but the template above does include the dune expression setting the dialect.

Thanks a ton!

@andreypopp
Copy link
Member

Hi, you need to install ocamlmerlin-mlx package:

opam install ocamlmerlin-mlx

@0x6A6471
Copy link

Does ocamllsp support .mlx files? i can get the highlights working in neovim but having issues with the lsp config.

[DEBUG][2024-09-18 19:49:50] .../vim/lsp/rpc.lua:286	"rpc.send"	{  id = 4,  jsonrpc = "2.0",  method = "textDocument/hover",  params = {    position = {      character = 6,      line = 12    },    textDocument = {      uri = "file:///Users/<user>/path/to/project/client/src/ReactApp.mlx"    }  }}
[DEBUG][2024-09-18 19:49:50] .../vim/lsp/rpc.lua:408	"rpc.receive"	{  error = {    code = -32600,    message = "no document found with uri: file:///Users/<user>/path/to/project/client/src/ReactApp.mlx"  },  id = 4,  jsonrpc = "2.0"}

Sorry if this is off topic, I'm pretty new to the OCaml ecosystem but this project looks very cool. Thanks!

@andreypopp
Copy link
Member

@jakequinter do you use https://github.com/ocaml-mlx/ocaml_mlx.nvim plugin?

@andreypopp
Copy link
Member

another thing to check is the version of ocaml-lsp-server package, only the recent version support .mlx

@0x6A6471
Copy link

so i was indeed on an older version of the ocaml compiler which resulted in an older version of ocaml-lsp-server. i've updated that to the latest which appears to be 1.19.0

I am using ocaml_mlx.nvim like this: https://github.com/jakequinter/configuration/blob/main/.config/nvim/lua/jdq/plugins/ocaml-mlx.lua

not sure if something in my lsp config is borked or something. I definitely don't expect you to look into it...I'm going to keep digging, but my ocaml lsp config does includes "ocaml_mlx": https://github.com/jakequinter/configuration/blob/main/.config/nvim/lua/jdq/plugins/lsp/lsp.lua#L106

@0x6A6471
Copy link

:LspInfo does seem to be picking everything up:

 Detected filetype:   ocaml_mlx

 Client: ocamllsp (id: 2, bufnr: [13])
 	filetypes:       ocaml, ocaml_mlx
 	autostart:       true
 	root directory:  /path/to/project/ocaml/hitched/client
 	cmd:             /Users/<user>/.local/share/nvim/mason/bin/ocamllsp

although i think the problem may be related to it using mason. may need to look at trying to get it to default to the cwd

@0x6A6471
Copy link

figured it out. just incase anyone is viewing this in the future, i needed to tell vim that the filetype of "ocaml_mlx" should return "ocaml"

something like:

if filetype == "ocaml_mlx" then
    return "ocaml"
end

thanks for the help andreypopp and a huge thanks for the great work!

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

No branches or pull requests

3 participants