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

Switching implementation/interface for unsaved file fails silently. #382

Closed
mnxn opened this issue Sep 30, 2020 · 2 comments · Fixed by ocaml/ocaml-lsp#254
Closed

Switching implementation/interface for unsaved file fails silently. #382

mnxn opened this issue Sep 30, 2020 · 2 comments · Fixed by ocaml/ocaml-lsp#254
Assignees
Labels
type: bug Something isn't working

Comments

@mnxn
Copy link
Collaborator

mnxn commented Sep 30, 2020

Currently if you have a folder with a single .ml file and you switch to .mli, the extension creates an new unsaved document. However when you try to switch back to the .ml file (without saving the .mli), nothing happens. The extension logs something like

[Trace - 1:44:34 PM] Received response 'ocamllsp/switchImplIntf - (9)' in 0ms. Request failed: no document found with uri: untitled:/Users/max/main.mli (-32600).

I think there can be two solutions to this:

  1. Allow the switching implementation to work on unsaved ("untitled") files.

  2. Don't show the switching button for untitled files. A button that does nothing is worse than no button at all. This can be done by using resourceScheme in the menu contribution when clauses:

    "when": "editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.ocamllex || editorLangId == ocaml.menhir",

@mnxn mnxn added the type: bug Something isn't working label Sep 30, 2020
@mnxn mnxn changed the title Switching implementation/interface for untitled file fails silently. Switching implementation/interface for unsaved file fails silently. Sep 30, 2020
@rgrinberg
Copy link
Contributor

I think the main issue here is that we don't take into account the document store when looking for existing modules. If we fix this, then switching for unsaved files is going to work transparently. @ulugbekna can we assign this to you?

@ulugbekna
Copy link
Collaborator

Absolutely

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants