Skip to content

Commit

Permalink
add support for Coder.com (#714)
Browse files Browse the repository at this point in the history
Checks for extension `coder.coder` to tell if the IDE is Coder + VS
Code or just a regular VS Code installation.
  • Loading branch information
deansheather authored and shanalikhan committed Dec 4, 2018
1 parent 3646117 commit a71e09b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
8 changes: 5 additions & 3 deletions src/commons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -647,9 +647,11 @@ export default class Commons {
outputChannel.appendLine(`--------------------`);

outputChannel.appendLine(`Files ${upload ? "Upload" : "Download"}ed:`);
files.filter(item => item.fileName.indexOf(".") > 0).forEach(item => {
outputChannel.appendLine(` ${item.fileName} > ${item.gistName}`);
});
files
.filter(item => item.fileName.indexOf(".") > 0)
.forEach(item => {
outputChannel.appendLine(` ${item.fileName} > ${item.gistName}`);
});

outputChannel.appendLine(``);
outputChannel.appendLine(`Extensions Ignored:`);
Expand Down
18 changes: 13 additions & 5 deletions src/environmentPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class Environment {
public isInsiders: boolean = false;
public isOss: boolean = false;
public isPortable: boolean = false;
public isCoderCom: boolean = false;
public homeDir: string | null = null;
public USER_FOLDER: string = null;

Expand Down Expand Up @@ -66,14 +67,17 @@ export class Environment {
this.isInsiders = /insiders/.test(this.context.asAbsolutePath(""));
this.isPortable = process.env.VSCODE_PORTABLE ? true : false;
this.isOss = /\boss\b/.test(this.context.asAbsolutePath(""));
this.isCoderCom =
vscode.extensions.getExtension("coder.coder") !== undefined;
const isXdg =
!this.isInsiders &&
!this.isCoderCom &&
process.platform === "linux" &&
!!process.env.XDG_DATA_HOME;
this.homeDir = isXdg
? process.env.XDG_DATA_HOME
: process.env[process.platform === "win32" ? "USERPROFILE" : "HOME"];
const configSuffix = `${isXdg ? "" : "."}vscode${
const configSuffix = `${isXdg || this.isCoderCom ? "" : "."}vscode${
this.isInsiders ? "-insiders" : this.isOss ? "-oss" : ""
}`;

Expand All @@ -84,10 +88,14 @@ export class Environment {
this.PATH = process.env.HOME + "/Library/Application Support";
this.OsType = OsType.Mac;
} else if (process.platform === "linux") {
this.PATH =
isXdg && !!process.env.XDG_CONFIG_HOME
? process.env.XDG_CONFIG_HOME
: os.homedir() + "/.config";
if (!this.isCoderCom) {
this.PATH =
isXdg && !!process.env.XDG_CONFIG_HOME
? process.env.XDG_CONFIG_HOME
: os.homedir() + "/.config";
} else {
this.PATH = "/tmp";
}
this.OsType = OsType.Linux;
} else if (process.platform === "win32") {
this.PATH = process.env.APPDATA;
Expand Down
2 changes: 1 addition & 1 deletion src/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ export class Sync {
const autoUpdate: boolean = vscode.workspace
.getConfiguration("extensions")
.get("autoUpdate");
useCli = autoUpdate;
useCli = autoUpdate && !env.isCoderCom;
if (useCli) {
if (!syncSetting.quietSync) {
Commons.outputChannel = vscode.window.createOutputChannel(
Expand Down

0 comments on commit a71e09b

Please sign in to comment.