microsoft/vscode-docker

Add intellisense for docker compose files

bwateratmsft opened this issue ยท 15 comments

Creating this umbrella issue since there are a bunch of different things that basically boil down to creating a language server + intellisense + etc. for compose files.

Maybe/currently not possible:

  • Semantic highlighting (I can't think of a use case)
  • Change the file picking logic to be better and language-based (I don't think currently possible)
  • Port-in-use intellisense (Gross, port scanning)

Other:

  • docker-stack.yml (#520)

Update: as of 2 Aug 21, about 33% of activations are due to Dockerfiles being opened, now about 25% are due to Docker Compose files being opened, with most of the balance being task runs and the Docker Explorer. This is down from 60% YAML, 30% Dockerfile, 10% others. This is a big improvement; by narrowing to activating for Compose documents only, the activations for Compose/YAML are way lower--this means far less spurious activation.

Other Notes & Ideas:
Adding a "well known" service to a compose file through a snippet. (Redis, postgres)
Warnings for incorrect indentation levels of a service or attributes (e.g "attribute dockerfile does not exist at this hierarchy)
Warnings for incorrect file paths or files that don't exist in the context of the project - mainly applies to context attribute and volume attribute
Warnings for misspelled sections (if you misspell volumes, ports, environment etc, there are no warnings)

Feb 11th Edit (per our meeting discussions):
We have at least a few sections we want to tackle early on for creating tab completions. A few of them are listed below:

  • env
  • env_file
  • build
  • depends_on
  • labels

@bwateratmsft should the docker-stack.yml be scrapped?

According to https://github.com/compose-spec/compose-spec/blob/master/spec.md#compose-file and https://docs.docker.com/compose/compose-file/ - the latest specs says a file should be named compose.yaml it says:

The default path for a Compose file is compose.yaml (preferred) or compose.yml in working directory. Compose implementations SHOULD also support docker-compose.yaml and docker-compose.yml for backward compatibility.

I also noticed now that when I renamed my file to compose.yaml it does not get the "red Moby Dick icon" but rather a normal .yaml icon.

@bwateratmsft should the docker-stack.yml be scrapped?

Yeah, probably. ๐Ÿ˜„

According to https://github.com/compose-spec/compose-spec/blob/master/spec.md#compose-file and https://docs.docker.com/compose/compose-file/ - the latest specs says a file should be named compose.yaml it says:

The default path for a Compose file is compose.yaml (preferred) or compose.yml in working directory. Compose implementations SHOULD also support docker-compose.yaml and docker-compose.yml for backward compatibility.

I also noticed now that when I renamed my file to compose.yaml it does not get the "red Moby Dick icon" but rather a normal .yaml icon.

I had not noticed this change, thank you for bringing it to our attention! I'm going to make a separate work item (#2618) to cover that for the time being. It is more urgent that we get that fix in place than that we create a compose language server.

We will be able to do this incrementally which is good. The minimum viable product would include a language ID being defined, and syntax highlighting to support it. This would have the side benefit of reducing spurious activations for non-compose YAML files.

@bwateratmsft Is the plan to implement this with VS Code APIs or as a language server? ๐Ÿค”

Most likely a language server since I assume a lot of these features would require that. We also want to take the same language server and run it in VS--not just VSCode--which is a thing now, or so I'm told. ๐Ÿ˜„

Might get a language ID from VSCode itself: microsoft/vscode#118042

The VSCode team has merged that change, so now there is a compose language ID of dockercompose. It matches the following patterns:

"filenamePatterns": [
    "compose.yml",
    "compose.yaml",
    "compose.*.yml",
    "compose.*.yaml",
    "*docker*compose*.yml",
    "*docker*compose*.yaml"
],

I'll start making some changes in the Docker extension to best support this. Thanks @alexr00! This is a big win for us!

Moved to 1.17 per discussion in team meeting, and we'll make this high pri for 1.17.

Icon theme gets defined here: https://github.com/jesseweed/seti-ui/blob/24bb6afe6f9c136fb660d39ed8d46956cb94eb13/styles/components/icons/mapping.less#L542-L551 (disregard the // BOWER label, looks like a copypaste typo)

We can update the mapping here.

The pink whale icon has been extended to all dockercompose documents via microsoft/vscode@5541826. This should be available in VSCode 1.60 or maybe 1.61.

Moving milestone to 1.19.0 as we have completed what we wanted to in 1.18.0.

Rather than continually moving this a milestone at a time, I'm going to make sure issues exist for each of the remaining tasks in https://github.com/microsoft/compose-language-service, and close this one.

@bwateratmsft the original post in this thread already contains existing issues. Just open them up again?

Yeah, that's a better idea. I'll do that and transfer them to the other repo.