├── .gitignore ├── .vscodeignore ├── .vscode ├── extensions.json ├── settings.json ├── tasks.json └── launch.json ├── CHANGELOG.md ├── .eslintrc.json ├── README.md ├── tsconfig.json ├── source ├── config.json └── extension.ts ├── LICENSE_1_0.txt └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | node_modules 3 | .vscode-test/ 4 | *.vsix 5 | private 6 | -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | out/test/** 4 | source/** 5 | .gitignore 6 | vsc-extension-quickstart.md 7 | **/tsconfig.json 8 | **/.eslintrc.json 9 | **/*.map 10 | **/*.ts 11 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "dbaeumer.vscode-eslint" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to the "save-vscode-schemas" 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 | ## [Unreleased] 8 | 9 | ## 1.0.0 - 2020-08-20 10 | 11 | - first version. 12 | 13 | ## 0.0.0 - 2020-08-16 14 | 15 | ### Added 16 | 17 | - Start this project. 18 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | "files.exclude": { 4 | "out": false // set this to true to hide the "out" folder with the compiled JS files 5 | }, 6 | "search.exclude": { 7 | "out": true // set this to false to include "out" folder in search results 8 | }, 9 | // Turn off tsc task auto detection since we have the necessary tasks as npm scripts 10 | "typescript.tsc.autoDetect": "off" 11 | } -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "parser": "@typescript-eslint/parser", 4 | "parserOptions": { 5 | "ecmaVersion": 6, 6 | "sourceType": "module" 7 | }, 8 | "plugins": [ 9 | "@typescript-eslint" 10 | ], 11 | "rules": { 12 | "@typescript-eslint/naming-convention": "warn", 13 | "@typescript-eslint/semi": "warn", 14 | "curly": "warn", 15 | "eqeqeq": "warn", 16 | "no-throw-literal": "warn", 17 | "semi": "off" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # save-vscode-schemas README 2 | 3 | This extension is for saving VS Code's schemas. 4 | Normally you don't need to use this VS Code extension. 5 | See [vscode-schemas](https://github.com/wraith13/vscode-schemas) or use [System Information](https://marketplace.visualstudio.com/items?itemName=wraith13.sysinfo-vscode) instead of using this extension. 6 | 7 | ## How to use. 8 | 9 | 1. Edit `./source/config.json`. 10 | 2. `Run Extension` or `Run Extension without others`. 11 | 3. Open folder. 12 | 4. Execute `Save VS Code's Schemas` command from Command Palette. 13 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | // See https://go.microsoft.com/fwlink/?LinkId=733558 2 | // for the documentation about the tasks.json format 3 | { 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "type": "npm", 8 | "script": "watch", 9 | "problemMatcher": "$tsc-watch", 10 | "isBackground": true, 11 | "presentation": { 12 | "reveal": "never" 13 | }, 14 | "group": { 15 | "kind": "build", 16 | "isDefault": true 17 | } 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /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": "source", 31 | "strict": true, 32 | "resolveJsonModule": true, 33 | "esModuleInterop": true 34 | }, 35 | "exclude": [ 36 | "node_modules", 37 | ".vscode-test", 38 | "out" 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /source/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemas": 3 | [ 4 | "vscode://schemas/settings/default", 5 | "vscode://schemas/settings/folder", 6 | "vscode://schemas/settings/machine", 7 | "vscode://schemas/settings/resourceLanguage", 8 | "vscode://schemas/settings/user", 9 | "vscode://schemas/settings/workspace", 10 | "vscode://schemas/argv", 11 | "vscode://schemas/color-theme", 12 | "vscode://schemas/extensions", 13 | "vscode://schemas/global-snippets", 14 | "vscode://schemas/icon-theme", 15 | "vscode://schemas/icons", 16 | "vscode://schemas/ignoredSettings", 17 | "vscode://schemas/keybindings", 18 | "vscode://schemas/language-configuration", 19 | "vscode://schemas/launch", 20 | "vscode://schemas/product-icon-theme", 21 | "vscode://schemas/snippets", 22 | "vscode://schemas/tasks", 23 | "vscode://schemas/textmate-colors", 24 | "vscode://schemas/token-styling", 25 | "vscode://schemas/vscode-extensions", 26 | "vscode://schemas/workbench-colors", 27 | "vscode://schemas/workspaceConfig" 28 | ], 29 | "out": 30 | { 31 | "rootDir": ".", 32 | "stringifyOptions": 33 | { 34 | "replacer": null, 35 | "space": 4 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that compiles the extension and then opens it inside a new window 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | { 6 | "version": "0.2.0", 7 | "configurations": [ 8 | { 9 | "name": "Run Extension without others", 10 | "type": "extensionHost", 11 | "request": "launch", 12 | "runtimeExecutable": "${execPath}", 13 | "args": [ 14 | "--disable-extensions", 15 | "--extensionDevelopmentPath=${workspaceFolder}" 16 | ], 17 | "outFiles": [ 18 | "${workspaceFolder}/out/**/*.js" 19 | ], 20 | "preLaunchTask": "${defaultBuildTask}" 21 | }, 22 | { 23 | "name": "Run Extension", 24 | "type": "extensionHost", 25 | "request": "launch", 26 | "runtimeExecutable": "${execPath}", 27 | "args": [ 28 | "--extensionDevelopmentPath=${workspaceFolder}" 29 | ], 30 | "outFiles": [ 31 | "${workspaceFolder}/out/**/*.js" 32 | ], 33 | "preLaunchTask": "${defaultBuildTask}" 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "save-vscode-schemas", 3 | "displayName": "save-vscode-schemas", 4 | "description": "Save VS Code's schemas", 5 | "version": "1.0.0", 6 | "publisher": "wraith13", 7 | "license": "SEE LICENSE IN LICENSE_1_0.txt", 8 | "engines": { 9 | "vscode": "^1.48.0" 10 | }, 11 | "bugs": { 12 | "url": "https://github.com/wraith13/save-vscode-schemas/issues" 13 | }, 14 | "homepage": "https://github.com/wraith13/save-vscode-schemas", 15 | "repository": { 16 | "type": "git", 17 | "url": "https://github.com/wraith13/save-vscode-schemas.git" 18 | }, 19 | "categories": [ 20 | "Other" 21 | ], 22 | "activationEvents": [ 23 | "onCommand:save-vscode-schemas" 24 | ], 25 | "main": "./out/extension.js", 26 | "contributes": { 27 | "commands": [ 28 | { 29 | "command": "save-vscode-schemas", 30 | "title": "Save VS Code's Schemas" 31 | } 32 | ] 33 | }, 34 | "scripts": { 35 | "vscode:prepublish": "npm run compile", 36 | "compile": "tsc -p ./", 37 | "lint": "eslint source --ext ts", 38 | "watch": "tsc -watch -p ./" 39 | }, 40 | "devDependencies": { 41 | "@types/vscode": "^1.48.0", 42 | "@types/glob": "^7.1.3", 43 | "@types/node": "^14.0.27", 44 | "eslint": "^7.6.0", 45 | "@typescript-eslint/eslint-plugin": "^3.8.0", 46 | "@typescript-eslint/parser": "^3.8.0", 47 | "glob": "^7.1.6", 48 | "typescript": "^3.8.3" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /source/extension.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { posix } from 'path'; 3 | import config from './config.json'; 4 | export const locale = vscode.env.language ?? "en"; 5 | export const version = `v${vscode.version}`; 6 | export const activate = (context: vscode.ExtensionContext) => context.subscriptions.push 7 | ( 8 | vscode.commands.registerCommand 9 | ( 10 | 'save-vscode-schemas', 11 | async () => 12 | { 13 | const baseUri = vscode.workspace.workspaceFolders?.[0].uri; 14 | if (baseUri) 15 | { 16 | await Promise.all 17 | ( 18 | config.schemas.map 19 | ( 20 | async uri => 21 | { 22 | const path = `${config.out.rootDir}/${locale}/${version}${uri.replace(/^vscode:\/(.*)/,"$1.json")}`; 23 | await vscode.workspace.fs.createDirectory 24 | ( 25 | baseUri.with({ path: posix.join(baseUri.path, path.replace(/\/[^/]+$/, "")) }) 26 | ); 27 | await vscode.workspace.fs.writeFile 28 | ( 29 | baseUri.with({ path: posix.join(baseUri.path, path) }), 30 | Buffer.from 31 | ( 32 | JSON.stringify 33 | ( 34 | JSON.parse((await vscode.workspace.openTextDocument(vscode.Uri.parse(uri))).getText()), 35 | config.out.stringifyOptions.replacer, 36 | config.out.stringifyOptions.space 37 | ), 38 | "utf8" 39 | ) 40 | ); 41 | } 42 | ) 43 | ); 44 | } 45 | } 46 | ) 47 | ); 48 | export const deactivate = () => { }; 49 | --------------------------------------------------------------------------------