Skip to content

Commit

Permalink
Recognize "compose.yaml" as a compose file (#2656)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwateratmsft authored Jan 21, 2021
1 parent 5500ea0 commit 13ecb80
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 25 deletions.
31 changes: 8 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,37 +181,22 @@
"group": "docker"
},
{
"when": "resourceFilename =~ /^(?:(?!^docker-compose\\.ya?ml$).)*\\.ya?ml$/i && isAzureAccountInstalled",
"when": "resourceFilename =~ /^(?:(?!compose.*\\.ya?ml$).)*\\.ya?ml$/i && isAzureAccountInstalled",
"command": "vscode-docker.registries.azure.runFileAsTask",
"group": "docker"
},
{
"when": "resourceFilename == docker-compose.yml",
"when": "resourceFilename =~ /compose.*\\.ya?ml$/i",
"command": "vscode-docker.compose.down",
"group": "docker"
},
{
"when": "resourceFilename == docker-compose.yml",
"when": "resourceFilename =~ /compose.*\\.ya?ml$/i",
"command": "vscode-docker.compose.restart",
"group": "docker"
},
{
"when": "resourceFilename == docker-compose.yml",
"command": "vscode-docker.compose.up",
"group": "docker"
},
{
"when": "resourceFilename == docker-compose.debug.yml",
"command": "vscode-docker.compose.down",
"group": "docker"
},
{
"when": "resourceFilename == docker-compose.debug.yml",
"command": "vscode-docker.compose.restart",
"group": "docker"
},
{
"when": "resourceFilename == docker-compose.debug.yml",
"when": "resourceFilename =~ /compose.*\\.ya?ml$/i",
"command": "vscode-docker.compose.up",
"group": "docker"
},
Expand All @@ -228,22 +213,22 @@
"group": "docker"
},
{
"when": "resourceFilename =~ /^(?:(?!^docker-compose\\.ya?ml$).)*\\.ya?ml$/i && isAzureAccountInstalled",
"when": "resourceFilename =~ /^(?:(?!compose.*\\.ya?ml$).)*\\.ya?ml$/i && isAzureAccountInstalled",
"command": "vscode-docker.registries.azure.runFileAsTask",
"group": "docker"
},
{
"when": "resourceFilename =~ /docker-compose/i",
"when": "resourceFilename =~ /compose.*\\.ya?ml$/i",
"command": "vscode-docker.compose.down",
"group": "docker"
},
{
"when": "resourceFilename =~ /docker-compose/i",
"when": "resourceFilename =~ /compose.*\\.ya?ml$/i",
"command": "vscode-docker.compose.restart",
"group": "docker"
},
{
"when": "resourceFilename =~ /docker-compose/i",
"when": "resourceFilename =~ /compose.*\\.ya?ml$/i",
"command": "vscode-docker.compose.up",
"group": "docker"
},
Expand Down
1 change: 1 addition & 0 deletions resources/templates/.dockerignore.template
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
{{/unless}}
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
Expand Down
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const imageTagRegExp = new RegExp('^[a-zA-Z0-9.-_/]{1,256}:(?![.-])[a-zA-

// GLOB Patterns
export const FROM_DIRECTIVE_PATTERN = /^\s*FROM\s*([\w-\/:]*)(\s*AS\s*[a-z][a-z0-9-_\\.]*)?$/i;
export const COMPOSE_FILE_GLOB_PATTERN = '**/[dD][oO][cC][kK][eE][rR]-[cC][oO][mM][pP][oO][sS][eE]*.{[yY][aA][mM][lL],[yY][mM][lL]}';
export const COMPOSE_FILE_GLOB_PATTERN = '**/*[cC][oO][mM][pP][oO][sS][eE]*.{[yY][aA][mM][lL],[yY][mM][lL]}';
export const DOCKERFILE_GLOB_PATTERN = '**/{*.[dD][oO][cC][kK][eE][rR][fF][iI][lL][eE],[dD][oO][cC][kK][eE][rR][fF][iI][lL][eE]}';
export const YAML_GLOB_PATTERN = '**/*.{[yY][aA][mM][lL],[yY][mM][lL]}';
export const CSPROJ_GLOB_PATTERN = '**/*.{[cC][sS][pP][rR][oO][jJ]}';
Expand Down
2 changes: 1 addition & 1 deletion src/telemetry/registerListeners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function registerListeners(): void {

registerEvent('composefilesave', workspace.onDidSaveTextDocument, async (context: IActionContext, doc: TextDocument) => {
// If it's not a compose file, skip
if (!/compose.*\.ya?ml/i.test(doc.fileName)) {
if (!/compose.*\.ya?ml$/i.test(doc.fileName)) {
context.telemetry.suppressAll = true;
return;
}
Expand Down

0 comments on commit 13ecb80

Please sign in to comment.