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

Multi-root vscode workspaces not working #1696

Open
Martomate opened this issue Dec 23, 2024 · 2 comments
Open

Multi-root vscode workspaces not working #1696

Martomate opened this issue Dec 23, 2024 · 2 comments

Comments

@Martomate
Copy link

Problem

This extension does not seem to work inside multi-root VSCode workspaces. The ocamllsp and ocamlc commands are not found.

Context

I have a VSCode workspace where one of the projects is an OCaml project (using Dune). It looks something like this:

the_workspace
|- ocaml_project
'- another_project

I'm using the global switch and have installed the lsp and formatter. If I open the OCaml project as a folder in VSCode this extension works as expected, but when I open the enclosing workspace it does not work.

Workaround

I have created a custom sandbox and put it into the vscode settings for the workspace, like this:

"settings": {
	"ocaml.sandbox": {
		"kind": "custom",
		"template": "opam exec --switch=default --set-switch -- $prog $args"
	}
}
@smorimoto
Copy link
Collaborator

I have not tried, but instead of adding the settings to the code-workspace, can you put the settings under the .vscode folder in each root?

@Martomate
Copy link
Author

I have not tried, but instead of adding the settings to the code-workspace, can you put the settings under the .vscode folder in each root?

Just tried it and it didn't work. VSCode told me that this particular setting is read from the workspace settings and that the setting in the project folder is only used if the folder is opened directly. This seems to be true for all ocaml settings.

To be clear: the workaround works pretty well, and is only needed when using a workspace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants