Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
nonoroazoro committed Jan 30, 2019
2 parents 5ec27fa + 2dfbef8 commit 672ddbc
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 24 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelogs

## 2.1.0 - January 30, 2019

- Added: Add support for different editions of VSCode binaries.

- Changed: Tweak the localizations.


## 2.0.7 - December 03, 2018

- Changed: Syncing will remain deactivated until you execute any of its commands.
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@

## Breaking Changes

* From ***version 2.0.0*** onwards:
* From ***version 2.1.0*** onwards:

1. Add support for `i18n (internationalization)`. `Syncing` is now shipped with `English` and `Simplified Chinese`.
1. Add support for different editions of VSCode binaries as the followings:

> Don't forget to install the [Chinese (Simplified) Language Pack](https://marketplace.visualstudio.com/items?itemName=MS-CEINTL.vscode-language-pack-zh-hans) if you changed the locale to `Simplified Chinese`.
1. [The VSCode Standard](https://code.visualstudio.com/).

1. Accelerate the startup speed of `Syncing`, nearly `3 times faster` than before (may vary depending on your hardware).
1. [The VSCode Insiders](https://code.visualstudio.com/insiders/).

1. The VSCode under FLOSS license, see [VSCodium](https://github.com/VSCodium/vscodium).

> Don't worry, Syncing will automatically identify the VSCode edition for you.

## Features
Expand Down
12 changes: 8 additions & 4 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@

## 重要变更

****2.0.0*** 版本开始:
****2.1.0*** 版本开始:

1. 加入`国际化`,目前支持`英语``简体中文`
1. 支持更多版本的 VSCode,包括:

> 注意:切换为`简体中文`时请务必安装微软官方提供的[简体中文语言包](https://marketplace.visualstudio.com/items?itemName=MS-CEINTL.vscode-language-pack-zh-hans)
1. [VSCode 标准版本](https://code.visualstudio.com/)

1. `Syncing` 的启动速度将会提高 `3 倍左右`(取决于您的硬件)。
1. [VSCode Insiders 版本](https://code.visualstudio.com/insiders/)

1. [VSCodium](https://github.com/VSCodium/vscodium),这是 [FLOSS License](https://www.gnu.org/philosophy/floss-and-foss.en.html) 下的一个 VSCode 版本。

> 无须担心,升级之后 Syncing 会自动帮您检测 VSCode 版本。

## 功能
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "syncing",
"displayName": "%displayName%",
"description": "%description%",
"version": "2.0.7",
"version": "2.1.0",
"publisher": "nonoroazoro",
"author": {
"email": "xiaochao.k@gmail.com",
Expand Down
3 changes: 2 additions & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
"error.check.internet": "Please check your Internet connection or proxy settings.",
"error.no.gist.id": "The Gist ID is not set.",
"error.no.github.token": "The GitHub Personal Access Token is not set.",
"error.env.platform.not.supported": "Your operating system is not supported yet.",
"error.env.unknown.vscode": "Cannot identify the VSCode version.",
"error.extract.extension-1": "Cannot extract extension: {0}. {1}",
"error.extract.extension-2": "Cannot extract extension: {0}. Access temporary directory denied.",
"error.extract.extension-3": "Cannot extract extension: {0}. Extension zip file not found.",
Expand All @@ -54,7 +56,6 @@
"error.loading.settings": "Syncing: Error loading VSCode settings file: {0}.\n{1}",
"error.loading.snippets": "Syncing: Error loading snippets.",
"error.loading.syncing.settings": "Syncing: Error loading Syncing's settings.",
"error.not.supported": "Your operating system is not supported yet.",
"error.remove.file": "Cannot remove file: {0} : {1}",
"error.save.file": "Cannot save file: {0} : {1}",
"error.uninstall.extension": "Cannot uninstall extension: {0}.",
Expand Down
3 changes: 2 additions & 1 deletion package.nls.zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
"error.check.internet": "请检查您的网络连接或代理配置",
"error.no.gist.id": "未设置 Gist ID",
"error.no.github.token": "未设置 GitHub Personal Access Token",
"error.env.platform.not.supported": "暂时还不支持您的操作系统",
"error.env.unknown.vscode": "无法识别当前 VSCode 版本",
"error.extract.extension-1": "无法解压缩扩展: {0}。{1}",
"error.extract.extension-2": "无法解压缩扩展: {0}。访问系统临时目录时被拒绝,请检查您的用户权限",
"error.extract.extension-3": "无法解压缩扩展: {0}。未找到安装扩展所需的压缩文件",
Expand All @@ -54,7 +56,6 @@
"error.loading.settings": "Syncing: 载入 VSCode 配置文件时发生错误: {0}。\n{1}",
"error.loading.snippets": "Syncing: 载入代码片段文件时发生错误",
"error.loading.syncing.settings": "Syncing: 无法载入 Syncing 的配置",
"error.not.supported": "暂时还不支持您的操作系统",
"error.remove.file": "无法删除文件: {0} : {1}",
"error.save.file": "无法保存文件: {0} : {1}",
"error.uninstall.extension": "无法卸载扩展: {0}",
Expand Down
47 changes: 34 additions & 13 deletions src/core/Environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,48 @@ export class Environment
{
private static _instance: Environment;

/**
* The builtin-environments of different VSCode versions.
*
* Note: The key will be matched with the `vscode.env.appName`, contains the followings:
*
* 1. The VSCode Standard;
* 2. The VSCode Insiders;
* 3. The VSCode under FLOSS license, see [VSCodium](https://github.com/VSCodium/vscodium).
*/
private static _codeEnvironments = {
"Visual Studio Code": {
extensionsDirectoryName: ".vscode",
dataDirectoryName: "Code"
},
"Visual Studio Code - Insiders": {
extensionsDirectoryName: ".vscode-insiders",
dataDirectoryName: "Code - Insiders"
},
"VSCodium": {
extensionsDirectoryName: ".vscode-oss",
dataDirectoryName: "VSCodium"
}
};

private _codeMap: { extensionsDirectoryName: string; dataDirectoryName: string; };
private _codeDataDirectory: string;
private _codeUserDirectory: string;
private _extensionsDirectory: string;
private _isInsiders: boolean;
private _isMac: boolean;
private _isPortable: boolean;
private _snippetsDirectory: string;

private constructor()
{
// Note that the followings are order-sensitive.
this._codeMap = Environment._codeEnvironments[vscode.env.appName];
if (!this._codeMap)
{
// Unknown VSCode version.
throw new Error(localize("error.env.unknown.vscode"));
}
this._isMac = process.platform === "darwin";
this._isInsiders = vscode.version.indexOf("insider") >= 0;
this._isPortable = process.env.VSCODE_PORTABLE != null;

this._extensionsDirectory = this._getCodeExtensionsDirectory();
Expand Down Expand Up @@ -53,14 +82,6 @@ export class Environment
return this._isMac;
}

/**
* Gets a value indicating whether the VSCode is an `Insiders` version.
*/
public get isInsiders(): boolean
{
return this._isInsiders;
}

/**
* Gets a value indicating whether the VSCode is running in `Portable Mode`.
*/
Expand Down Expand Up @@ -144,7 +165,7 @@ export class Environment
}
return path.join(
os.homedir(),
this.isInsiders ? ".vscode-insiders" : ".vscode",
this._codeMap.extensionsDirectoryName,
"extensions"
);
}
Expand Down Expand Up @@ -174,8 +195,8 @@ export class Environment

default:
// Unknown platform.
throw new Error(localize("error.not.supported"));
throw new Error(localize("error.env.platform.not.supported"));
}
return path.join(baseDirectory, this.isInsiders ? "Code - Insiders" : "Code");
return path.join(baseDirectory, this._codeMap.dataDirectoryName);
}
}

0 comments on commit 672ddbc

Please sign in to comment.