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

Add a docker-compose Language ID so it can be assigned via file.associations (or manually) #206

Closed
robertpeteuil opened this issue Jan 30, 2018 · 13 comments

Comments

@robertpeteuil
Copy link

robertpeteuil commented Jan 30, 2018

Please add docker-compose to the installed languages and give it a unique language ID (like dockercompose.

This would enable assigning it via user-settings, workspace-settings and manually via the Select Language Mode dropdown.

I should be able to define a file to the docker-compose DSL with something like this:

"files.associations": {
    "core-service.yml": "dockercompose"
}

An example of a YAML based DSL extension that does this is language-Ansible. It registers the ansible language which enables configuring and selecting the language as described above.

I've read about changing the ENV var COMPOSE_FILE_GLOB_PATTERN, but this isn't a solution for many reasons:

  • It changes it globally (for all open projects) on that computer
  • It must be changed on every computer (via some method outside of vscode's config system)
  • It doesn't allow for configuration in user-settings - setting user-specific names and allows the setting to be synced between machines
  • It doesn't allow configuration in workspace-settings - for project specific filenames (which is likely the most useful)
@robertpeteuil robertpeteuil changed the title Add a docker-compose Languages ID so it can be assigned via file.associations (or manually) Add a docker-compose Language ID so it can be assigned via file.associations (or manually) Jan 30, 2018
@seffyroff
Copy link

Yes please. Right now it's frustrating to only have intellisense on files that are named 'docker-compose.yml'

@robertpeteuil
Copy link
Author

Thanks @seffyroff - I'm surprised there hasn't been more noise about this.

The current implementation is great, but limited by strange implementation choices:

  • Define an entire language syntax & autocomplete engine, then skipped the most important step - registering it as a language.
  • Hard-coding it to specific filenames (well excepting system-wide environment vars, which is another odd choice.)

Perhaps this implementation is caused by other features in the extension that requiring knowing the filenames in advance (for action like compose up)

  • if so, why can't the language be released as a separate extension?

@hahntech
Copy link

Yes, please add this!  We use compose files names for components of our solution everywhere.  I cannot believe this isn’t built it.

@Frodox
Copy link

Frodox commented May 20, 2018

Heavy +1.
We regularly use docker-compose-dev.yml, docker-compose-prod.yml, docker-compose-monitoring.yml, docker-compose-wthatever.yml, and it would be great to highlight all them too!

@bradwilson
Copy link

Do we need a PR to get this to happen?

@sarink
Copy link

sarink commented Aug 27, 2018

Temporarily, you can at least tell vscode that it's yml with the following (in settings.json opened via cmd+,)

"files.associations": {
  "docker-compose*.yml": "yaml"
}

And if you use multiple Dockerfiles just add: "Dockerfile*": "dockerfile"

@bradwilson
Copy link

It's already recognized as YAML. This is about getting Intellisense for the Docker Compose features, not syntax highlighting.

@akankov
Copy link

akankov commented Jan 2, 2019

Just add these to your config
"docker-compose.files": [ "docker-compose.yml", "docker-compose-dev.yml" ]

@bradwilson
Copy link

@akankov That does not appear to be a valid setting in 0.4.0:

image

@xenoterracide
Copy link

still open :'(

@mike-boost
Copy link

as a workaround , you should name your file according to this to this like:
https://github.com/Microsoft/vscode-docker/blob/91a56df16058eaa134855eb2438be4216fa2b74d/dockerExtension.ts#L29-L30

export const COMPOSE_FILE_GLOB_PATTERN = '/[dD]ocker-[cC]ompose*.{yaml,yml}';
export const DOCKERFILE_GLOB_PATTERN = '
/[dD]ocker[fF]ile*';

image

but the docker-compose icon still not work properly.

@Frickeldave
Copy link

Yes. please implement. For some reason in our project the compose-files are named "Composefile". With file associations i can associate them with YAML, but not with docker-compose. This results in "No Intellisense" and "No options in right-click context menu".

@bwateratmsft
Copy link
Contributor

Duping to #2539

@bwateratmsft bwateratmsft removed this from the Future milestone Dec 3, 2020
@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests