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

Jump-to-definition stops working after a short while #970

Closed
cristianoc opened this issue Jun 19, 2022 · 5 comments
Closed

Jump-to-definition stops working after a short while #970

cristianoc opened this issue Jun 19, 2022 · 5 comments

Comments

@cristianoc
Copy link

On 1.10.4 with lsp server 1.11.6, and standard opam switch 4.14.0.

Symbol: resolve_package in https://github.com/rescript-lang/rescript-compiler/blob/master/jscomp/bsb/bsb_config_parse.ml#L199

Build: dune build -w from the root of the repo.

Nothing special about the symbol, just I have used it for repro.

I can repro over and over again, but it can take from a few seconds to a minute to repro. Tried the previous version 1.10.3 with identical results, but chances are it's the lsp anyway.
Basically, jump to definition locally within the file works for a while, then stops working. (And in the same way starts working again after a while).
Could not pinpoint what's causing it, but it repros consistently after a reload and without editing the file at all.

The only pattern that might be relevant I have observed, in the log it happens after a didOpen/didClose/publishDiagnostics triggered by command+hover on a value from another file.

Will attach a complete log next, starting after reloading the window. Only one window open: bsb_config_parse.ml .

There are several successful attempts. Then at some point the same jump to def fails. Here is one even where it fails:

[Trace - 12:54:06 AM] Sending request 'textDocument/definition - (28)'.
Params: {
    "textDocument": {
        "uri": "file:///Users/cristianocalcagno/GitHub/rescript-compiler/jscomp/bsb/bsb_config_parse.ml"
    },
    "position": {
        "line": 198,
        "character": 15
    }
}


[Trace - 12:54:06 AM] Received response 'textDocument/definition - (28)' in 1ms.
No result returned.


[Trace - 12:54:06 AM] Received notification 'window/logMessage'.
Params: {
    "type": 1,
    "message": "Locate failed. resolve_package not found."
}


[Error - 12:54:06 AM] Locate failed. resolve_package not found.

Earlier than that event it succeeded:

[Trace - 12:54:00 AM] Sending request 'textDocument/definition - (20)'.
Params: {
    "textDocument": {
        "uri": "file:///Users/cristianocalcagno/GitHub/rescript-compiler/jscomp/bsb/bsb_config_parse.ml"
    },
    "position": {
        "line": 198,
        "character": 17
    }
}


[Trace - 12:54:00 AM] Received response 'textDocument/definition - (20)' in 2ms.
Result: [
    {
        "uri": "file:///Users/cristianocalcagno/GitHub/rescript-compiler/jscomp/bsb/bsb_config_parse.ml",
        "range": {
            "start": {
                "line": 27,
                "character": 4
            },
            "end": {
                "line": 27,
                "character": 4
            }
        }
    }
]

And later than that event it also succeeded:

[Trace - 12:58:02 AM] Sending request 'textDocument/definition - (61)'.
Params: {
    "textDocument": {
        "uri": "file:///Users/cristianocalcagno/GitHub/rescript-compiler/jscomp/bsb/bsb_config_parse.ml"
    },
    "position": {
        "line": 198,
        "character": 15
    }
}


[Trace - 12:58:02 AM] Received response 'textDocument/definition - (61)' in 2ms.
Result: [
    {
        "uri": "file:///Users/cristianocalcagno/GitHub/rescript-compiler/jscomp/bsb/bsb_config_parse.ml",
        "range": {
            "start": {
                "line": 27,
                "character": 4
            },
            "end": {
                "line": 27,
                "character": 4
            }
        }
    }
]
@cristianoc
Copy link
Author

Trace.txt

@rgrinberg
Copy link
Contributor

Try lsp 1.12.1 and let us know if you see an improvement

@cristianoc
Copy link
Author

Try lsp 1.12.1 and let us know if you see an improvement

Screenshot 2022-06-24 at 20 49 03

Thanks, just tried.
Looks like the issue is still there. In the screenshot I'm command+hover'ing and it's not underlined so it's not clickable.
Can repro in a 10 to 30 seconds.

@ulugbekna
Copy link
Collaborator

If it's the same bug I have in mind, then this issue has been around for some time actually. It usually occurs on repeated queries to jump-to-def on the same symbol. The issue is gone if you reopen the file, I think.

@ulugbekna
Copy link
Collaborator

This should be fixed by ocaml/ocaml-lsp#904, which is included in ocaml-lsp-server v 1.14.2

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