Skip to content

Commit

Permalink
🛠 System Lint の実装
Browse files Browse the repository at this point in the history
とは言っても、とりあえず microsoft/vscode#16261 の問題についてのみ
  • Loading branch information
wraith13 committed Sep 14, 2018
1 parent e5f8eab commit ec6e99f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to the "sysinfo-vscode" extension will be documented in this

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.

## 1.1.0 - 2018-09-??

### Added

- System Lint ( When system with problems, show warnings section. )

## 1.0.2 - 2018-09-13

### Fixed
Expand Down
14 changes: 13 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export module SysInfo
"version": thisExtension && thisExtension.packageJSON.version,
"options": options,
},
"warning": undefined, // 表示位置をここにする為に undefined で事前挿入
"os": 0 <= options.categories.indexOf("basic") ?
{
"arch": os.arch(),
Expand Down Expand Up @@ -128,6 +129,15 @@ export module SysInfo
}
);
}
export function systemLint(information : any) : any
{
if ("darwin" === information["os"]["platform"] && undefined === information["process"]["env"]["LANG"])
{
information["warnings"] = information["warnings"] || { };
information["warnings"]["W001"] = "LANG environment variable is empty. Clipboard related extensions do not work correctly with Non-ASCII characters. To avoid this problem, you should launch vscode from Terminal.app. See <https://github.com/Microsoft/vscode/issues/16261>.";
}
return information;
}
async function openNewTextDocument(language : string) : Promise<vscode.TextDocument>
{
return await vscode.workspace.openTextDocument({ language });
Expand Down Expand Up @@ -190,6 +200,7 @@ export module SysInfo
withInternalExtensions: isFull,
}
);
systemLint(information);
const format = await vscode.window.showQuickPick
(
[
Expand Down Expand Up @@ -352,9 +363,10 @@ export module SysInfo
makeMarkdownHeader(1, "VS Code System Information"),
`timestamp: ${information["timestamp"]}\n`,
makeMarkdown(information["provider"], 2, "Information Provider", true),
makeMarkdown(information["warnings"], 2, "Warnings"),
makeMarkdown(information["os"], 2, "OS Information"),
makeMarkdown(information["process"], 2, "Process Information"),
makeMarkdown(information["vscode"], 2, "VS Code Information", true),
makeMarkdown(information["vscode"], 2, "VS Code Information", true),
]
.filter(i => undefined !== i)
.join("\n");
Expand Down

0 comments on commit ec6e99f

Please sign in to comment.