inlay-hint for function parameters configurable (#1515)ocamllsp/jumpToTypedHole to navigate through typed holes (#1516)yojson_of_t for Nullable_option: serialize None as Null instead of asserting false (#1525 fixes #1524)class, class type, method and property for DocumentSymbol query (#1487 fixes #1449)inlay-hint for function parameters (#1515)Definition_query) (#1518)ocamlformat application after destruct (that remove some useful parenthesis) (#1519)standardHover, that can be used by clients to disable the default hover provider. When standardHover = false textDocument/hover requests always returns with empty result. (#1416)jump code actions by default. Clients can enable them with the merlinJumpCodeActions configuration option. Alternatively a custom request is provided for ad hoc use of the feature. (#1411)ocamllsp/typeSearch request (#1369)ocamllsp/jump request (#1374)selectionRange answers (#1368)ocamllsp/getDocumentation request (#1336)ocamllsp/construct request (#1348)duneDiganostics and it may be set to { enable: false } to disable diagnostics. (#1221)ifthenelse expressions (#1031)Improve hover behavior (#1245)
Hovers are no longer displaye on useless parsetree nodes such as keywords, comments, etc.
Multiline hovers are now filtered away.
Display expanded ppx's in the hover window.
Improve document symbols (#1247)
Use the parse tree instead of the typed tree. This means that document symbols will work even if the source code doesn't type check.
Include symbols at arbitrary depth.
Differentiate functions / types / variants / etc.
This now includes PPXs like let%expect_test or let%bench in the outline.
destruct-line code action. This is an improved version of the old destruct code action. (#1283)update-signature code action to update the types of elements that were already present in the signature (#1289)ocamllsp/merlinCallCompatible request (#1265)ocamllsp/typeEnclosing request (#1304)Detect document kind by looking at merlin's suffixes config.
This enables more lsp features for non-.ml/.mli files. Though it still depends on merlin's support. (#1237)
--clientProcessId flag. (#1242)~ or ?. Change the label completions that start with ? to start with ~ when the prefix being completed starts with ~. (#1277)SignatureHelp (#1296)--fallback-read-dot-merlin flag is on. (#1173)in (#1217)ocamlformat-rpc in some edge cases when ocamlformat is initialized concurrently (#1132)$ dune ocaml-merlin with SIGTERM rather than SIGKILL (#1124)Refactor comment parsing to use odoc-parser and cmarkit instead of octavius and omd (#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.
--clientProcessId command line argument. (#1074)--port as a synonym for --socket. (#1075)didChangeConfiguration notification (#1103)merlin-lib 4.9 (#1070)Support connecting over pipes and socket. Pipes on Windows aren't yet supported (#946)
More about communication channels in LSP specification.
Re-enable ocamlformat-rpc for formatting code snippets (but not files and not on Windows) (#920, #939)
One needs to have installed either ocamlformat package version > 0.21.0 or, otherwise, ocamlformat-rpc package. Note that previously ocamlformat-rpc came in a standalone OPAM package, but since ocamlformat version > 0.21.0, it comes within ocamlformat package.
ocamllsp/hoverExtended request (#561)Support utf-8 position encoding clients (#919)
More about position encoding in LSP specification.
verbosity=smart by default (#942)Foo.Bar.x (#932)Fix syncing of document contents:
showDocument capabilities. Do not offer commands or code actions that rely on this request without client support. (#836).ml, .mli, etc.) (#795)SIGPIPE . (#788)include in folding ranges (#730)--fallback-read-dot-merlin to the LSP Server (#705). If ocamllsp is started with this new flag, it will fall back to looking for Merlin configuration in .merlin files rather than calling dune ocaml-merlin. (#705)chdir races when running ppx (#550).merlin files, and as a consequence no longer depends on dot-merlin-reader. (#523)Add a new code action Add missing rec keyword, which is available when adding a rec keyword can fix Unbound value ... error, e.g.,
let fact n = if n = 0 then 1 else n * fact (n - 1)
(* ^^^^ Unbound value fact *)Adding rec to the definition of fact will fix the problem. The new code action offers adding rec.
ocamlformat-rpc opam package to be installed. (#386)Add completion support for polymorphic variants, when it is possible to pin down the precise type. Examples (<|> stands for the cursor) when completion will work (#473)
Function application:
let foo (a: [`Alpha | `Beta]) = ()
foo `A<|>Type explicitly shown:
let a : [`Alpha | `Beta] = `B<|>Note: this is actually a bug fix, since we were ignoring the backtick when constructing the prefix for completion.
Construct command as completion suggestions, i.e., show complex expressions that could complete the typed hole. (#472)Construct an expression that is shown when the cursor is at the end of the typed hole, i.e., _|, where | is the cursor. The code action simply triggers the client (currently only VS Code is supported) to show completion suggestions. (#472)Code action to qualify ("put module name in identifiers") and unqualify ("remove module name from identifiers") module names in identifiers (#399)
Starting from:
open Unix
let times = Unix.times ()
let f x = x.Unix.tms_stime, x.Unix.tms_utimeCalling "remove module name from identifiers" with the cursor on the open statement will produce:
open Unix
let times = times ()
let f x = x.tms_stime, x.tms_utimeCalling "put module name in identifiers" will restore:
open Unix
let times = Unix.times ()
let f x = x.Unix.tms_stime, x.Unix.tms_utimeDo not show "random" documentation on hover
fixes duplicate:
Show typed holes as errors
Merlin has a concept of "typed holes" that are syntactically represented as _. Files that incorporate typed holes are not considered valid OCaml, but Merlin and OCaml-LSP support them. One example when such typed holes can occur is when on "destructs" a value, e.g., destructing (Some 1) will generate code match Some 1 with Some _ -> _ | None -> _. While the first underscore is a valid "match-all"/wildcard pattern, the rest of underscores are typed holes.
verbosity from 1 to 0. This is the same default that merlin uses. The old value for verbosity (#433)Get fresh diagnostics (warning and error messages) on a file save (#438)
Note: If you want the fresh diagnostics to take into account changes in other files, you likely need to rebuild your project. An easy way to get automatic rebuilds is to run dune in a watching mode, e.g.,[dune build --watch].
-short-paths even if the project wasn't built yetparams in a list. This is required by the spec. (#351)destruct as a code action in interface files (#255)