Skip to content

Commit

Permalink
Fix wrong language detection for extension project
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Etchells committed Sep 18, 2019
1 parent 3dcc342 commit 460eb71
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dev/src/codewind/connection/UserProjectCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,13 @@ namespace UserProjectCreator {

let projectType: string = projectTypeRes.label;
let language: string;
if (projectType !== OTHER_TYPE_OPTION) {
// If the project type selected has a language that it always is, use that language, else have the user select it
const typesWithCorrespondingLanguage = ProjectType.getRecognizedInternalTypes()
.map((type) => type.toString())
// Remove generic type because it can be any language
.filter((type) => type !== OTHER_TYPE_OPTION);

if (typesWithCorrespondingLanguage.includes(projectType)) {
language = projectTypeRes.language;
}
else {
Expand Down
4 changes: 4 additions & 0 deletions dev/src/codewind/project/ProjectType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ export class ProjectType {
}
}

public static getRecognizedInternalTypes(): ProjectType.InternalTypes[] {
return Object.values(this.InternalTypes);
}

/*
private static getUserFriendlyType(type: ProjectType.Types): string {
// For docker projects, return the language
Expand Down

0 comments on commit 460eb71

Please sign in to comment.