Container not started
I have installed the perl extension in vscode.
At the top of my project .vscode/settings.json looks like:
{
"perl.containerCmd": "docker",
"perl.containerMode": "run",
"perl.containerName": "docker-repo.intern:8082/caiw/imta-re:latest",
"perl.containerArgs": [
"-v",
"${workspaceFolder}:/usr/local/imta",
],
"perl.pathMap": [
[
"file:///usr/local/imta",
"file:///${workspaceFolder}/app"
]
]
}
Docker is running OK on the host. I can run containers from the command line. All docker commands like run, exec and image work fine.
Opening the project in vscode however wasn't a succes. First I got a message that the languageserver crashed. The output of Perl::LanguageServer showed an error complaining the -M flag wan't understood. OK, it might be starting bash.
So how do I change the containerArgs to tell docker run to put /usr/bin/perl behind the image name. Where are these containerArgs being inserted inside the docker run command?
docker run <containerArgs> <image> <????> where containerName
How can I indicate that /usr/bin/perl is inserted behind the image name?
OK, maybe I need --entrypoint, so
So I need to tell the extension to start perl, so I changed the containerargs to:
"perl.containerArgs": [
"--entrypoint",
"perl",
"-v",
"${workspaceFolder}:/usr/local/imta",
],
When I start vscode and open the project's directory, I don't see any attempt of a container being started whatsoever.
I don't even see a Perl::LanguageServer output anymore in the output pane of vscode.
What I want is quite simple. VScode <-----> container. Inside the container are perl and dependencies for my application and the perl languageserver. I want to be able to edit the project files inside VScode on the host, the project dir is mounted inside the container. So editing in vscod on host, running inside of the container. The languageserver inside that container providing me with autocompletion and finding definitions etc. I just can't find any good documentation on how to achieve this.
Similarly looking into running in a container.
I've found that to be able to mount code in the container, one apparently needs to use perl.containerArgs, and with that, perl.containerMode and perl.containerName are ignored , https://github.com/richterger/Perl-LanguageServer/blob/2ba4cb235246950f3157ffefa02cf4af9defd452/clients/vscode/perl/src/extension.ts#L81
Here's a snippet that works at least some for me
"perl.perlInc": [
"lib",
"etc"
],
"perl.containerCmd": "docker",
"perl.containerArgs": [
"run",
"--rm",
"--interactive",
"--volume",
"/absolute/path/to/workspace/folder:/work",
"--workdir",
"/work",
"my-perl-container-name"
],
"perl.pathMap": [
[
"file:///work",
"file:///absolute/path/to/workspace/folder"
]
]
Having to use literal paths to the workspace folder rather than being able to use the ${workspaceFolder} var in containerArgs and pathMap is likely #128