Skip to content

Commit

Permalink
Remove python/go project types, fixes eclipse-archived#125
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Etchells <[email protected]>
  • Loading branch information
Tim Etchells authored and jopit committed Jul 23, 2019
1 parent af99cee commit 11995ca
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
36 changes: 17 additions & 19 deletions dev/src/codewind/project/ProjectType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class ProjectType {
public readonly language: string,
public readonly extensionName?: string,
) {
this.type = ProjectType.getType(internalType, language, extensionName);
this.type = ProjectType.getType(internalType, extensionName);
// this.userFriendlyType = ProjectType.getUserFriendlyType(this.type);
this.debugType = ProjectType.getDebugType(this.type, language);
this.icon = ProjectType.getProjectIcon(this.type, language);
Expand All @@ -43,7 +43,7 @@ export class ProjectType {
return this.type.toString();
}

private static getType(internalType: string, language: string, extensionName: OptionalString): ProjectType.Types {
private static getType(internalType: string, extensionName: OptionalString): ProjectType.Types {
if (internalType === this.InternalTypes.MICROPROFILE) {
return ProjectType.Types.MICROPROFILE;
}
Expand All @@ -57,15 +57,7 @@ export class ProjectType {
return ProjectType.Types.SWIFT;
}
else if (internalType === this.InternalTypes.DOCKER) {
if (language === this.Languages.PYTHON) {
return ProjectType.Types.PYTHON;
}
else if (language === this.Languages.GO) {
return ProjectType.Types.GO;
}
else {
return ProjectType.Types.GENERIC_DOCKER;
}
return ProjectType.Types.GENERIC_DOCKER;
}
else if (extensionName) {
return ProjectType.Types.EXTENSION;
Expand Down Expand Up @@ -147,23 +139,24 @@ export class ProjectType {

export namespace ProjectType {

// These are the project types as exposed to the user.
// String value must be user-friendly!
/*
* These are the project types as exposed to the user. String value must be user-friendly.
*/
export enum Types {
MICROPROFILE = "Microprofile",
SPRING = "Spring",
NODE = "Node.js",
SWIFT = "Swift",
PYTHON = "Python",
GO = "Go",
GENERIC_DOCKER = "Docker",
EXTENSION = "Extension",
UNKNOWN = "Unknown"
}

// non-nls-section-start

// possible values of the "projectType" or "buildType" internal attribute
/**
* Possible values of the "projectType" or "buildType" internal attribute
*/
export enum InternalTypes {
MICROPROFILE = "liberty",
SPRING = "spring",
Expand All @@ -172,8 +165,11 @@ export namespace ProjectType {
DOCKER = "docker"
}

// Possible values of the "language" internal attribute
// could be others, but if they're not in this list we'll just treat them as generic docker

/**
* Some possible values of the "language" internal attribute, for which we have special treatment such as nicer icons.
* Language can be user-determined so this is not a complete list
*/
export enum Languages {
JAVA = "java",
NODE = "nodejs",
Expand All @@ -182,7 +178,9 @@ export namespace ProjectType {
GO = "go"
}

// VSCode debug types, used as the "type" attribute in a debug launch.
/**
* VSCode debug types, used as the "type" attribute in a debug launch.
*/
export enum DebugTypes {
JAVA = "java",
NODE = "node"
Expand Down
10 changes: 7 additions & 3 deletions dev/src/command/project/ContainerShellCmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ export default async function containerShellCmd(project: Project): Promise<void>
return;
}

// annoyingly, only python project containers seem to not have bash installed.
// TODO We could check what's installed by doing docker exec through child_process, if that's worth the trouble.
const toExec: string = project.type.type === ProjectType.Types.PYTHON ? "sh" : "bash"; // non-nls
// This is a hack for the python template project not having bash installed.
// This would trigger for a user python template too. :(
const toExec: string =
project.type.type === ProjectType.Types.GENERIC_DOCKER &&
project.type.language === ProjectType.Languages.PYTHON ?
"sh" : "bash"; // non-nls

// const env = convertNodeEnvToTerminalEnv(process.env);

const options: vscode.TerminalOptions = {
Expand Down

0 comments on commit 11995ca

Please sign in to comment.