-
Notifications
You must be signed in to change notification settings - Fork 123
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
Wrong documentation on hover #344
Comments
Related to ocamllabs/vscode-ocaml-platform#111 |
That issue could be closed since the problem cannot be fixed on the vscode
extension side.
…On Tue, 8 Dec 2020 at 17:18, Thibaut Mattio ***@***.***> wrote:
Related to ocamllabs/vscode-ocaml-platform#111
<ocamllabs/vscode-ocaml-platform#111>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#344 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD4YR67VJCYXJLGBL6V2IUTSTYKQ7ANCNFSM4UR4IECQ>
.
|
I think I got a reproducible case. When one types a module name
for some reason the documentation on hover at position In the video I need to push the module def down to reproduce the bug, because the Screen.Recording.2021-02-27.at.4.59.15.PM.movPhrased differently, if we fetch documentation for a stdlib module (by typing the module name and hence triggering auto-completion which shows documentation, or hovering over the module, which also brings docs), we start fetching docs from the file instead of the currently open one. |
This is fixed on master by updating to the latest merlin 4.2 edit: NVM I confused this issue with another one |
@ulugbekna can you make a regression test for this? I'll try and have a look. |
I'm unable to reproduce this issue with the example above. |
Sorry, I missed your first message. I'll try to come up with a test. I can
still reproduce it manually though.
…On Wed, 28 Apr 2021 at 06:10, Rudi Grinberg ***@***.***> wrote:
I'm unable to reproduce this issue with the example above.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#344 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD4YR6YZEYR47GD3H43AC4DTK5OANANCNFSM4UR4IECQ>
.
|
I never know if this kind of message is useful, but just in case: I regularly encounter this problem too, and so do several of my teammates (to confirm this is not an isolated issue for OP). Edit: one of my teammates rightfully mentioned that it seems to often replace the doc with the doc of an Stdlib function/type (in case this helps). I noticed the same thing |
What's blocking me from making progress on this issue is a (preferably small) reproducible test case. Next time you run into this issue, see if you can isolate it.
Rudi.
…On May 4, 2021, 12:14 PM -0700, Julien Debon ***@***.***>, wrote:
I never know if this kind of message is useful, but just in case: I regularly encounter this problem too, and so do several of my teammates (to confirm this is not an isolated issue for OP).
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@rgrinberg> Thanks for your awesome work on |
Since the bug is triggered by "pulling in" an stdlib module, for example, for auto-complete ( |
Removing these lines fixes the issue without regressions on the doc-on-hover tests in merlin. I could create a PR but I'm having problems with $ $MERLIN single document -position 7:10 -filename doc.ml < doc.ml |
> jq '.value'
- "second function"
+ parse error: Invalid string: control characters from U+0000 through U+001F must be escaped at line 9, column 1
+ [4] cc @rgrinberg edit: on this line, |
use the current file fixes ocaml/ocaml-lsp#344
use the current file fixes ocaml/ocaml-lsp#344
use the current file fixes ocaml/ocaml-lsp#344
CHANGES: ## Features - Add a new code action `Add missing rec keyword`, which is available when adding a `rec` keyword can fix `Unbound value ...` error, e.g., ```ocaml 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`. - Jump to the first hole on calling `Destruct` code action (only with client VSCode OCaml Platform) (ocaml/ocaml-lsp#468) Example: when a user invokes `Destruct` code action on `Some 1`, this code is replaced by `match Some 1 with None -> _ | Some _ -> _`, where the 1st and 3rd underscores are "typed holes", a concept created by Merlin to be able to put "holes" in OCaml code. With this change, now for VSCode OCaml Platform users, on such invocation of `Destruct`, the cursor will jump to the first typed hole and select it, so that user can start editing right away. - Use ocamlformat to properly format type snippets. This feature requires the `ocamlformat-rpc` opam package to be installed. (ocaml/ocaml-lsp#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 (ocaml/ocaml-lsp#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. - Parse merlin errors (best effort) into a more structured form. This allows reporting all locations as "related information" (ocaml/ocaml-lsp#475) - Add support for Merlin `Construct` command as completion suggestions, i.e., show complex expressions that could complete the typed hole. (ocaml/ocaml-lsp#472) - Add a code action `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. (ocaml/ocaml-lsp#472) - Change the formatting-on-save error notification to a warning notification (ocaml/ocaml-lsp#472) - Code action to qualify ("put module name in identifiers") and unqualify ("remove module name from identifiers") module names in identifiers (ocaml/ocaml-lsp#399) Starting from: ```ocaml open Unix let times = Unix.times () let f x = x.Unix.tms_stime, x.Unix.tms_utime ``` Calling "remove module name from identifiers" with the cursor on the open statement will produce: ```ocaml open Unix let times = times () let f x = x.tms_stime, x.tms_utime ``` Calling "put module name in identifiers" will restore: ```ocaml open Unix let times = Unix.times () let f x = x.Unix.tms_stime, x.Unix.tms_utime ``` ## Fixes - Do not show "random" documentation on hover - fixed by [merlin#1364](ocaml/merlin#1364) - fixes duplicate: - [ocaml-lsp#344](ocaml/ocaml-lsp#344) - [vscode-ocaml-platform#111](ocamllabs/vscode-ocaml-platform#111) - Correctly rename a variable used as a named/optional argument (ocaml/ocaml-lsp#478) - When reporting an error at the beginning of the file, use the first line not the second (ocaml/ocaml-lsp#489)
CHANGES: ## Features - Add a new code action `Add missing rec keyword`, which is available when adding a `rec` keyword can fix `Unbound value ...` error, e.g., ```ocaml 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`. - Use ocamlformat to properly format type snippets. This feature requires the `ocamlformat-rpc` opam package to be installed. (ocaml/ocaml-lsp#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 (ocaml/ocaml-lsp#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. - Parse merlin errors (best effort) into a more structured form. This allows reporting all locations as "related information" (ocaml/ocaml-lsp#475) - Add support for Merlin `Construct` command as completion suggestions, i.e., show complex expressions that could complete the typed hole. (ocaml/ocaml-lsp#472) - Add a code action `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. (ocaml/ocaml-lsp#472) - Change the formatting-on-save error notification to a warning notification (ocaml/ocaml-lsp#472) - Code action to qualify ("put module name in identifiers") and unqualify ("remove module name from identifiers") module names in identifiers (ocaml/ocaml-lsp#399) Starting from: ```ocaml open Unix let times = Unix.times () let f x = x.Unix.tms_stime, x.Unix.tms_utime ``` Calling "remove module name from identifiers" with the cursor on the open statement will produce: ```ocaml open Unix let times = times () let f x = x.tms_stime, x.tms_utime ``` Calling "put module name in identifiers" will restore: ```ocaml open Unix let times = Unix.times () let f x = x.Unix.tms_stime, x.Unix.tms_utime ``` ## Fixes - Do not show "random" documentation on hover - fixed by [merlin#1364](ocaml/merlin#1364) - fixes duplicate: - [ocaml-lsp#344](ocaml/ocaml-lsp#344) - [vscode-ocaml-platform#111](ocamllabs/vscode-ocaml-platform#111) - Correctly rename a variable used as a named/optional argument (ocaml/ocaml-lsp#478) - When reporting an error at the beginning of the file, use the first line not the second (ocaml/ocaml-lsp#489)
On hover, I sometimes get documentation for a completely different thing than the identifier I hover over. The "different thing" is usually something that comes from stdlib such as
>
operator or as in the screenshot, where I hover overerr_pos_range
and get correct type but not doc.(might be a merlin issue, but the last issue found with ocaml-lsp I raised in merlin repo turned out to be ocaml-lsp related, so creating the issue here)
The text was updated successfully, but these errors were encountered: