You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I recently started using opam switches for some projects. I noticed that when we install ocaml-lsp via opam, it actually installs it in the current switch, and changing the switch will make it unavailable unless it's also installed in the new current switch. This causes issues with the editor if the new current switch doesn't have the LSP installed.
I suppose this is a desirable feature when you have multiple versions of OCaml installed in various switches, so that the LSP is also using the right version?
The thing is, this isn't a usual pattern. In all other languages I use with an LSP, this doesn't happen, so I believe it can be a great source of confusion for people who are new to OCaml. I have enough experience so I've been able to figure out why it wasn't working, but for inexperienced developers it might be challenging to find out what's going on and could end up being frustrating.
I'm opening this discussion not to complain about it, but rather to see if there can be a solution to make the LSP more friendly to everyone.
Potential solutions
As a point of reference, some languages handle this differently. For example, dart ships the LSP as part of their CLI. While I understand OCaml's situation is different (since the compiler itself is installed per-switch to support multiple OCaml versions), perhaps there could be a middle-ground solution.
For instance, could ocaml-lsp-server be automatically installed as a dependency when creating a new switch with OCaml (with a way to opt-out for compatibility)?
Another reference is the rust lsp, that shows errors or warnings in the current if the LSP cannot process the current file (for example when the file is not part of any module).
So maybe in OCaml, there could be a "global" LSP fallback that works across switches for basic functionality, and that prints a warning saying that the current project's version does not match the installed LSP, or that it is not installed in the current switch?
The current behavior makes technical sense, but I'm convinced that improving the discoverability and user experience around this would greatly benefit newcomers to the OCaml ecosystem.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I recently started using opam switches for some projects. I noticed that when we install ocaml-lsp via opam, it actually installs it in the current switch, and changing the switch will make it unavailable unless it's also installed in the new current switch. This causes issues with the editor if the new current switch doesn't have the LSP installed.
I suppose this is a desirable feature when you have multiple versions of OCaml installed in various switches, so that the LSP is also using the right version?
The thing is, this isn't a usual pattern. In all other languages I use with an LSP, this doesn't happen, so I believe it can be a great source of confusion for people who are new to OCaml. I have enough experience so I've been able to figure out why it wasn't working, but for inexperienced developers it might be challenging to find out what's going on and could end up being frustrating.
I'm opening this discussion not to complain about it, but rather to see if there can be a solution to make the LSP more friendly to everyone.
Potential solutions
As a point of reference, some languages handle this differently. For example, dart ships the LSP as part of their CLI. While I understand OCaml's situation is different (since the compiler itself is installed per-switch to support multiple OCaml versions), perhaps there could be a middle-ground solution.
For instance, could ocaml-lsp-server be automatically installed as a dependency when creating a new switch with OCaml (with a way to opt-out for compatibility)?
Another reference is the rust lsp, that shows errors or warnings in the current if the LSP cannot process the current file (for example when the file is not part of any module).
So maybe in OCaml, there could be a "global" LSP fallback that works across switches for basic functionality, and that prints a warning saying that the current project's version does not match the installed LSP, or that it is not installed in the current switch?
The current behavior makes technical sense, but I'm convinced that improving the discoverability and user experience around this would greatly benefit newcomers to the OCaml ecosystem.
Beta Was this translation helpful? Give feedback.
All reactions