├── .gitattributes ├── .gitignore ├── .vscode ├── launch.json ├── settings.json └── tasks.json ├── .vscodeignore ├── CHANGELOG.md ├── LICENSE_1_0.txt ├── README.ja.md ├── README.md ├── images ├── infohex.1024.png ├── infohex.128.png ├── infohex.ico ├── screenshot.png └── screenshot2.png ├── package-lock.json ├── package.json ├── package.nls.ja.json ├── package.nls.json ├── source └── extension.ts ├── test ├── extension.test.ts └── index.ts ├── tsconfig.json └── tslint.json /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | node_modules 3 | .history 4 | .vscode-test 5 | private 6 | desktop.ini 7 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that compiles the extension and then opens it inside a new window 2 | { 3 | "version": "0.1.0", 4 | "configurations": [ 5 | { 6 | "name": "Launch Extension", 7 | "type": "extensionHost", 8 | "request": "launch", 9 | "runtimeExecutable": "${execPath}", 10 | "args": ["--extensionDevelopmentPath=${workspaceRoot}" ], 11 | "stopOnEntry": false, 12 | "sourceMaps": true, 13 | "outFiles": [ "${workspaceRoot}/out/source/**/*.js" ], 14 | "preLaunchTask": "npm" 15 | }, 16 | { 17 | "name": "Launch Tests", 18 | "type": "extensionHost", 19 | "request": "launch", 20 | "runtimeExecutable": "${execPath}", 21 | "args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ], 22 | "stopOnEntry": false, 23 | "sourceMaps": true, 24 | "outFiles": [ "${workspaceRoot}/out/test/**/*.js" ], 25 | "preLaunchTask": "npm" 26 | } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "workbench.colorCustomizations": { 3 | "titleBar.foreground": "#FFF6DE", 4 | "titleBar.background": "#967825", 5 | "statusBarItem.hoverForeground": "#100018", 6 | "statusBarItem.hoverBackground": "#3F510B", 7 | "activityBar.foreground": "#FFA5D6", 8 | "activityBar.background": "#2A0017", 9 | "activityBar.inactiveForeground": "#83197A", 10 | "activityBarBadge.foreground": "#020000", 11 | "activityBarBadge.background": "#FB8667", 12 | "statusBar.foreground": "#F4E386", 13 | "statusBar.background": "#716004", 14 | "statusBarItem.remoteForeground": "#BAFF8B", 15 | "statusBarItem.remoteBackground": "#377D08", 16 | "statusBar.debuggingForeground": "#000000", 17 | "statusBar.debuggingBackground": "#A8973A" 18 | } 19 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | // Available variables which can be used inside of strings. 2 | // ${workspaceRoot}: the root folder of the team 3 | // ${file}: the current opened file 4 | // ${fileBasename}: the current opened file's basename 5 | // ${fileDirname}: the current opened file's dirname 6 | // ${fileExtname}: the current opened file's extension 7 | // ${cwd}: the current working directory of the spawned process 8 | 9 | // A task runner that calls a custom npm script that compiles the extension. 10 | { 11 | "version": "2.0.0", 12 | 13 | // we want to run npm 14 | "command": "npm", 15 | 16 | // we run the custom script "compile" as defined in package.json 17 | "args": ["run", "compile", "--loglevel", "silent"], 18 | 19 | // The tsc compiler is started in watching mode 20 | "isWatching": true, 21 | 22 | // use the standard tsc in watch mode problem matcher to find compile problems in the output. 23 | "problemMatcher": "$tsc-watch", 24 | "tasks": [ 25 | { 26 | "label": "npm", 27 | "type": "shell", 28 | "command": "npm", 29 | "args": [ 30 | "run", 31 | "compile", 32 | "--loglevel", 33 | "silent" 34 | ], 35 | "isBackground": true, 36 | "problemMatcher": "$tsc-watch", 37 | "group": { 38 | "_id": "build", 39 | "isDefault": false 40 | } 41 | } 42 | ] 43 | } -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | out/test/** 4 | test/** 5 | source/** 6 | **/*.map 7 | .gitattributes 8 | .gitignore 9 | tsconfig.json 10 | vsc-extension-quickstart.md 11 | images/screenshot.png 12 | images/screenshot2.png 13 | images/infohex.1024.png 14 | images/infohex.ico 15 | .history/** 16 | private/** 17 | tsconfig.json 18 | tslint.json 19 | desktop.ini 20 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to the "sysinfo-vscode" extension will be documented in this file. 4 | 5 | Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. 6 | 7 | ## 2.6.0 - 2023-07-23 8 | 9 | ### Added 10 | 11 | - Support multiple(array) specification in `sysinfo.statusBarLabel` configuration 12 | - `sysinfo.statusBarSwitchInterval` configuration 13 | - `sysinfo.statusBarCommand` configuration 14 | - `System Information: Copy Status bar Text` Command 15 | - `System Information: Switch Status bar Label` Command 16 | 17 | ## 2.5.1 - 2023-07-05 18 | 19 | ### Removed 20 | 21 | - VSMarketplaceBadges in README.md. ( To avoid an issue where updates cannot be released to the marketplace due to a VSMarketplaceBadges server failure. ) 22 | 23 | ## 2.5.0 - 2023-07-05 24 | 25 | ### Added 26 | 27 | - Support for configuration information in `sysinfo.statusBarLabel`. [#8](https://github.com/wraith13/sysinfo-vscode/issues/8) 28 | 29 | ### Security 30 | 31 | - `npm audit fix`ed. 32 | 33 | ## 2.4.3 - 2022-07-12 34 | 35 | ### Changed 36 | 37 | - `activationEvents`: `*` -> `onStartupFinished` 38 | 39 | ## 2.4.2 - 2022-07-12 40 | 41 | ### Added 42 | 43 | - Also released on [github.com](https://github.com/wraith13/sysinfo-vscode/releases) 44 | - VSIX download link in README.md 45 | 46 | ### Security 47 | 48 | - `npm audit fix`ed. 49 | 50 | ## 2.4.1 - 2020-10-09 51 | 52 | ### Changed 53 | 54 | - Refactoring. ( The behavior does not change. ) 55 | 56 | ## 2.4.0 - 2020-09-14 57 | 58 | ### Added 59 | 60 | - Increased `System Information: Show Schema` Command's schema presets. ( `vscode://schemas/settings/workspace`, `vscode://schemas/icons` ) 61 | 62 | ### Removed 63 | 64 | - Decreased `System Information: Show Schema` Command's schema presets. ( `vscode://schemas/ignoredExtensions` ) 65 | 66 | ## 2.3.0 - 2020-08-20 67 | 68 | ### Added 69 | 70 | - Increased `System Information: Show Schema` Command's schema presets. 71 | 72 | ## 2.2.0 - 2020-08-10 73 | 74 | ### Added 75 | 76 | - Increased `System Information: Show Schema` Command's schema presets. 77 | 78 | ## 2.1.0 - 2020-08-09 79 | 80 | ### Added 81 | 82 | - Increased `System Information: Show Schema` Command's schema presets. 83 | 84 | ## 2.0.0 - 2020-06-10 85 | 86 | ### Changed 87 | 88 | - `System Information: Show Scheme` Command -> `System Information: Show Schema` Command 89 | 90 | ## 1.4.0 - 2020-06-09 91 | 92 | ### Added 93 | 94 | - `System Information: Show Scheme` Command 95 | 96 | ### Security 97 | 98 | - `npm audit fix`ed. 99 | 100 | ## 1.3.0 - 2020-02-01 101 | 102 | ### Security 103 | 104 | - `npm audit fix`ed. ( https-proxy-agent v2.2.2 -> v2.2.4 ) 105 | 106 | ## 1.3.0 - 2019-08-04 107 | 108 | ### Added 109 | 110 | - show customizable information in status bar 111 | 112 | ## 1.2.3 - 2018-12-30 113 | 114 | ### Fixed 115 | 116 | - update internal packages because secrity reason 117 | 118 | ## 1.2.2 - 2018-12-30 119 | 120 | ### Fixed 121 | 122 | - fixed that option specification not work bugs in Japanese Environment 123 | 124 | ## 1.2.1 - 2018-10-02 125 | 126 | ### Fixed 127 | 128 | - fixed multi-language support bugs 129 | 130 | ## 1.2.0 - 2018-10-02 131 | 132 | ### Added 133 | 134 | - support Japanese 135 | 136 | ## 1.1.2 - 2018-09-25 137 | 138 | ### Fixed 139 | 140 | - fixed section name of extension without displayName in markdown. 141 | 142 | ## 1.1.1 - 2018-09-16 143 | 144 | ### Fixed 145 | 146 | - fixed description mistake in CHANGE.md 147 | 148 | ## 1.1.0 - 2018-09-16 149 | 150 | ### Added 151 | 152 | - System Lint ( When system with problems, show warnings section. ) 153 | - `sysinfo.hideItems` configuration 154 | 155 | ## 1.0.2 - 2018-09-13 156 | 157 | ### Fixed 158 | 159 | - fixed markdown \\ escape problem. 160 | 161 | ### Removed 162 | 163 | - Removed internal extensions links. ( because link destination does not exist ) 164 | - Removed images/infohex.1024.png from package. 165 | 166 | ## 1.0.1 - 2018-09-12 167 | 168 | ### Fixed 169 | 170 | - Version number problem. ( 0.0.0 → 0.0.1 ) 171 | 172 | ## 1.0.0 - 2018-09-12 173 | 174 | ### Added 175 | 176 | - Initial release of System Information. 177 | 178 | ## [Unreleased] 179 | 180 | ## 0.0.0 - 2018-09-10 181 | 182 | ### Added 183 | 184 | - Start this project. 185 | -------------------------------------------------------------------------------- /LICENSE_1_0.txt: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /README.ja.md: -------------------------------------------------------------------------------- 1 | # システム情報 README ( [🇬🇧 English](https://github.com/wraith13/sysinfo-vscode/blob/master/README.md) ) 2 | 3 | VS Code のシステム情報(拡張一覧を含む)を markdown あるいは JSON で表示します。 4 | 5 | ## 機能 6 | 7 | `System Information: Show` コマンドで VS Code のシステム情報(拡張一覧を含む)を markdown あるいは JSON で表示します。 8 | 9 | ![screen shot](./images/screenshot.png) 10 | 11 | また、ステータスバーでカスタマイズ可能な情報を表示します。 12 | 13 | ![status bar item](./images/screenshot2.png) 14 | 15 | ## チュートリアル 16 | 17 | ### 0. ⬇️ システム情報拡張のインストール 18 | 19 | VS Code の拡張サイドバーを出して(Mac:Command+Shift+X, Windows and Linux: Ctrl+Shift+X)、 `sysinfo-vscode` とタイプし Enter キーを押下し、インストール をクリックします。インストールが終わったら VS Code を再起動してください。 20 | 21 | ### 1. ✨️ システム情報の表示 22 | 23 | コマンドパレットを出して(Mac:F1 or Shift+Command+P, Windows and Linux: F1 or Shift+Ctrl+P)、 `System Information: Show` コマンドを実行し、あなたの好きなオプションを選択します。 24 | 25 | ### 2. 🔧 次のステップ 26 | 27 | `settings.json` で システム情報 の[設定](#拡張の設定)を変更できます。 28 | 29 | ### コマンドリスト 30 | 31 | * `System Information: Show` : システム情報を表示します 32 | * `System Information: Show Schema` : VS Code の各種スキーマを表示します 33 | * `System Information: Copy Status bar Text` : ステータスバーテキストをコピーします 34 | * `System Information: Switch Status bar Label` : ステータスバーラベルを切り替えます 35 | 36 | ## 拡張の設定 37 | 38 | [`settings.json`](https://code.visualstudio.com/docs/customization/userandworkspace#_creating-user-and-workspace-settings)( Mac: Command+,, Windows / Linux: ファイル基本設定設定 ) で次の設定ができます。 39 | 40 | * `sysinfo.enabledStatusBar`: ステータスバー項目の有効/無効 41 | * `sysinfo.statusBarLabel`: ステータスバー項目のラベル ( 配列で複数指定する事もできます。 ) 42 | * `sysinfo.statusBarSwitchInterval`: ステータスバー項目の切り替え間隔(ms) 43 | * `sysinfo.statusBarCommand`: ステータスバー項目のクリックコマンド ( 他のコマンドも設定できますが、 "sysinfo-vscode.switchStatusBarLabel" あるいは "sysinfo-vscode.copyStatusBarText" が設定される事を前提としています。 ) 44 | * `sysinfo.hideItems`: 隠す項目の一覧を設定します 45 | 46 | 指定した項目を隠すことができます。下のサンプルを参照してください。 47 | 48 | ```json 49 | "sysinfo.hideItems": [ 50 | "timestamp", 51 | "provider", 52 | "warnings.W001", 53 | "vscode.env", 54 | "vscode.extensions.*.packageJSON.description" 55 | ] 56 | ``` 57 | 58 | 次の構文でラベルのテキストにはアイコンを埋め込む事ができます。 59 | 60 | ` $(アイコンの名前) こんな感じで私のテキスト $(icon-name) はアイコンを含める事ができます。` 61 | 62 | icon-name は [codicons](https://microsoft.github.io/vscode-codicons/dist/codicon.html) のアイコンセットから選びます。例: `light-bulb`, `thumbsup`, `zap` etc. 63 | 64 | あなたは UNICODE 文字 ( 絵文字を含む )をラベルのテキストに指定することもできます。 65 | 66 | ### `sysinfo.statusBarLabel` 設定サンプル 67 | 68 | * `$(info) VS Code ${vscode.version}` ( default ) 69 | * `$(info) ${vscode.env.appName} ${vscode.version} ${vscode.env.language} ${process.execArgv}` 70 | * `$(device-desktop) ${os.hostname}` 71 | * `$(symbol-color) ${settings:workbench.colorTheme}` 72 | * `$(text-size) ${settings:editor.fontSize}` 73 | 74 | 配列で複数指定する事もできます。 75 | 76 | ## リリースノート 77 | 78 | [marketplace](https://marketplace.visualstudio.com/items/wraith13.sysinfo-vscode/changelog) あるいは [github](https://github.com/wraith13/sysinfo-vscode/blob/master/CHANGELOG.md) の ChangLog を参照してください。 79 | 80 | ## サポート 81 | 82 | [GitHub Issues](https://github.com/wraith13/sysinfo-vscode/issues) 83 | 84 | ## ライセンス 85 | 86 | [Boost Software License](https://github.com/wraith13/sysinfo-vscode/blob/master/LICENSE_1_0.txt) 87 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # System Information README ( [🇯🇵 Japanese](https://github.com/wraith13/sysinfo-vscode/blob/master/README.ja.md) ) 2 | 3 | Show system information ( includes extensions list ) by markdown or JSON for vscode. 4 | 5 | ## Features 6 | 7 | `System Information: Show` command shows Visual Studio Code system information ( includes extensions list ) by markdown or JSON. 8 | 9 | ![screen shot](./images/screenshot.png) 10 | 11 | And show customizable information in status bar. 12 | 13 | ![status bar item](./images/screenshot2.png) 14 | 15 | ## Tutorial 16 | 17 | ### 0. ⬇️ Install System Information 18 | 19 | Show extension side bar within VS Code(Mac:Command+Shift+X, Windows and Linux: Ctrl+Shift+X), type `sysinfo-vscode` and press Enter and click Install. Restart VS Code when installation is completed. 20 | 21 | ### 1. ✨️ Show System Information 22 | 23 | Launch Command Palette(Mac:F1 or Shift+Command+P, Windows and Linux: F1 or Shift+Ctrl+P), Execute `System Information: Show` command and select options as you like. 24 | 25 | ### 2. 🔧 Next step 26 | 27 | You can change [settings](#extension-settings) by `settings.json`. 28 | 29 | Enjoy! 30 | 31 | ## Commands 32 | 33 | * `System Information: Show` : show system information 34 | * `System Information: Show Schema` : show VS Code schemas 35 | * `System Information: Copy Status bar Text` : copy status bar text 36 | * `System Information: Switch Status bar Label` : switch status bar label 37 | 38 | ## Extension Settings 39 | 40 | This extension contributes the following settings by [`settings.json`](https://code.visualstudio.com/docs/customization/userandworkspace#_creating-user-and-workspace-settings)( Mac: Command+,, Windows / Linux: File -> Preferences -> User Settings ): 41 | 42 | * `sysinfo.enabledStatusBar`: set Enable/Disable status bar item 43 | * `sysinfo.statusBarLabel`: status bar item's label ( You can also specify multiple in an array. ) 44 | * `sysinfo.statusBarSwitchInterval`: status bar item's switch interval(ms) 45 | * `sysinfo.statusBarCommand`: status bar item's command on click ( Other commands can be set as well, but assume "sysinfo-vscode.switchStatusBarLabel" or "sysinfo-vscode.copyStatusBarText" is set. ) 46 | * `sysinfo.hideItems`: set list of hide items 47 | 48 | You can hide the specified items. see below example. 49 | 50 | ```json 51 | "sysinfo.hideItems": [ 52 | "timestamp", 53 | "provider", 54 | "warnings.W001", 55 | "vscode.env", 56 | "vscode.extensions.*.packageJSON.description" 57 | ] 58 | ``` 59 | 60 | You can embed icons in the label text( `sysinfo.statusBarLabel` ) by leveraging the syntax: 61 | 62 | `My text $(icon-name) contains icons like $(icon'name) this one.` 63 | 64 | Where the icon-name is taken from the [codicons](https://microsoft.github.io/vscode-codicons/dist/codicon.html) icon set, e.g. `light-bulb`, `thumbsup`, `zap` etc. 65 | 66 | You can specify unicode characters ( include emoji ) as label text too. 67 | 68 | ### `sysinfo.statusBarLabel` setting examples 69 | 70 | * `$(info) VS Code ${vscode.version}` ( default ) 71 | * `$(info) ${vscode.env.appName} ${vscode.version} ${vscode.env.language} ${process.execArgv}` 72 | * `$(device-desktop) ${os.hostname}` 73 | * `$(symbol-color) ${settings:workbench.colorTheme}` 74 | * `$(text-size) ${settings:editor.fontSize}` 75 | 76 | You can also specify multiple in an array. 77 | 78 | ## Release Notes 79 | 80 | see ChangLog on [marketplace](https://marketplace.visualstudio.com/items/wraith13.sysinfo-vscode/changelog) or [github](https://github.com/wraith13/sysinfo-vscode/blob/master/CHANGELOG.md) 81 | 82 | ## Support 83 | 84 | [GitHub Issues](https://github.com/wraith13/sysinfo-vscode/issues) 85 | 86 | ## License 87 | 88 | [Boost Software License](https://github.com/wraith13/sysinfo-vscode/blob/master/LICENSE_1_0.txt) 89 | 90 | ## Download VSIX file ( for VS Code compatible softwares ) 91 | 92 | [Releases · wraith13/sysinfo-vscode](https://github.com/wraith13/sysinfo-vscode/releases) 93 | 94 | ## Other extensions of wraith13's work 95 | 96 | |Icon|Name|Description| 97 | |---|---|---| 98 | |![](https://wraith13.gallerycdn.vsassets.io/extensions/wraith13/bracket-lens/1.0.0/1603272166087/Microsoft.VisualStudio.Services.Icons.Default) |[Bracket Lens](https://marketplace.visualstudio.com/items?itemName=wraith13.bracket-lens)|Show bracket header on closing bracket.| 99 | |![](https://wraith13.gallerycdn.vsassets.io/extensions/wraith13/background-phi-colors/3.1.0/1581619161244/Microsoft.VisualStudio.Services.Icons.Default) |[Background Phi Colors](https://marketplace.visualstudio.com/items?itemName=wraith13.background-phi-colors)|This extension colors the background in various ways.| 100 | |![](https://wraith13.gallerycdn.vsassets.io/extensions/wraith13/blitz/1.6.0/1598232590017/Microsoft.VisualStudio.Services.Icons.Default) |[Blitz](https://marketplace.visualstudio.com/items?itemName=wraith13.blitz)|Provide a quick and comfortable way to change settings by quick pick based UI.| 101 | 102 | See all wraith13's expansions: 103 | -------------------------------------------------------------------------------- /images/infohex.1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wraith13/sysinfo-vscode/b3468935056e11f49a915bd03c02ed9d64ee058c/images/infohex.1024.png -------------------------------------------------------------------------------- /images/infohex.128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wraith13/sysinfo-vscode/b3468935056e11f49a915bd03c02ed9d64ee058c/images/infohex.128.png -------------------------------------------------------------------------------- /images/infohex.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wraith13/sysinfo-vscode/b3468935056e11f49a915bd03c02ed9d64ee058c/images/infohex.ico -------------------------------------------------------------------------------- /images/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wraith13/sysinfo-vscode/b3468935056e11f49a915bd03c02ed9d64ee058c/images/screenshot.png -------------------------------------------------------------------------------- /images/screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wraith13/sysinfo-vscode/b3468935056e11f49a915bd03c02ed9d64ee058c/images/screenshot2.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sysinfo-vscode", 3 | "displayName": "System Information", 4 | "description": "Show system information ( includes extensions list ) by markdown or JSON for VS Code", 5 | "icon": "images/infohex.128.png", 6 | "version": "2.6.0", 7 | "publisher": "wraith13", 8 | "readme": "README.md", 9 | "license": "SEE LICENSE IN LICENSE_1_0.txt", 10 | "engines": { 11 | "vscode": "^1.45.0" 12 | }, 13 | "bugs": { 14 | "url": "https://github.com/wraith13/sysinfo-vscode/issues" 15 | }, 16 | "homepage": "https://github.com/wraith13/sysinfo-vscode", 17 | "repository": { 18 | "type": "git", 19 | "url": "https://github.com/wraith13/sysinfo-vscode.git" 20 | }, 21 | "categories": [ 22 | "Other" 23 | ], 24 | "keywords": [ 25 | "vscode", 26 | "system", 27 | "system information", 28 | "extensions", 29 | "extensions list" 30 | ], 31 | "activationEvents": [ 32 | "onStartupFinished" 33 | ], 34 | "main": "./out/source/extension", 35 | "contributes": { 36 | "commands": [ 37 | { 38 | "command": "sysinfo-vscode.showSystemInformation", 39 | "title": "%sysinfo-vscode.showSystemInformation.title%", 40 | "category": "%sysinfo-vscode.title%" 41 | }, 42 | { 43 | "command": "sysinfo-vscode.showSchema", 44 | "title": "%sysinfo-vscode.showSchema.title%", 45 | "category": "%sysinfo-vscode.title%" 46 | }, 47 | { 48 | "command": "sysinfo-vscode.copyStatusBarText", 49 | "title": "%sysinfo-vscode.copyStatusBarText.title%", 50 | "category": "%sysinfo-vscode.title%" 51 | }, 52 | { 53 | "command": "sysinfo-vscode.switchStatusBarLabel", 54 | "title": "%sysinfo-vscode.switchStatusBarLabel.title%", 55 | "category": "%sysinfo-vscode.title%" 56 | } 57 | ], 58 | "configuration": [ 59 | { 60 | "title": "%sysinfo-vscode.title%", 61 | "properties": { 62 | "sysinfo.enabledStatusBar": { 63 | "type": "boolean", 64 | "default": true, 65 | "description": "%sysinfo-vscode.statusBar.enabled.description%" 66 | }, 67 | "sysinfo.statusBarLabel": { 68 | "type": [ "string", "array"], 69 | "default": [ 70 | "$(info) VS Code ${vscode.version}", 71 | "$(device-desktop) ${os.hostname}", 72 | "$(symbol-color) ${settings:workbench.colorTheme}" 73 | ], 74 | "description": "%sysinfo-vscode.statusBar.label.description%", 75 | "items": 76 | { 77 | "type": "string" 78 | } 79 | }, 80 | "sysinfo.statusBarSwitchInterval": { 81 | "type": "number", 82 | "default": 0, 83 | "description": "%sysinfo-vscode.statusBar.SwitchInterval.description%", 84 | "minimum": 0 85 | }, 86 | "sysinfo.statusBarCommand": { 87 | "type": "string", 88 | "default": "sysinfo-vscode.switchStatusBarLabel", 89 | "description": "%sysinfo-vscode.statusBar.command.description%" 90 | }, 91 | "sysinfo.hideItems": { 92 | "type": "array", 93 | "items": { 94 | "type": "string" 95 | }, 96 | "default": [], 97 | "description": "%sysinfo-vscode.hideItems.description%" 98 | } 99 | } 100 | } 101 | ] 102 | }, 103 | "scripts": { 104 | "vscode:prepublish": "npm run compile", 105 | "compile": "tsc -p ./", 106 | "lint": "eslint source --ext ts", 107 | "watch": "tsc -watch -p ./", 108 | "pretest": "npm run compile && npm run lint", 109 | "test": "node ./out/test/runTest.js" 110 | }, 111 | "dependencies": { 112 | "@wraith13/vscel": "^0.0.54" 113 | }, 114 | "devDependencies": { 115 | "@types/glob": "^7.1.1", 116 | "@types/mocha": "^7.0.2", 117 | "@types/node": "^13.11.0", 118 | "@types/vscode": "^1.45.0", 119 | "@typescript-eslint/eslint-plugin": "^2.30.0", 120 | "@typescript-eslint/parser": "^2.30.0", 121 | "eslint": "^8.44.0", 122 | "glob": "^7.1.6", 123 | "mocha": "^10.2.0", 124 | "typescript": "^3.8.3", 125 | "vscode-test": "^1.3.0" 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /package.nls.ja.json: -------------------------------------------------------------------------------- 1 | { 2 | "sysinfo-vscode.statusBar.enabled.description": "ステータスバー項目の有効/無効", 3 | "sysinfo-vscode.statusBar.label.description": "ステータスバー項目のラベル", 4 | "sysinfo-vscode.statusBar.SwitchInterval.description": "ステータスバー項目の切り替え間隔(ms)", 5 | "sysinfo-vscode.statusBar.command.description": "ステータスバー項目のクリックコマンド ( 他のコマンドも設定できますが、 \"sysinfo-vscode.switchStatusBarLabel\" あるいは \"sysinfo-vscode.copyStatusBarText\" が設定される事を前提としています。 )", 6 | "sysinfo-vscode.title": "システム情報", 7 | "sysinfo-vscode.showSystemInformation.title": "表示", 8 | "sysinfo-vscode.showSchema.title": "スキームを表示", 9 | "sysinfo-vscode.copyStatusBarText.title": "ステータスバーテキストをコピー", 10 | "sysinfo-vscode.switchStatusBarLabel.title": "ステータスバーラベルを切り替え", 11 | "sysinfo-vscode.hideItems.description": "隠す項目の一覧 ( README を参照 )", 12 | "W001": "LANG 環境変数が設定されていません。クリップボードに関連した拡張で非ASCIIな文字が正常に機能しません。この問題を避ける為、 VS Code は Terminal.app から起動してください。こちらを参照 。", 13 | "BasicInfo.label": "基本システム情報 ( Basic System Information )", 14 | "FullInfo.label": "全システム情報 ( Full System Information )", 15 | "FullInfo.description": "デリケートな情報を含む為、公開しない事をお勧めします。", 16 | "selectCategories.placeHolder": "カテゴリオプションを選択してください", 17 | "selectFormat.placeHolder": "形式を選択してください", 18 | "link.marketplace.label": "marketplace で開く", 19 | "link.vscode.label": "VS Code で開く", 20 | "Click to copy": "クリックでコピー", 21 | "Click to switch": "クリックで切り替え", 22 | "Click to execute": "クリックで実行", 23 | "Input a scheme URI to show": "URI で入力してスキーマを表示" 24 | } 25 | -------------------------------------------------------------------------------- /package.nls.json: -------------------------------------------------------------------------------- 1 | { 2 | "sysinfo-vscode.statusBar.enabled.description": "Enable/Disable status bar item", 3 | "sysinfo-vscode.statusBar.label.description": "Status bar item's label ( You can also specify multiple in an array. )", 4 | "sysinfo-vscode.statusBar.SwitchInterval.description": "Status bar item's switch interval(ms)", 5 | "sysinfo-vscode.statusBar.command.description": "Status bar item's command on click ( Other commands can be set as well, but assume \"sysinfo-vscode.switchStatusBarLabel\" or \"sysinfo-vscode.copyStatusBarText\" is set. )", 6 | "sysinfo-vscode.title": "System Information", 7 | "sysinfo-vscode.showSystemInformation.title": "Show", 8 | "sysinfo-vscode.showSchema.title": "Show Schema", 9 | "sysinfo-vscode.copyStatusBarText.title": "Copy Status bar Text", 10 | "sysinfo-vscode.switchStatusBarLabel.title": "Switch Status bar Label", 11 | "sysinfo-vscode.hideItems.description": "list of hide items ( see README )", 12 | "W001": "LANG environment variable is empty. Clipboard related extensions do not work correctly with Non-ASCII characters. To avoid this problem, you should launch VS Code from Terminal.app. See .", 13 | "BasicInfo.label": "Basic System Information", 14 | "FullInfo.label": "Full System Information", 15 | "FullInfo.description": "Becouse this data include sensitive data, recommend to keep private.", 16 | "selectCategories.placeHolder": "Select categories option", 17 | "selectFormat.placeHolder": "Select a format", 18 | "link.marketplace.label": "open in marketplace", 19 | "link.vscode.label": "open in VS Code", 20 | "Click to copy": "Click to copy", 21 | "Click to switch": "Click to switch", 22 | "Click to execute": "Click to execute", 23 | "Input a scheme URI to show": "Input a scheme URI to show" 24 | } 25 | -------------------------------------------------------------------------------- /source/extension.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | import * as vscode from 'vscode'; 3 | import * as os from 'os'; 4 | import * as vscel from '@wraith13/vscel'; 5 | import packageJson from "../package.json"; 6 | import localeEn from "../package.nls.json"; 7 | import localeJa from "../package.nls.ja.json"; 8 | const locale = vscel.locale.make(localeEn, { "ja": localeJa, }); 9 | export module SysInfo 10 | { 11 | module Config 12 | { 13 | export const root = vscel.config.makeRoot(packageJson); 14 | export const enabledStatusBar = root.makeEntry("sysinfo.enabledStatusBar", "root-workspace"); 15 | export const hideItems = root.makeEntry("sysinfo.hideItems", "root-workspace"); 16 | export const statusBarLabel = root.makeEntry("sysinfo.statusBarLabel", "root-workspace"); 17 | export const statusBarSwitchInterval = root.makeEntry("sysinfo.statusBarSwitchInterval", "root-workspace"); 18 | export const statusBarCommand = root.makeEntry("sysinfo.statusBarCommand", "root-workspace"); 19 | } 20 | const copyCommandName = 'sysinfo-vscode.copyStatusBarText'; 21 | const switchCommandName = 'sysinfo-vscode.switchStatusBarLabel'; 22 | let statusBarItem: vscode.StatusBarItem; 23 | let statusBarText: string = ""; 24 | let statusBarTextIndex: number = 0; 25 | let statusBarSwitchInterval: NodeJS.Timeout | undefined; 26 | const stringOrJoin = (text: string | string[], separator: string = " ") => 27 | Array.isArray(text) ? text.join(separator): text; 28 | const stringOrAt = (text: string | string[], index: number) => 29 | Array.isArray(text) ? text[index % text.length]: text; 30 | const practicalTypeof = (obj: any): string => 31 | { 32 | if (undefined === obj) 33 | { 34 | return "undefined"; 35 | } 36 | if (null === obj) 37 | { 38 | return "null"; 39 | } 40 | if ("[object Array]" === Object.prototype.toString.call(obj)) 41 | { 42 | return "array"; 43 | } 44 | return typeof obj; 45 | }; 46 | export const initialize = (context: vscode.ExtensionContext): void => 47 | { 48 | context.subscriptions.push 49 | ( 50 | // コマンドの登録 51 | vscode.commands.registerCommand 52 | ( 53 | 'sysinfo-vscode.showSystemInformation', showSystemInformation 54 | ), 55 | vscode.commands.registerCommand 56 | ( 57 | 'sysinfo-vscode.showSchema', showSchema 58 | ), 59 | vscode.commands.registerCommand 60 | ( 61 | copyCommandName, copyStatusBarText 62 | ), 63 | vscode.commands.registerCommand 64 | ( 65 | switchCommandName, switchStatusBarLabel 66 | ), 67 | // ステータスバーアイテムの登録 68 | statusBarItem = vscel.statusbar.createItem 69 | ({ 70 | alignment: vscode.StatusBarAlignment.Right, 71 | command: 'sysinfo-vscode.showSystemInformation', 72 | tooltip: 'exec sysinfo-vscode.showSystemInformation' 73 | }), 74 | // イベントリスナーの登録 75 | vscode.workspace.onDidChangeConfiguration 76 | ( 77 | event => 78 | { 79 | const affectsConfiguration = event.affectsConfiguration("sysinfo"); 80 | if 81 | ( 82 | affectsConfiguration || 83 | ( 84 | Config.enabledStatusBar.get() && 85 | hasSettingKey(stringOrJoin(Config.statusBarLabel.get())) 86 | ) 87 | ) 88 | { 89 | if (affectsConfiguration) 90 | { 91 | updateStatusBarSwitchInterval(); 92 | } 93 | updateStatusBar(); 94 | } 95 | } 96 | ), 97 | vscode.window.onDidChangeActiveTextEditor 98 | ( 99 | _event => 100 | { 101 | if 102 | ( 103 | Config.enabledStatusBar.get() && 104 | hasSettingKey(stringOrJoin(Config.statusBarLabel.get())) 105 | ) 106 | { 107 | updateStatusBar(); 108 | } 109 | } 110 | ), 111 | ); 112 | updateStatusBarSwitchInterval(); 113 | updateStatusBar(); 114 | }; 115 | const lengthWithEscape = (text: string) => text.replace(/\$\([\w-]+\)/g,"@").length; 116 | const substrWithEscape = (text: string, index: number, length: number) => text.replace 117 | ( 118 | /\$\([\w-]+\)/g, 119 | (match, offset) => 120 | { 121 | if (offset < index) 122 | { 123 | index += (match.length -1); 124 | } 125 | else 126 | if (offset < (index +length)) 127 | { 128 | length += (match.length -1); 129 | } 130 | return match; 131 | } 132 | ) 133 | .substr(index, length); 134 | const clipWithEscape = (text: string, maxTextLength: number) => lengthWithEscape(text) <= maxTextLength ? text: substrWithEscape(text, 0, maxTextLength) +"..."; 135 | const updateStatusBarSwitchInterval = () : void => 136 | { 137 | statusBarTextIndex = 0; 138 | if (undefined !== statusBarSwitchInterval) 139 | { 140 | clearInterval(statusBarSwitchInterval); 141 | statusBarSwitchInterval = undefined; 142 | } 143 | const interval = Config.statusBarSwitchInterval.get(); 144 | const statusBarLabel = Config.statusBarLabel.get(); 145 | if (Array.isArray(statusBarLabel) && 1 < statusBarLabel.length && 100 <= interval) 146 | { 147 | statusBarSwitchInterval = setInterval 148 | ( 149 | switchStatusBarLabel, 150 | interval 151 | ); 152 | } 153 | } 154 | const updateStatusBar = () : void => 155 | { 156 | if (Config.enabledStatusBar.get()) 157 | { 158 | statusBarText = developInfomation 159 | ( 160 | stringOrAt(Config.statusBarLabel.get(), statusBarTextIndex), 161 | getSystemInformation 162 | ({ 163 | categories: [ "basic", "cpu", "memory", "network" ], 164 | withSensitiveData: true, 165 | withInternalExtensions: false, 166 | }) 167 | ); 168 | statusBarItem.text = clipWithEscape(statusBarText, 48); 169 | statusBarItem.command = Config.statusBarCommand.get(); 170 | statusBarItem.tooltip = 171 | copyCommandName === statusBarItem.command ? locale.map("Click to copy"): 172 | switchCommandName === statusBarItem.command ? locale.map("Click to switch"): 173 | `${locale.map("Click to execute")}: ${statusBarItem.command}`; 174 | statusBarItem.show(); 175 | } 176 | else 177 | { 178 | statusBarItem.hide(); 179 | } 180 | }; 181 | const copyStatusBarText = () => vscode.env.clipboard.writeText(statusBarText); 182 | const switchStatusBarLabel = () => 183 | { 184 | const statusBarLabel = Config.statusBarLabel.get(); 185 | if (Array.isArray(statusBarLabel) && 1 < statusBarLabel.length) 186 | { 187 | statusBarTextIndex = (statusBarTextIndex +1) %statusBarLabel.length; 188 | updateStatusBar(); 189 | } 190 | }; 191 | const settingsKeyHeader = "settings:"; 192 | const isSettingKey = (key: string) => key.startsWith(settingsKeyHeader); 193 | const hasSettingKey = (source: string) => source.includes(settingsKeyHeader); 194 | const getSettingValue = (key: string) => vscode.workspace.getConfiguration 195 | ( 196 | undefined, 197 | vscode.window.activeTextEditor?.document ?? vscode.workspace.workspaceFolders?.[0] 198 | ).get(key.split(settingsKeyHeader)[1]); 199 | const getObjectValue = (object: any, key: string): any => key.split(".").reduce 200 | ( 201 | (previous, current) => 202 | ("object" === practicalTypeof(previous)) ? 203 | previous[current]: 204 | undefined, 205 | object 206 | ); 207 | const getValue = (object: any, key: string): any => 208 | { 209 | const value = isSettingKey(key) ? 210 | getSettingValue(key): 211 | getObjectValue(object, key); 212 | return 0 <= ["object", "array"].indexOf(practicalTypeof(value)) ? JSON.stringify(value): value; 213 | }; 214 | const developInfomation = (source: string, information: any): string => source 215 | .replace 216 | ( 217 | /\$\{([\w\.\:\-]+)\}/g, 218 | (_match, p1) => getValue(information, p1) 219 | ); 220 | interface GetSystemInformationOptions 221 | { 222 | categories: string[]; 223 | withSensitiveData: boolean; 224 | withInternalExtensions: boolean; 225 | } 226 | export const getSystemInformation = (options: GetSystemInformationOptions): object => 227 | { 228 | const thisExtension = vscode.extensions.getExtension("wraith13.sysinfo-vscode"); 229 | return { 230 | "timestamp": new Date().toISOString(), 231 | "provider": 232 | { 233 | "id": thisExtension && thisExtension.id, 234 | "name": thisExtension && thisExtension.packageJSON.name, 235 | "displayName": thisExtension && thisExtension.packageJSON.displayName, 236 | "version": thisExtension && thisExtension.packageJSON.version, 237 | "options": options, 238 | }, 239 | "warning": undefined, // 表示位置をここにする為に undefined で事前挿入 240 | "os": 0 <= options.categories.indexOf("basic") ? 241 | { 242 | "arch": os.arch(), 243 | "platform": os.platform(), 244 | "type": os.type(), 245 | "release": os.release(), 246 | "EOL": JSON.stringify(os.EOL), 247 | "endianness": os.endianness(), 248 | "cpus": 0 <= options.categories.indexOf("cpu") ? os.cpus(): undefined, 249 | "totalmem": 0 <= options.categories.indexOf("memory") ? os.totalmem(): undefined, 250 | "freemem": 0 <= options.categories.indexOf("memory") ? os.freemem(): undefined, 251 | "networkInterfaces": 0 <= options.categories.indexOf("network") && options.withSensitiveData ? os.networkInterfaces(): undefined, 252 | "hostname": options.withSensitiveData ? os.hostname(): undefined, 253 | "homedir": options.withSensitiveData ? os.homedir(): undefined, 254 | "tmpdir": options.withSensitiveData ? os.tmpdir(): undefined, 255 | }: undefined, 256 | "process": 0 <= options.categories.indexOf("basic") ? 257 | { 258 | "versions": process.versions, 259 | "arch": process.arch, 260 | "execPath": options.withSensitiveData ? process.execPath: undefined, 261 | "execArgv": options.withSensitiveData ? process.execArgv: undefined, 262 | "env": 263 | { 264 | "LANG": process.env.LANG, 265 | } 266 | }: undefined, 267 | "vscode": 268 | { 269 | "version": vscode.version, 270 | "env": 271 | { 272 | "appName": vscode.env.appName, 273 | "language": vscode.env.language 274 | }, 275 | "extensions": 0 <= options.categories.indexOf("extensions") ? getExtentionsformation(options): undefined, 276 | }, 277 | }; 278 | }; 279 | interface Extension 280 | { 281 | id: string; 282 | } 283 | const isInternalExtension = (extension: Extension): boolean => extension.id.startsWith("vscode."); 284 | export const getExtentionsformation = (options: GetSystemInformationOptions): object => 285 | { 286 | return vscode.extensions.all 287 | .filter(extension => (options.withInternalExtensions || !isInternalExtension(extension))) 288 | .map 289 | ( 290 | extension => 291 | ({ 292 | "id": extension.id, 293 | "isActive": extension.isActive, 294 | "extensionPath": options.withSensitiveData ? extension.extensionPath: undefined, 295 | "packageJSON": 296 | { 297 | "name": extension.packageJSON.name, 298 | "version": extension.packageJSON.version, 299 | "displayName": extension.packageJSON.displayName, 300 | "description": extension.packageJSON.description, 301 | "publisher": extension.packageJSON.publisher, 302 | "categories": extension.packageJSON.categories, 303 | } 304 | }) 305 | ); 306 | }; 307 | export const systemLint = (information: any): any => 308 | { 309 | if ("darwin" === information["os"]["platform"] && undefined === information["process"]["env"]["LANG"]) 310 | { 311 | information["warnings"] = information["warnings"] || { }; 312 | information["warnings"]["W001"] = locale.map("W001"); 313 | } 314 | return information; 315 | }; 316 | export const hideInformation = (information: any): any => 317 | { 318 | Config.hideItems.get().forEach 319 | ( 320 | path => 321 | { 322 | var parents = [information]; 323 | path.split(".").forEach 324 | ( 325 | (key, index, keys) => 326 | { 327 | if (0 < parents.length) 328 | { 329 | if (index +1 < keys.length) 330 | { 331 | if ("*" === key) 332 | { 333 | parents = parents 334 | .map 335 | ( 336 | parent => Object.keys(parent) 337 | .map(i => parent[i]) 338 | .filter(i => undefined !== i) 339 | ) 340 | .reduce((a,b) => a.concat(b)); 341 | } 342 | else 343 | { 344 | parents = parents 345 | .map(parent => parent[key]) 346 | .filter(parent => undefined !== parent); 347 | } 348 | } 349 | else 350 | { 351 | parents.forEach(parent => delete parent[key]); 352 | } 353 | } 354 | } 355 | ); 356 | } 357 | ); 358 | return information; 359 | }; 360 | const openNewTextDocument = async (language: string): Promise => 361 | await vscode.workspace.openTextDocument({ language }); 362 | const showQuickPick = async ( 363 | items: vscode.QuickPickItem[], 364 | options: vscode.QuickPickOptions, 365 | autoSelectedIndex?: number 366 | ): Promise => undefined === autoSelectedIndex ? 367 | await vscode.window.showQuickPick(items, options): 368 | items[autoSelectedIndex]; 369 | const openNewCodeDocument = async (language: string, code: string): Promise => 370 | { 371 | const document = await openNewTextDocument(language); 372 | const textEditor = await vscode.window.showTextDocument(document); 373 | textEditor.edit 374 | ( 375 | (editBuilder: vscode.TextEditorEdit) => 376 | { 377 | editBuilder.insert(new vscode.Position(0,0), code); 378 | } 379 | ); 380 | }; 381 | export const showSystemInformation = async (): Promise => 382 | { 383 | const selectedCategories = await showQuickPick 384 | ( 385 | [ 386 | { 387 | "label": locale.map("BasicInfo.label"), 388 | "description": "", 389 | "detail": "basic, extensions" 390 | }, 391 | { 392 | "label": locale.map("FullInfo.label"), 393 | "description": locale.map("FullInfo.description"), 394 | "detail": "basic, cpu, memory, network, extensions" 395 | } 396 | ], 397 | { 398 | placeHolder: locale.map("selectCategories.placeHolder"), 399 | } 400 | ); 401 | if ( ! selectedCategories) 402 | { 403 | return; 404 | } 405 | const categories = (selectedCategories.detail || "").split(",").map(i => i.trim()); 406 | const isFull = selectedCategories.label === locale.map("FullInfo.label"); 407 | const information = getSystemInformation 408 | ( 409 | { 410 | categories: categories, 411 | withSensitiveData: isFull, 412 | withInternalExtensions: isFull, 413 | } 414 | ); 415 | systemLint(information); 416 | hideInformation(information); 417 | await vscel.menu.showQuickPick 418 | ( 419 | [ 420 | { 421 | "label": "Markdown", 422 | "description": "", 423 | "detail": "markdown" 424 | }, 425 | { 426 | "label": "JSON", 427 | "description": "", 428 | "detail": "json" 429 | } 430 | ], 431 | { 432 | placeHolder: locale.map("selectFormat.placeHolder"), 433 | command: async format => await openNewCodeDocument 434 | ( 435 | format.detail, 436 | "json" === format.detail ? 437 | JSON.stringify(information, null, 4): 438 | informationToMarkdown(information) 439 | ) 440 | } 441 | ); 442 | }; 443 | const escapeMarkdown = (text: string): string => text.replace(/\\/g, "\\\\"); 444 | const makeMarkdownHeader =(level: number, title: string): string => `${"#".repeat(level)} ${escapeMarkdown(title)}\n`; 445 | const makeMarkdownTable = (data: [{key:string,value:any}]): string => 446 | { 447 | return [ 448 | "| key | value |", 449 | 0 < data.filter(i => "number" !== practicalTypeof(i.value)).length ? "|---|---|": "|---|---:|", 450 | ] 451 | .concat 452 | ( 453 | data.map 454 | ( 455 | i => 456 | "string" === practicalTypeof(i.value) ? `| ${escapeMarkdown(i.key)} | ${escapeMarkdown(i.value)} |`: 457 | "number" === practicalTypeof(i.value) ? `| ${escapeMarkdown(i.key)} | ${escapeMarkdown(i.value.toLocaleString())} |`: 458 | `| ${escapeMarkdown(i.key)} | ${escapeMarkdown(JSON.stringify(i.value))} |` 459 | ) 460 | ) 461 | .join("\n") +"\n"; 462 | }; 463 | const makeMarkdown = (data: any, level: number = 2, title?: string, isExtensionData: boolean = false): string | undefined => 464 | { 465 | if (!data) 466 | { 467 | return undefined; 468 | } 469 | const extensionLinks = (isExtensionData && data && data.id && !isInternalExtension(data)) ? 470 | [ 471 | `- [${locale.map("link.marketplace.label")}](https://marketplace.visualstudio.com/items?itemName=${data.id})\n`, 472 | `- [${locale.map("link.vscode.label")}](vscode:extension/${data.id})\n` 473 | ] 474 | .join(""): 475 | undefined; 476 | const tableItems: [{key:string,value:any}] = []; 477 | const arrayItems: [{key:string,value:[any]}] = []; 478 | const subTables: [{key:string,value:any}] = []; 479 | Object.keys(data) 480 | .filter(key => undefined !== data[key]) 481 | .forEach 482 | ( 483 | key => 484 | { 485 | const value = data[key]; 486 | const type = practicalTypeof(value); 487 | if 488 | ( 489 | ("object" !== type || 0 === Object.keys(value).filter(i => undefined !== value[i]).length) && 490 | ("array" !== type || 0 === value.length || "string" === practicalTypeof(value[0])) 491 | ) 492 | { 493 | tableItems.push({key: key, value: value}); 494 | } 495 | else 496 | if ("array" === type) 497 | { 498 | arrayItems.push({key: key, value: value}); 499 | } 500 | else 501 | { 502 | subTables.push({key: key, value: value}); 503 | } 504 | } 505 | ); 506 | if (isExtensionData && data && data.packageJSON) 507 | { 508 | subTables.pop(); 509 | Object.keys(data.packageJSON) 510 | .filter(key => undefined !== data.packageJSON[key]) 511 | .forEach 512 | ( 513 | key => 514 | { 515 | if (undefined !== data.packageJSON[key]) 516 | { 517 | tableItems.push({key: key, value: data.packageJSON[key]}); 518 | } 519 | } 520 | ); 521 | } 522 | return [ 523 | title ? makeMarkdownHeader(level, title): undefined, 524 | extensionLinks, 525 | 0 < tableItems.length ? makeMarkdownTable(tableItems): undefined, 526 | ] 527 | .concat(subTables.map(i => makeMarkdown(i.value, level + 1, i.key, isExtensionData))) 528 | .concat 529 | ( 530 | arrayItems.map 531 | ( 532 | i => 533 | [ 534 | makeMarkdownHeader(level +1, i.key), 535 | undefined 536 | ] 537 | .concat 538 | ( 539 | i.value.map 540 | ( 541 | (j: any, index: number) => makeMarkdown 542 | ( 543 | j, 544 | level +2, 545 | isExtensionData && j && j.packageJSON && j.packageJSON.displayName ? j.packageJSON.displayName: 546 | isExtensionData && j && j.packageJSON && j.packageJSON.name ? j.packageJSON.name: 547 | `${i.key}.${index}`, 548 | isExtensionData 549 | ) 550 | ) 551 | ) 552 | .filter(i => undefined !== i) 553 | .join("\n") 554 | ) 555 | ) 556 | .filter(i => undefined !== i) 557 | .join("\n"); 558 | }; 559 | export const informationToMarkdown = (information: any): string => 560 | { 561 | return [ 562 | makeMarkdownHeader(1, "VS Code System Information"), 563 | information["timestamp"] && `timestamp: ${information["timestamp"]}\n`, 564 | makeMarkdown(information["provider"], 2, "Information Provider", true), 565 | makeMarkdown(information["warnings"], 2, "Warnings"), 566 | makeMarkdown(information["os"], 2, "OS Information"), 567 | makeMarkdown(information["process"], 2, "Process Information"), 568 | makeMarkdown(information["vscode"], 2, "VS Code Information", true), 569 | ] 570 | .filter(i => undefined !== i) 571 | .join("\n"); 572 | }; 573 | export const showSchema = async (): Promise => 574 | { 575 | const show = async (uri: string) => 576 | { 577 | const source = (await vscode.workspace.openTextDocument(vscode.Uri.parse(uri))).getText(); 578 | const text = JSON.stringify(JSON.parse(source), null, 4); 579 | const document = await vscode.workspace.openTextDocument({ language: "json" }); 580 | const textEditor = await vscode.window.showTextDocument(document); 581 | textEditor.edit 582 | ( 583 | (editBuilder: vscode.TextEditorEdit) => 584 | { 585 | editBuilder.insert(new vscode.Position(0,0), text); 586 | } 587 | ); 588 | }; 589 | const schemeList = 590 | [ 591 | "vscode://schemas/settings/default", 592 | "vscode://schemas/settings/folder", 593 | "vscode://schemas/settings/machine", 594 | "vscode://schemas/settings/resourceLanguage", 595 | "vscode://schemas/settings/user", 596 | "vscode://schemas/settings/workspace", 597 | "vscode://schemas/argv", 598 | "vscode://schemas/color-theme", 599 | "vscode://schemas/extensions", 600 | "vscode://schemas/global-snippets", 601 | "vscode://schemas/icon-theme", 602 | "vscode://schemas/icons", 603 | "vscode://schemas/ignoredSettings", 604 | "vscode://schemas/keybindings", 605 | "vscode://schemas/language-configuration", 606 | "vscode://schemas/launch", 607 | "vscode://schemas/product-icon-theme", 608 | "vscode://schemas/snippets", 609 | "vscode://schemas/tasks", 610 | "vscode://schemas/textmate-colors", 611 | "vscode://schemas/token-styling", 612 | "vscode://schemas/vscode-extensions", 613 | "vscode://schemas/workbench-colors", 614 | "vscode://schemas/workspaceConfig", 615 | ]; 616 | await vscel.menu.showQuickPick 617 | ( 618 | [{ 619 | label: `$(edit) ${locale.map("Input a scheme URI to show")}`, 620 | command: async ( ): Promise => await vscel.menu.showInputBox 621 | ({ 622 | placeHolder: "Scheme URI", 623 | command: async input => await show(input) 624 | }), 625 | }] 626 | .concat 627 | ( 628 | schemeList.map 629 | ( 630 | i => 631 | ({ 632 | label: `$(tag) ${i}`, 633 | command: async ( ) => await show(i), 634 | }) 635 | ) 636 | ) 637 | ); 638 | }; 639 | // dummy for test 640 | export const roundZoom = (value: number): number => 641 | { 642 | const cent = 100.0; 643 | return Math.round(value *cent) /cent; 644 | }; 645 | } 646 | export const activate = (context: vscode.ExtensionContext) => SysInfo.initialize(context); 647 | export const deactivate = () => { }; -------------------------------------------------------------------------------- /test/extension.test.ts: -------------------------------------------------------------------------------- 1 | // 2 | // Note: This example test is leveraging the Mocha test framework. 3 | // Please refer to their documentation on https://mochajs.org/ for help. 4 | // 5 | 6 | // The module 'assert' provides assertion methods from node 7 | import * as assert from 'assert'; 8 | 9 | // You can import and use all API from the 'vscode' module 10 | // as well as import your extension to test it 11 | //import * as vscode from 'vscode'; 12 | import * as SysInfo from '../source/extension'; 13 | 14 | // Defines a Mocha test suite to group tests of similar kind together 15 | suite("Extension Tests", () => { 16 | 17 | // Defines a Mocha unit test 18 | test("sysinfo", () => { 19 | assert.equal(100.0, SysInfo.SysInfo.roundZoom(99.999)); 20 | assert.equal(100.0, SysInfo.SysInfo.roundZoom(100.000)); 21 | assert.equal(100.0, SysInfo.SysInfo.roundZoom(100.001)); 22 | }); 23 | }); -------------------------------------------------------------------------------- /test/index.ts: -------------------------------------------------------------------------------- 1 | // 2 | // PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING 3 | // 4 | // This file is providing the test runner to use when running extension tests. 5 | // By default the test runner in use is Mocha based. 6 | // 7 | // You can provide your own test runner if you want to override it by exporting 8 | // a function run(testRoot: string, clb: (error:Error) => void) that the extension 9 | // host can call to run the tests. The test runner is expected to use console.log 10 | // to report the results back to the caller. When the tests are finished, return 11 | // a possible error to the callback or null if none. 12 | 13 | var testRunner = require('vscode/lib/testrunner'); 14 | 15 | // You can directly control Mocha options by uncommenting the following lines 16 | // See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info 17 | testRunner.configure({ 18 | ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.) 19 | useColors: true // colored output from test results 20 | }); 21 | 22 | module.exports = testRunner; -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "moduleResolution": "node", 5 | "declaration": true, 6 | "target": "es6", 7 | "outDir": "out", 8 | "lib": [ 9 | "es6" 10 | ], 11 | "noImplicitAny": true, 12 | "strictNullChecks": true, 13 | "noFallthroughCasesInSwitch": true, 14 | "noImplicitReturns": true, 15 | "noImplicitThis": true, 16 | "noUnusedLocals": true, 17 | "noUnusedParameters": true, 18 | "noImplicitUseStrict": false, 19 | "sourceMap": true, 20 | "emitDecoratorMetadata": true, 21 | "experimentalDecorators": true, 22 | "forceConsistentCasingInFileNames": true, 23 | "traceResolution": false, 24 | "listFiles": false, 25 | "stripInternal": true, 26 | "skipDefaultLibCheck": true, 27 | "skipLibCheck": false, 28 | "pretty": false, 29 | "noEmitOnError": true, 30 | "rootDir": ".", 31 | "resolveJsonModule": true, 32 | "esModuleInterop": true 33 | }, 34 | "exclude": [ 35 | "node_modules", 36 | ".vscode-test", 37 | "out" 38 | ] 39 | } -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-unused-expression": true, 4 | "no-duplicate-variable": true, 5 | "no-unused-variable": true, 6 | "curly": true, 7 | "class-name": true, 8 | "semicolon": true, 9 | "triple-equals": true 10 | } 11 | } --------------------------------------------------------------------------------