├── .gitignore ├── .vscode └── settings.json ├── AutoCollapseExplorer ├── .gitignore ├── .vscode │ ├── launch.json │ ├── settings.json │ └── tasks.json ├── README.md ├── images │ └── demo.gif ├── package.json ├── src │ └── extension.ts ├── test │ ├── extension.test.ts │ └── index.ts ├── tsconfig.json └── vsix │ ├── auto-collapse-explorer-0.0.2.vsix │ └── vscode-api-playground-focus-active-editor-0.0.1.vsix ├── ConfigurationTest ├── .gitignore ├── .vscode │ ├── launch.json │ ├── settings.json │ └── tasks.json ├── .vscodeignore ├── CHANGELOG.md ├── README.md ├── package.json ├── src │ └── extension.ts ├── test │ ├── extension.test.ts │ └── index.ts ├── tsconfig.json └── vsc-extension-quickstart.md ├── HelloWorld ├── .gitignore ├── .vscode │ ├── launch.json │ ├── settings.json │ └── tasks.json ├── .vscodeignore ├── CHANGELOG.md ├── README.md ├── package.json ├── src │ └── extension.ts ├── test │ ├── extension.test.ts │ └── index.ts ├── tsconfig.json ├── vsc-extension-quickstart.md └── vsix │ └── helloworld-0.0.1.vsix ├── LICENSE.md ├── NewFileWithLanguageMode ├── .gitignore ├── .vscode │ ├── launch.json │ ├── settings.json │ └── tasks.json ├── README.md ├── images │ └── icon.png ├── package.json ├── src │ └── extension.ts ├── test │ ├── extension.test.ts │ └── index.ts ├── tsconfig.json └── vsix │ ├── vscode-api-playground-newfile-languagemode-0.0.1.vsix │ ├── vscode-newfile-languagemode-1.0.0.vsix │ └── vscode-newfile-languagemode-1.1.0.vsix ├── QuickPickDocumentPreview ├── .gitignore ├── .vscode │ ├── launch.json │ ├── settings.json │ └── tasks.json ├── .vscodeignore ├── README.md ├── images │ └── demo.gif ├── licenses │ ├── apache-v2.0.md │ ├── artistic-v2.0.md │ ├── bsd-2.md │ ├── bsd-3.md │ ├── epl-v1.0.md │ ├── gnu-agpl-v3.0.md │ ├── gnu-fdl-v1.3.md │ ├── gnu-gpl-v1.0.md │ ├── gnu-gpl-v2.0.md │ ├── gnu-gpl-v3.0.md │ ├── gnu-lgpl-v2.1.md │ ├── gnu-lgpl-v3.0.md │ ├── mit.md │ ├── mpl-v2.0.md │ └── unlicense.md ├── package.json ├── preview.html ├── src │ ├── FileContentProvider.ts │ └── extension.ts ├── test │ ├── extension.test.ts │ └── index.ts ├── tsconfig.json └── vsix │ └── vscode-quick-pick-document-preview-0.0.1.vsix ├── README.md ├── SettingsCycler ├── .gitignore ├── .vscode │ ├── launch.json │ ├── settings.json │ └── tasks.json ├── README.md ├── _package.json.with.scope ├── images │ ├── LICENSE.md │ ├── demo.gif │ └── icon.png ├── package.json ├── publish.bat ├── src │ ├── extension.ts │ └── logger.ts ├── test │ ├── extension.test.ts │ └── index.ts ├── tsconfig.json └── vsix │ ├── vscode-settings-cycler-0.0.1.vsix │ └── vscode-settings-cycler-1.0.0.vsix └── SymbolIcons ├── .gitignore ├── .vscode ├── launch.json ├── settings.json └── tasks.json ├── README.md ├── images ├── documentSymbolPreview.png └── documentSymbolPreviewOld.png ├── package.json ├── src ├── extension.ts └── symbolKindIconPreviewDocumentSymbolProvider.ts ├── test ├── extension.test.ts └── index.ts ├── tsconfig.json └── vsix └── vscode-api-playground-symbol-icons-0.0.1.vsix /.gitignore: -------------------------------------------------------------------------------- 1 | npm-debug.log.* -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | } -------------------------------------------------------------------------------- /AutoCollapseExplorer/.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | node_modules -------------------------------------------------------------------------------- /AutoCollapseExplorer/.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/src/**/*.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 | -------------------------------------------------------------------------------- /AutoCollapseExplorer/.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 | } -------------------------------------------------------------------------------- /AutoCollapseExplorer/.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": "0.1.0", 12 | 13 | // we want to run npm 14 | "command": "npm", 15 | 16 | // the command is a shell script 17 | "isShellCommand": true, 18 | 19 | // show the output window only if unrecognized errors occur. 20 | "showOutput": "silent", 21 | 22 | // we run the custom script "compile" as defined in package.json 23 | "args": ["run", "compile", "--loglevel", "silent"], 24 | 25 | // The tsc compiler is started in watching mode 26 | "isWatching": true, 27 | 28 | // use the standard tsc in watch mode problem matcher to find compile problems in the output. 29 | "problemMatcher": "$tsc-watch" 30 | } -------------------------------------------------------------------------------- /AutoCollapseExplorer/README.md: -------------------------------------------------------------------------------- 1 | # Auto-Collapse Explorer 2 | 3 | ## Summary 4 | Each time the active editor changes, this extension makes sure the file tree on the left is collapsed and focuses on the currently active file. In addition with the visual highlight of the active file, this helps the eye see where in the folder hierarchy the active file is. 5 | 6 | ![Demo](images/demo.gif) 7 | 8 | ## How to Use: 9 | Install the extension and things will work! As you change documents you'll notice that all directories are collapsed except the one that contains the file you are currently editing. However, to get the best experience, make sure that the built-in auto-reveal setting is false or you will notice flickering each time you change files. This is because VS Code will reveal the file, then this extension will collapse the explorer and re-reveal the file. 10 | 11 | `"explorer.autoReveal": false`; 12 | 13 | And to disable the auto-collapse provided by this extension, add this to your settings: 14 | 15 | `"explorer.autoCollapse": false` 16 | 17 | If you'd like to be able to toggle this with a keyboard command, I recommend using [Settings Cycler](https://marketplace.visualstudio.com/items?itemName=hoovercj.vscode-settings-cycler). 18 | 19 | ## Known Issues 20 | If the sidebar is closed, changing files will open it again. There is no way yet to get the sidebar status. 21 | 22 | ## Inspiration: 23 | In [this question](https://stackoverflow.com/questions/42673828/how-to-collapse-explorer-folders-before-focusing-a-file-in-vcode), a stackoverflow user asked if it was possible to automatically collapse folders while switching between documents. To my knowledge, this is not possible without an extension, so I created one. 24 | 25 | ## Apis Used: 26 | * [window.onDidChangeActiveTextEditor](https://code.visualstudio.com/docs/extensionAPI/vscode-api#_window) - An event that is triggered when the active text editor changes 27 | * [commands.executeCommand](https://code.visualstudio.com/docs/extensionAPI/vscode-api#_commands) - A function that allows executing built in commands or commands that are provided by the extension. In this case, I execute: 28 | * `workbench.files.action.collapseExplorerFolders` to collapse the folders 29 | * `workbench.files.action.showActiveFileInExplorer` to re-focus on the active file in the tree view which expands only the necessary directories 30 | * `workbench.action.focusActiveEditorGroup` to put the cursor focus back in the file that was opened 31 | 32 | ## See More 33 | 34 | This is a part of the my API Playground repository. Each subdirectory is a self-contained extension that demonstrates a particular API, repros a bug, answers a stackoverflow question, etc. 35 | 36 | ## Release Notes 37 | 38 | ### 0.0.2 39 | * Changed name to "Auto-Collapse Explorer" 40 | * ADDED: `explorer.autoCollapse` configuration option. 41 | 42 | ### 0.0.1 43 | 44 | Initial release that collapses and then focuses the active file each time the active editor changes. -------------------------------------------------------------------------------- /AutoCollapseExplorer/images/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoovercj/vscode-api-playground/50bbb3ebaff0f5cdafc326160146d6f550f62532/AutoCollapseExplorer/images/demo.gif -------------------------------------------------------------------------------- /AutoCollapseExplorer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "auto-collapse-explorer", 3 | "displayName": "Auto-Collapse Explorer", 4 | "description": "", 5 | "version": "0.0.2", 6 | "publisher": "hoovercj", 7 | "engines": { 8 | "vscode": "^1.10.0" 9 | }, 10 | "categories": [ 11 | "Other" 12 | ], 13 | "activationEvents": [ 14 | "*" 15 | ], 16 | "main": "./out/src/extension", 17 | "contributes": { 18 | "configuration": { 19 | "properties": { 20 | "explorer.autoCollapse": { 21 | "type": "boolean", 22 | "description": "If true, the explorer will automatically collapse when a new file is focused", 23 | "default": true 24 | } 25 | } 26 | } 27 | }, 28 | "scripts": { 29 | "vscode:prepublish": "tsc -p ./", 30 | "compile": "tsc -watch -p ./", 31 | "postinstall": "node ./node_modules/vscode/bin/install" 32 | }, 33 | "devDependencies": { 34 | "typescript": "^2.0.3", 35 | "vscode": "^1.0.5", 36 | "mocha": "^2.3.3", 37 | "@types/node": "^6.0.40", 38 | "@types/mocha": "^2.2.32" 39 | } 40 | } -------------------------------------------------------------------------------- /AutoCollapseExplorer/src/extension.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | import { ExtensionContext, commands, workspace, window, Disposable } from 'vscode'; 3 | 4 | let collapse: boolean = undefined; 5 | let activeEditorDisposable: Disposable; 6 | let configDisposable: Disposable; 7 | export function activate(context: ExtensionContext) { 8 | initialize(); 9 | const configDisposable = workspace.onDidChangeConfiguration(() => initialize()); 10 | } 11 | 12 | function executeCommands() { 13 | if (collapse && window.activeTextEditor) { 14 | commands.executeCommand('workbench.files.action.collapseExplorerFolders').then(() => { 15 | commands.executeCommand('workbench.files.action.showActiveFileInExplorer'); 16 | }).then(() => { 17 | commands.executeCommand('workbench.action.focusActiveEditorGroup'); 18 | }); 19 | } 20 | } 21 | 22 | function initialize() { 23 | const config = workspace.getConfiguration('explorer').get('autoCollapse', true); 24 | 25 | if (collapse === config) { 26 | return; 27 | } 28 | 29 | collapse = config; 30 | 31 | if (collapse) { 32 | activeEditorDisposable = window.onDidChangeActiveTextEditor(executeCommands); 33 | } else { 34 | activeEditorDisposable.dispose(); 35 | } 36 | } 37 | 38 | // this method is called when your extension is deactivated 39 | export function deactivate() { 40 | activeEditorDisposable.dispose(); 41 | configDisposable.dispose(); 42 | } -------------------------------------------------------------------------------- /AutoCollapseExplorer/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 myExtension from '../src/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("Something 1", () => { 19 | assert.equal(-1, [1, 2, 3].indexOf(5)); 20 | assert.equal(-1, [1, 2, 3].indexOf(0)); 21 | }); 22 | }); -------------------------------------------------------------------------------- /AutoCollapseExplorer/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; -------------------------------------------------------------------------------- /AutoCollapseExplorer/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "outDir": "out", 6 | "lib": [ 7 | "es6" 8 | ], 9 | "sourceMap": true, 10 | "rootDir": "." 11 | }, 12 | "exclude": [ 13 | "node_modules", 14 | ".vscode-test" 15 | ] 16 | } -------------------------------------------------------------------------------- /AutoCollapseExplorer/vsix/auto-collapse-explorer-0.0.2.vsix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoovercj/vscode-api-playground/50bbb3ebaff0f5cdafc326160146d6f550f62532/AutoCollapseExplorer/vsix/auto-collapse-explorer-0.0.2.vsix -------------------------------------------------------------------------------- /AutoCollapseExplorer/vsix/vscode-api-playground-focus-active-editor-0.0.1.vsix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoovercj/vscode-api-playground/50bbb3ebaff0f5cdafc326160146d6f550f62532/AutoCollapseExplorer/vsix/vscode-api-playground-focus-active-editor-0.0.1.vsix -------------------------------------------------------------------------------- /ConfigurationTest/.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | node_modules -------------------------------------------------------------------------------- /ConfigurationTest/.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/src/**/*.js" ], 14 | "preLaunchTask": "npm: watch" 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: watch" 26 | } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /ConfigurationTest/.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 | // "configtest.number": 5 10 | } -------------------------------------------------------------------------------- /ConfigurationTest/.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 | } -------------------------------------------------------------------------------- /ConfigurationTest/.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | out/test/** 4 | test/** 5 | src/** 6 | **/*.map 7 | .gitignore 8 | tsconfig.json 9 | vsc-extension-quickstart.md 10 | -------------------------------------------------------------------------------- /ConfigurationTest/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | All notable changes to the "configuration-test" extension will be documented in this file. 3 | 4 | Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. 5 | 6 | ## [Unreleased] 7 | - Initial release -------------------------------------------------------------------------------- /ConfigurationTest/README.md: -------------------------------------------------------------------------------- 1 | # configuration-test README 2 | 3 | This is the README for your extension "configuration-test". After writing up a brief description, we recommend including the following sections. 4 | 5 | ## Features 6 | 7 | Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file. 8 | 9 | For example if there is an image subfolder under your extension project workspace: 10 | 11 | \!\[feature X\]\(images/feature-x.png\) 12 | 13 | > Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow. 14 | 15 | ## Requirements 16 | 17 | If you have any requirements or dependencies, add a section describing those and how to install and configure them. 18 | 19 | ## Extension Settings 20 | 21 | Include if your extension adds any VS Code settings through the `contributes.configuration` extension point. 22 | 23 | For example: 24 | 25 | This extension contributes the following settings: 26 | 27 | * `myExtension.enable`: enable/disable this extension 28 | * `myExtension.thing`: set to `blah` to do something 29 | 30 | ## Known Issues 31 | 32 | Calling out known issues can help limit users opening duplicate issues against your extension. 33 | 34 | ## Release Notes 35 | 36 | Users appreciate release notes as you update your extension. 37 | 38 | ### 1.0.0 39 | 40 | Initial release of ... 41 | 42 | ### 1.0.1 43 | 44 | Fixed issue #. 45 | 46 | ### 1.1.0 47 | 48 | Added features X, Y, and Z. 49 | 50 | ----------------------------------------------------------------------------------------------------------- 51 | 52 | ## Working with Markdown 53 | 54 | **Note:** You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts: 55 | 56 | * Split the editor (`Cmd+\` on OSX or `Ctrl+\` on Windows and Linux) 57 | * Toggle preview (`Shift+CMD+V` on OSX or `Shift+Ctrl+V` on Windows and Linux) 58 | * Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (OSX) to see a list of Markdown snippets 59 | 60 | ### For more information 61 | 62 | * [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown) 63 | * [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/) 64 | 65 | **Enjoy!** -------------------------------------------------------------------------------- /ConfigurationTest/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "configuration-test", 3 | "displayName": "configuration-test", 4 | "description": "", 5 | "version": "0.0.1", 6 | "publisher": "hoovercj", 7 | "engines": { 8 | "vscode": "^1.16.0" 9 | }, 10 | "categories": [ 11 | "Other" 12 | ], 13 | "activationEvents": [ 14 | "*" 15 | ], 16 | "main": "./out/src/extension", 17 | "contributes": { 18 | "configuration": { 19 | "title": "Configuration Bug", 20 | "properties": { 21 | "configtest.boolean": { 22 | "type": "boolean", 23 | "description": "This has no default so 'onDidChangeConfiguration' won't be called if the value is set to false" 24 | }, 25 | "configtest.number": { 26 | "type": "number", 27 | "description": "This has no default so 'onDidChangeConfiguration' won't be called if the value is set to 0" 28 | }, 29 | "configtest.array": { 30 | "type": "array", 31 | "description": "This has no default so 'onDidChangeConfiguration' won't be called if the value is set to []" 32 | }, 33 | "configtest.object": { 34 | "type": "object", 35 | "description": "This has no default so 'onDidChangeConfiguration' won't be called if the value is set to {}" 36 | }, 37 | "configtest.string": { 38 | "type": "string", 39 | "description": "This has no default so 'onDidChangeConfiguration' won't be called if the value is set to an empty string" 40 | } 41 | } 42 | } 43 | }, 44 | "scripts": { 45 | "vscode:prepublish": "npm run compile", 46 | "compile": "tsc -p ./", 47 | "watch": "tsc -watch -p ./", 48 | "postinstall": "node ./node_modules/vscode/bin/install", 49 | "test": "npm run compile && node ./node_modules/vscode/bin/test" 50 | }, 51 | "devDependencies": { 52 | "typescript": "^2.5.2", 53 | "vscode": "^1.1.5", 54 | "mocha": "^3.5.0", 55 | "@types/node": "^7.0.43", 56 | "@types/mocha": "^2.2.42" 57 | } 58 | } -------------------------------------------------------------------------------- /ConfigurationTest/src/extension.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | import * as vscode from 'vscode'; 3 | export function activate(context: vscode.ExtensionContext) { 4 | const config = vscode.workspace.getConfiguration('configtest'); 5 | 6 | // The default value is set to 0 despite not being set in package.json 7 | const defaultValue = config.inspect('number').defaultValue; 8 | 9 | // As a consequence, the 5 here is ignored 10 | const value = config.get('number', 5); 11 | 12 | vscode.window.showInformationMessage(`defaultValue = ${defaultValue} / value = ${value}`); 13 | } 14 | 15 | // this method is called when your extension is deactivated 16 | export function deactivate() { 17 | } -------------------------------------------------------------------------------- /ConfigurationTest/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 myExtension from '../src/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("Something 1", () => { 19 | assert.equal(-1, [1, 2, 3].indexOf(5)); 20 | assert.equal(-1, [1, 2, 3].indexOf(0)); 21 | }); 22 | }); -------------------------------------------------------------------------------- /ConfigurationTest/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; -------------------------------------------------------------------------------- /ConfigurationTest/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "outDir": "out", 6 | "lib": [ 7 | "es6" 8 | ], 9 | "sourceMap": true, 10 | "rootDir": "." 11 | }, 12 | "exclude": [ 13 | "node_modules", 14 | ".vscode-test" 15 | ] 16 | } -------------------------------------------------------------------------------- /ConfigurationTest/vsc-extension-quickstart.md: -------------------------------------------------------------------------------- 1 | # Welcome to your first VS Code Extension 2 | 3 | ## What's in the folder 4 | * This folder contains all of the files necessary for your extension 5 | * `package.json` - this is the manifest file in which you declare your extension and command. 6 | The sample plugin registers a command and defines its title and command name. With this information 7 | VS Code can show the command in the command palette. It doesn’t yet need to load the plugin. 8 | * `src/extension.ts` - this is the main file where you will provide the implementation of your command. 9 | The file exports one function, `activate`, which is called the very first time your extension is 10 | activated (in this case by executing the command). Inside the `activate` function we call `registerCommand`. 11 | We pass the function containing the implementation of the command as the second parameter to 12 | `registerCommand`. 13 | 14 | ## Get up and running straight away 15 | * press `F5` to open a new window with your extension loaded 16 | * run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World` 17 | * set breakpoints in your code inside `src/extension.ts` to debug your extension 18 | * find output from your extension in the debug console 19 | 20 | ## Make changes 21 | * you can relaunch the extension from the debug toolbar after changing code in `src/extension.ts` 22 | * you can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes 23 | 24 | ## Explore the API 25 | * you can open the full set of our API when you open the file `node_modules/vscode/vscode.d.ts` 26 | 27 | ## Run tests 28 | * open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Launch Tests` 29 | * press `F5` to run the tests in a new window with your extension loaded 30 | * see the output of the test result in the debug console 31 | * make changes to `test/extension.test.ts` or create new test files inside the `test` folder 32 | * by convention, the test runner will only consider files matching the name pattern `**.test.ts` 33 | * you can create folders inside the `test` folder to structure your tests any way you want -------------------------------------------------------------------------------- /HelloWorld/.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | node_modules -------------------------------------------------------------------------------- /HelloWorld/.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/src/**/*.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 | -------------------------------------------------------------------------------- /HelloWorld/.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 | } -------------------------------------------------------------------------------- /HelloWorld/.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": "0.1.0", 12 | 13 | // we want to run npm 14 | "command": "npm", 15 | 16 | // the command is a shell script 17 | "isShellCommand": true, 18 | 19 | // show the output window only if unrecognized errors occur. 20 | "showOutput": "silent", 21 | 22 | // we run the custom script "compile" as defined in package.json 23 | "args": ["run", "compile", "--loglevel", "silent"], 24 | 25 | // The tsc compiler is started in watching mode 26 | "isWatching": true, 27 | 28 | // use the standard tsc in watch mode problem matcher to find compile problems in the output. 29 | "problemMatcher": "$tsc-watch" 30 | } -------------------------------------------------------------------------------- /HelloWorld/.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | out/test/** 4 | test/** 5 | src/** 6 | **/*.map 7 | .gitignore 8 | tsconfig.json 9 | vsc-extension-quickstart.md 10 | -------------------------------------------------------------------------------- /HelloWorld/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | All notable changes to the "helloworld" extension will be documented in this file. 3 | 4 | Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. 5 | 6 | ## [Unreleased] 7 | - Initial release -------------------------------------------------------------------------------- /HelloWorld/README.md: -------------------------------------------------------------------------------- 1 | # API Playground: HelloWorld 2 | 3 | This is the README for your new extension "helloworld". After writing up a brief description, we recommend including the following sections. 4 | 5 | ## Features 6 | 7 | Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file. 8 | 9 | For example if there is an image subfolder under your extension project workspace: 10 | 11 | \!\[feature X\]\(images/feature-x.png\) 12 | 13 | > Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow. 14 | 15 | ## Requirements 16 | 17 | If you have any requirements or dependencies, add a section describing those and how to install and configure them. 18 | 19 | ## Extension Settings 20 | 21 | Include if your extension adds any VS Code settings through the `contributes.configuration` extension point. 22 | 23 | For example: 24 | 25 | This extension contributes the following settings: 26 | 27 | * `myExtension.enable`: enable/disable this extension 28 | * `myExtension.thing`: set to `blah` to do something 29 | 30 | ## Known Issues 31 | 32 | Calling out known issues can help limit users opening duplicate issues against your extension. 33 | 34 | ## Release Notes 35 | 36 | Users appreciate release notes as you update your extension. 37 | 38 | ### 1.0.0 39 | 40 | Initial release of ... 41 | 42 | ### 1.0.1 43 | 44 | Fixed issue #. 45 | 46 | ### 1.1.0 47 | 48 | Added features X, Y, and Z. 49 | 50 | ----------------------------------------------------------------------------------------------------------- 51 | 52 | ## Working with Markdown 53 | 54 | **Note:** You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts: 55 | 56 | * Split the editor (`Cmd+\` on OSX or `Ctrl+\` on Windows and Linux) 57 | * Toggle preview (`Shift+CMD+V` on OSX or `Shift+Ctrl+V` on Windows and Linux) 58 | * Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (OSX) to see a list of Markdown snippets 59 | 60 | ### For more information 61 | 62 | * [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown) 63 | * [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/) 64 | 65 | **Enjoy!** 66 | -------------------------------------------------------------------------------- /HelloWorld/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "helloworld", 3 | "displayName": "HelloWorld", 4 | "description": "Hello World extension produced by `yo code`", 5 | "version": "0.0.1", 6 | "publisher": "hoovercj", 7 | "engines": { 8 | "vscode": "^1.10.0" 9 | }, 10 | "categories": [ 11 | "Other" 12 | ], 13 | "activationEvents": [ 14 | "*" 15 | ], 16 | "main": "./out/src/extension", 17 | "contributes": { 18 | "commands": [{ 19 | "command": "preview.html.preservefocus", 20 | "title": "Preview Html: Preserve Focus" 21 | }, { 22 | "command": "preview.html.dont.preservefocus", 23 | "title": "Preview Html: DON'T preserve focus" 24 | }] 25 | }, 26 | "scripts": { 27 | "vscode:prepublish": "tsc -p ./", 28 | "compile": "tsc -watch -p ./", 29 | "postinstall": "node ./node_modules/vscode/bin/install", 30 | "test": "node ./node_modules/vscode/bin/test" 31 | }, 32 | "devDependencies": { 33 | "typescript": "^2.0.3", 34 | "vscode": "^1.0.0", 35 | "mocha": "^2.3.3", 36 | "@types/node": "^6.0.40", 37 | "@types/mocha": "^2.2.32" 38 | } 39 | } -------------------------------------------------------------------------------- /HelloWorld/src/extension.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | // The module 'vscode' contains the VS Code extensibility API 3 | // Import the module and reference it with the alias vscode in your code below 4 | import * as vscode from 'vscode'; 5 | 6 | // this method is called when your extension is activated 7 | // your extension is activated the very first time the command is executed 8 | export function activate(context: vscode.ExtensionContext) { 9 | 10 | // Use the console to output diagnostic information (console.log) and errors (console.error) 11 | // This line of code will only be executed once when your extension is activated 12 | console.log('Congratulations, your extension "helloworld" is now active!'); 13 | 14 | // The command has been defined in the package.json file 15 | // Now provide the implementation of the command with registerCommand 16 | // The commandId parameter must match the command field in package.json 17 | let disposable1 = vscode.commands.registerCommand('preview.html.dont.preservefocus', () => { 18 | // The code you place here will be executed every time your command is executed 19 | vscode.commands.executeCommand('vscode.previewHtml', vscode.window.activeTextEditor.document.uri, vscode.ViewColumn.Two, 'Takes Focus', false); 20 | }); 21 | let disposable2 = vscode.commands.registerCommand('preview.html.preservefocus', () => { 22 | // The code you place here will be executed every time your command is executed 23 | vscode.commands.executeCommand('vscode.previewHtml', vscode.window.activeTextEditor.document.uri, vscode.ViewColumn.Three, 'Does Not Take Focus', true); 24 | }); 25 | 26 | context.subscriptions.push(disposable1, disposable2); 27 | } 28 | 29 | // this method is called when your extension is deactivated 30 | export function deactivate() { 31 | } -------------------------------------------------------------------------------- /HelloWorld/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 myExtension from '../src/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("Something 1", () => { 19 | assert.equal(-1, [1, 2, 3].indexOf(5)); 20 | assert.equal(-1, [1, 2, 3].indexOf(0)); 21 | }); 22 | }); -------------------------------------------------------------------------------- /HelloWorld/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; -------------------------------------------------------------------------------- /HelloWorld/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "outDir": "out", 6 | "lib": [ 7 | "es6" 8 | ], 9 | "sourceMap": true, 10 | "rootDir": "." 11 | }, 12 | "exclude": [ 13 | "node_modules", 14 | ".vscode-test" 15 | ] 16 | } -------------------------------------------------------------------------------- /HelloWorld/vsc-extension-quickstart.md: -------------------------------------------------------------------------------- 1 | # Welcome to your first VS Code Extension 2 | 3 | ## What's in the folder 4 | * This folder contains all of the files necessary for your extension 5 | * `package.json` - this is the manifest file in which you declare your extension and command. 6 | The sample plugin registers a command and defines its title and command name. With this information 7 | VS Code can show the command in the command palette. It doesn’t yet need to load the plugin. 8 | * `src/extension.ts` - this is the main file where you will provide the implementation of your command. 9 | The file exports one function, `activate`, which is called the very first time your extension is 10 | activated (in this case by executing the command). Inside the `activate` function we call `registerCommand`. 11 | We pass the function containing the implementation of the command as the second parameter to 12 | `registerCommand`. 13 | 14 | ## Get up and running straight away 15 | * press `F5` to open a new window with your extension loaded 16 | * run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World` 17 | * set breakpoints in your code inside `src/extension.ts` to debug your extension 18 | * find output from your extension in the debug console 19 | 20 | ## Make changes 21 | * you can relaunch the extension from the debug toolbar after changing code in `src/extension.ts` 22 | * you can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes 23 | 24 | ## Explore the API 25 | * you can open the full set of our API when you open the file `node_modules/vscode/vscode.d.ts` 26 | 27 | ## Run tests 28 | * open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Launch Tests` 29 | * press `F5` to run the tests in a new window with your extension loaded 30 | * see the output of the test result in the debug console 31 | * make changes to `test/extension.test.ts` or create new test files inside the `test` folder 32 | * by convention, the test runner will only consider files matching the name pattern `**.test.ts` 33 | * you can create folders inside the `test` folder to structure your tests any way you want -------------------------------------------------------------------------------- /HelloWorld/vsix/helloworld-0.0.1.vsix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoovercj/vscode-api-playground/50bbb3ebaff0f5cdafc326160146d6f550f62532/HelloWorld/vsix/helloworld-0.0.1.vsix -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) Cody Hoover 2 | 3 | All rights reserved. 4 | 5 | MIT License 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files 8 | (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, 9 | publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do 10 | so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 15 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 16 | FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 17 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /NewFileWithLanguageMode/.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | node_modules -------------------------------------------------------------------------------- /NewFileWithLanguageMode/.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/src/**/*.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 | -------------------------------------------------------------------------------- /NewFileWithLanguageMode/.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 | } -------------------------------------------------------------------------------- /NewFileWithLanguageMode/.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": "0.1.0", 12 | 13 | // we want to run npm 14 | "command": "npm", 15 | 16 | // the command is a shell script 17 | "isShellCommand": true, 18 | 19 | // show the output window only if unrecognized errors occur. 20 | "showOutput": "silent", 21 | 22 | // we run the custom script "compile" as defined in package.json 23 | "args": ["run", "compile", "--loglevel", "silent"], 24 | 25 | // The tsc compiler is started in watching mode 26 | "isWatching": true, 27 | 28 | // use the standard tsc in watch mode problem matcher to find compile problems in the output. 29 | "problemMatcher": "$tsc-watch" 30 | } -------------------------------------------------------------------------------- /NewFileWithLanguageMode/README.md: -------------------------------------------------------------------------------- 1 | # New File with Language Mode 2 | 3 | ## Summary 4 | This extension adds two types of commands to open a new file with a specified language mode. 5 | 6 | * `editor.newFile.withCurrentLanguageMode` will open a new file with the same language mode as the currently active file 7 | * `editor.newFile.withLanguageMode.` will open a new file with specified id as the language mode. Commands are automatically created for each language known to VS Code, so you only need to set up a keybinding (described [below](#how-to-use)). 8 | 9 | The motivation for the first is that if you are working in a project, you might know that you need a new file of the same type but you don't know what to name it yet. Don't waste time coming up with a name just so you can save it and set the language mode and don't waste time manually setting the language mode. Simply assign a keyboard shortcut and start coding. 10 | 11 | The second command type is to help people that find themselves frequently opening markdown files to take throwaway notes in, or frequently opening typescript/powershell/python files to prototype scripts in, and want a quick way to get a scratchpad open in the language of their choice with the language features active. 12 | 13 | ## Inspiration: 14 | A stackoverflow user asked if it was possible to create a .HTML file when opening a new file in [this question](https://stackoverflow.com/questions/42677180/is-there-a-way-to-make-visual-code-create-html-file-by-default/). As far as I know there is not a built in way, but the `workspace.openTextDocument` API allows specifying a language mode for untitled files, so I created an extension that can do that and more. 15 | 16 | ## How to Use: 17 | The extension exposes a command called `editor.newFile.withCurrentLanguageMode` which can be added to the keybindings or can be triggered by searching for "Open new file with current language mode" in the command palette. Triggering that command will open a new file with the language mode of the current active document. 18 | 19 | The extension also creates commands for each language that can be bound to keybindings. I've shown two examples below: 20 | 21 | keybindings.json: 22 | ``` 23 | { 24 | "key": "ctrl+shift+t 1", 25 | "command": "editor.newFile.withLanguageMode.markdown", 26 | "when": "" 27 | }, 28 | { 29 | "key": "ctrl+shift+t 2", 30 | "command": "editor.newFile.withLanguageMode.html", 31 | "when": "" 32 | } 33 | ``` 34 | 35 | To find the language id, click on the language id in the lower right corner of the VS Code window OR open the command palette, type "Change Languae Mode", and press enter. This will bring up a list of the known languages. The value in parenthesis is the language id. You should also be able to see a list of the available commands at the bottom of the keybindings editor. 36 | 37 | ## See More 38 | 39 | This is a part of the my [API Playground repository](https://www.github.com/hoovercj/vscode-api-playground). Each subdirectory is a self-contained extension that demonstrates a particular API, repros a bug, answers a stackoverflow question, etc. 40 | 41 | 42 | ## Apis Used: 43 | * [Commands](https://code.visualstudio.com/docs/extensionAPI/vscode-api#_commands) - The commands API provides a way to add commands which can be triggered from the command palette or via key bindings. As demonstrated in this extension, they can be generated dynamically at runtime to create rich, semantic commands. 44 | * [Languages](https://code.visualstudio.com/docs/extensionAPI/vscode-api#_languages) - The languages API handles language specific features for VS Code. It exposes advanced features such as symbol navigation, formatting, etc. but in this extension I am only using it to get the list of supported languages. 45 | 46 | ## Release Notes 47 | 48 | ### 1.1.0 49 | * REMOVED Configuration: `editor.newFile.languageModes`, now commands are created automatically so any existing commands should still work 50 | 51 | ### 1.0.0 52 | * Added Command: `editor.newFile.withCurrentLanguageMode` 53 | * Added Command: `editor.newFile.withLanguageMode.` 54 | * Added Configuration: `editor.newFile.languageModes` 55 | 56 | 57 | ### 0.0.1 58 | 59 | Initial release with simple command for opening new file of a configured type. -------------------------------------------------------------------------------- /NewFileWithLanguageMode/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoovercj/vscode-api-playground/50bbb3ebaff0f5cdafc326160146d6f550f62532/NewFileWithLanguageMode/images/icon.png -------------------------------------------------------------------------------- /NewFileWithLanguageMode/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vscode-newfile-languagemode", 3 | "displayName": "New File with Language Mode", 4 | "description": "", 5 | "version": "1.1.0", 6 | "publisher": "hoovercj", 7 | "engines": { 8 | "vscode": "^1.10.0" 9 | }, 10 | "author": { 11 | "name": "Cody Hoover", 12 | "url": "www.codyhoover.com", 13 | "email": "vscode@codyhoover.com" 14 | }, 15 | "bugs": { 16 | "url": "https://www.github.com/hoovercj/vscode-api-playground/issues" 17 | }, 18 | "repository": { 19 | "type": "git", 20 | "url": "https://www.github.com/hoovercj/vscode-api-playground" 21 | }, 22 | "icon": "images/icon.png", 23 | "license": "MIT", 24 | "categories": [ 25 | "Other" 26 | ], 27 | "activationEvents": [ 28 | "*" 29 | ], 30 | "main": "./out/src/extension", 31 | "contributes": { 32 | "commands": [ 33 | { 34 | "command": "editor.newFile.withCurrentLanguageMode", 35 | "title": "Open new file with language mode of the currently active editor" 36 | } 37 | ], 38 | "configuration": { 39 | } 40 | }, 41 | "scripts": { 42 | "vscode:prepublish": "tsc -p ./", 43 | "compile": "tsc -watch -p ./", 44 | "postinstall": "node ./node_modules/vscode/bin/install" 45 | }, 46 | "devDependencies": { 47 | "typescript": "^2.0.3", 48 | "vscode": "^1.0.0", 49 | "mocha": "^2.3.3", 50 | "@types/node": "^6.0.40", 51 | "@types/mocha": "^2.2.32" 52 | } 53 | } -------------------------------------------------------------------------------- /NewFileWithLanguageMode/src/extension.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | import { ExtensionContext, workspace, window, commands, languages } from 'vscode'; 3 | 4 | let ctx: ExtensionContext; 5 | let customCommands = []; 6 | export function activate(context: ExtensionContext) { 7 | ctx = context; 8 | createCommandsForLanguages(); 9 | 10 | const command = commands.registerCommand('editor.newFile.withCurrentLanguageMode', () => { 11 | const language = window.activeTextEditor.document.languageId 12 | openTextDocumentWithLanguageId(language); 13 | }); 14 | 15 | ctx.subscriptions.push(command); 16 | } 17 | 18 | /** 19 | * Opens a text document with the provided language id. 20 | * If no id is provided, or the id is an empty string, 21 | * a document with no language mode will be opened. 22 | * @param {string} language The id of the language mode to open the document with. 23 | */ 24 | function openTextDocumentWithLanguageId(language: string): void { 25 | const options = language ? {language} : null; 26 | workspace.openTextDocument(options).then((document) => window.showTextDocument(document)); 27 | } 28 | 29 | /** 30 | * Creates a new command for every valid language id. 31 | * It gets the list of languages from vscode, 32 | * and for each language it creates a command 33 | * of the form `editor.newFile.withLanguageMode.`. 34 | * These can then be configured to be triggered via keyboard shortcuts. 35 | */ 36 | function createCommandsForLanguages(): void { 37 | disposeCustomCommands(); 38 | languages.getLanguages().then(languageList => { 39 | languageList.forEach(language => { 40 | customCommands.push(commands.registerCommand(`editor.newFile.withLanguageMode.${language}`, () => { 41 | openTextDocumentWithLanguageId(language) 42 | })); 43 | }); 44 | }); 45 | } 46 | 47 | function disposeCustomCommands(): void { 48 | customCommands.forEach(command => command.dispose()); 49 | customCommands = []; 50 | } 51 | 52 | // this method is called when your extension is deactivated 53 | export function deactivate() { 54 | disposeCustomCommands(); 55 | ctx.subscriptions.forEach(subscription => subscription.dispose()) 56 | } -------------------------------------------------------------------------------- /NewFileWithLanguageMode/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 myExtension from '../src/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("Something 1", () => { 19 | assert.equal(-1, [1, 2, 3].indexOf(5)); 20 | assert.equal(-1, [1, 2, 3].indexOf(0)); 21 | }); 22 | }); -------------------------------------------------------------------------------- /NewFileWithLanguageMode/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; -------------------------------------------------------------------------------- /NewFileWithLanguageMode/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "outDir": "out", 6 | "lib": [ 7 | "es6" 8 | ], 9 | "sourceMap": true, 10 | "rootDir": "." 11 | }, 12 | "exclude": [ 13 | "node_modules", 14 | ".vscode-test" 15 | ] 16 | } -------------------------------------------------------------------------------- /NewFileWithLanguageMode/vsix/vscode-api-playground-newfile-languagemode-0.0.1.vsix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoovercj/vscode-api-playground/50bbb3ebaff0f5cdafc326160146d6f550f62532/NewFileWithLanguageMode/vsix/vscode-api-playground-newfile-languagemode-0.0.1.vsix -------------------------------------------------------------------------------- /NewFileWithLanguageMode/vsix/vscode-newfile-languagemode-1.0.0.vsix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoovercj/vscode-api-playground/50bbb3ebaff0f5cdafc326160146d6f550f62532/NewFileWithLanguageMode/vsix/vscode-newfile-languagemode-1.0.0.vsix -------------------------------------------------------------------------------- /NewFileWithLanguageMode/vsix/vscode-newfile-languagemode-1.1.0.vsix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoovercj/vscode-api-playground/50bbb3ebaff0f5cdafc326160146d6f550f62532/NewFileWithLanguageMode/vsix/vscode-newfile-languagemode-1.1.0.vsix -------------------------------------------------------------------------------- /QuickPickDocumentPreview/.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | node_modules -------------------------------------------------------------------------------- /QuickPickDocumentPreview/.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/src/**/*.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 | -------------------------------------------------------------------------------- /QuickPickDocumentPreview/.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 | } -------------------------------------------------------------------------------- /QuickPickDocumentPreview/.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": "0.1.0", 12 | 13 | // we want to run npm 14 | "command": "npm", 15 | 16 | // the command is a shell script 17 | "isShellCommand": true, 18 | 19 | // show the output window only if unrecognized errors occur. 20 | "showOutput": "silent", 21 | 22 | // we run the custom script "compile" as defined in package.json 23 | "args": ["run", "compile", "--loglevel", "silent"], 24 | 25 | // The tsc compiler is started in watching mode 26 | "isWatching": true, 27 | 28 | // use the standard tsc in watch mode problem matcher to find compile problems in the output. 29 | "problemMatcher": "$tsc-watch" 30 | } -------------------------------------------------------------------------------- /QuickPickDocumentPreview/.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | out/test/** 4 | test/** 5 | src/** 6 | **/*.map 7 | .gitignore 8 | tsconfig.json 9 | vsc-extension-quickstart.md 10 | -------------------------------------------------------------------------------- /QuickPickDocumentPreview/README.md: -------------------------------------------------------------------------------- 1 | # QuickPickDocumentPreview - License Previewer 2 | 3 | ## Summary 4 | An extension that demonstrates how to set up a TextDocumentContentProvider to display content based on the current selection in a QuickPick. The content shown is backed by files bundled with the extension, but they are shown as read-only virtual documents. This is useful for bundling example code or documentation with an extension that users should be able to read but not modify. 5 | 6 | ![Demo](images/demo.gif) 7 | 8 | ## Inspiration: 9 | A gitter user asked if it was possible to react to quickpick changes. After they opened [this issue](https://github.com/Microsoft/vscode/issues/22334) on github, I realized that there was an api hook so I made this extension to demonstrate it. 10 | 11 | ## How to Use: 12 | Simply install the extension and trigger "Preview Licenses" from the command palette. 13 | 14 | ## Apis Used: 15 | * [QuickPick](https://code.visualstudio.com/docs/extensionAPI/vscode-api#QuickPickOptions): Gives the user a drop down list of choices. It also takes a function that will be triggered as the user cycles through the list. 16 | * [TextDocumentContentProvider](): Gives extensions the ability to provide virtual documents. These are documents that don't actually exist on disk, like the HTML preview of a markdown file. For this extension, it is used to provide a readonly/preview look at license files bundled with the extension. 17 | 18 | ## See More 19 | 20 | This is a part of the my API Playground repository. Each subdirectory is a self-contained extension that demonstrates a particular API, repros a bug, answers a stackoverflow question, etc. 21 | 22 | ## Acknowledgements 23 | 24 | License files sourced from [here](https://github.com/IQAndreas/markdown-licenses). 25 | 26 | ## Release Notes 27 | 28 | ### 0.0.1 29 | 30 | Initial release that allows live preview of license.md files while cycling through a QuickPick. -------------------------------------------------------------------------------- /QuickPickDocumentPreview/images/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoovercj/vscode-api-playground/50bbb3ebaff0f5cdafc326160146d6f550f62532/QuickPickDocumentPreview/images/demo.gif -------------------------------------------------------------------------------- /QuickPickDocumentPreview/licenses/apache-v2.0.md: -------------------------------------------------------------------------------- 1 | Apache License 2 | ============== 3 | 4 | _Version 2.0, January 2004_ 5 | _<>_ 6 | 7 | ### Terms and Conditions for use, reproduction, and distribution 8 | 9 | #### 1. Definitions 10 | 11 | “License” shall mean the terms and conditions for use, reproduction, and 12 | distribution as defined by Sections 1 through 9 of this document. 13 | 14 | “Licensor” shall mean the copyright owner or entity authorized by the copyright 15 | owner that is granting the License. 16 | 17 | “Legal Entity” shall mean the union of the acting entity and all other entities 18 | that control, are controlled by, or are under common control with that entity. 19 | For the purposes of this definition, “control” means **(i)** the power, direct or 20 | indirect, to cause the direction or management of such entity, whether by 21 | contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the 22 | outstanding shares, or **(iii)** beneficial ownership of such entity. 23 | 24 | “You” (or “Your”) shall mean an individual or Legal Entity exercising 25 | permissions granted by this License. 26 | 27 | “Source” form shall mean the preferred form for making modifications, including 28 | but not limited to software source code, documentation source, and configuration 29 | files. 30 | 31 | “Object” form shall mean any form resulting from mechanical transformation or 32 | translation of a Source form, including but not limited to compiled object code, 33 | generated documentation, and conversions to other media types. 34 | 35 | “Work” shall mean the work of authorship, whether in Source or Object form, made 36 | available under the License, as indicated by a copyright notice that is included 37 | in or attached to the work (an example is provided in the Appendix below). 38 | 39 | “Derivative Works” shall mean any work, whether in Source or Object form, that 40 | is based on (or derived from) the Work and for which the editorial revisions, 41 | annotations, elaborations, or other modifications represent, as a whole, an 42 | original work of authorship. For the purposes of this License, Derivative Works 43 | shall not include works that remain separable from, or merely link (or bind by 44 | name) to the interfaces of, the Work and Derivative Works thereof. 45 | 46 | “Contribution” shall mean any work of authorship, including the original version 47 | of the Work and any modifications or additions to that Work or Derivative Works 48 | thereof, that is intentionally submitted to Licensor for inclusion in the Work 49 | by the copyright owner or by an individual or Legal Entity authorized to submit 50 | on behalf of the copyright owner. For the purposes of this definition, 51 | “submitted” means any form of electronic, verbal, or written communication sent 52 | to the Licensor or its representatives, including but not limited to 53 | communication on electronic mailing lists, source code control systems, and 54 | issue tracking systems that are managed by, or on behalf of, the Licensor for 55 | the purpose of discussing and improving the Work, but excluding communication 56 | that is conspicuously marked or otherwise designated in writing by the copyright 57 | owner as “Not a Contribution.” 58 | 59 | “Contributor” shall mean Licensor and any individual or Legal Entity on behalf 60 | of whom a Contribution has been received by Licensor and subsequently 61 | incorporated within the Work. 62 | 63 | #### 2. Grant of Copyright License 64 | 65 | Subject to the terms and conditions of this License, each Contributor hereby 66 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 67 | irrevocable copyright license to reproduce, prepare Derivative Works of, 68 | publicly display, publicly perform, sublicense, and distribute the Work and such 69 | Derivative Works in Source or Object form. 70 | 71 | #### 3. Grant of Patent License 72 | 73 | Subject to the terms and conditions of this License, each Contributor hereby 74 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 75 | irrevocable (except as stated in this section) patent license to make, have 76 | made, use, offer to sell, sell, import, and otherwise transfer the Work, where 77 | such license applies only to those patent claims licensable by such Contributor 78 | that are necessarily infringed by their Contribution(s) alone or by combination 79 | of their Contribution(s) with the Work to which such Contribution(s) was 80 | submitted. If You institute patent litigation against any entity (including a 81 | cross-claim or counterclaim in a lawsuit) alleging that the Work or a 82 | Contribution incorporated within the Work constitutes direct or contributory 83 | patent infringement, then any patent licenses granted to You under this License 84 | for that Work shall terminate as of the date such litigation is filed. 85 | 86 | #### 4. Redistribution 87 | 88 | You may reproduce and distribute copies of the Work or Derivative Works thereof 89 | in any medium, with or without modifications, and in Source or Object form, 90 | provided that You meet the following conditions: 91 | 92 | * **(a)** You must give any other recipients of the Work or Derivative Works a copy of 93 | this License; and 94 | * **(b)** You must cause any modified files to carry prominent notices stating that You 95 | changed the files; and 96 | * **(c)** You must retain, in the Source form of any Derivative Works that You distribute, 97 | all copyright, patent, trademark, and attribution notices from the Source form 98 | of the Work, excluding those notices that do not pertain to any part of the 99 | Derivative Works; and 100 | * **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any 101 | Derivative Works that You distribute must include a readable copy of the 102 | attribution notices contained within such NOTICE file, excluding those notices 103 | that do not pertain to any part of the Derivative Works, in at least one of the 104 | following places: within a NOTICE text file distributed as part of the 105 | Derivative Works; within the Source form or documentation, if provided along 106 | with the Derivative Works; or, within a display generated by the Derivative 107 | Works, if and wherever such third-party notices normally appear. The contents of 108 | the NOTICE file are for informational purposes only and do not modify the 109 | License. You may add Your own attribution notices within Derivative Works that 110 | You distribute, alongside or as an addendum to the NOTICE text from the Work, 111 | provided that such additional attribution notices cannot be construed as 112 | modifying the License. 113 | 114 | You may add Your own copyright statement to Your modifications and may provide 115 | additional or different license terms and conditions for use, reproduction, or 116 | distribution of Your modifications, or for any such Derivative Works as a whole, 117 | provided Your use, reproduction, and distribution of the Work otherwise complies 118 | with the conditions stated in this License. 119 | 120 | #### 5. Submission of Contributions 121 | 122 | Unless You explicitly state otherwise, any Contribution intentionally submitted 123 | for inclusion in the Work by You to the Licensor shall be under the terms and 124 | conditions of this License, without any additional terms or conditions. 125 | Notwithstanding the above, nothing herein shall supersede or modify the terms of 126 | any separate license agreement you may have executed with Licensor regarding 127 | such Contributions. 128 | 129 | #### 6. Trademarks 130 | 131 | This License does not grant permission to use the trade names, trademarks, 132 | service marks, or product names of the Licensor, except as required for 133 | reasonable and customary use in describing the origin of the Work and 134 | reproducing the content of the NOTICE file. 135 | 136 | #### 7. Disclaimer of Warranty 137 | 138 | Unless required by applicable law or agreed to in writing, Licensor provides the 139 | Work (and each Contributor provides its Contributions) on an “AS IS” BASIS, 140 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, 141 | including, without limitation, any warranties or conditions of TITLE, 142 | NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are 143 | solely responsible for determining the appropriateness of using or 144 | redistributing the Work and assume any risks associated with Your exercise of 145 | permissions under this License. 146 | 147 | #### 8. Limitation of Liability 148 | 149 | In no event and under no legal theory, whether in tort (including negligence), 150 | contract, or otherwise, unless required by applicable law (such as deliberate 151 | and grossly negligent acts) or agreed to in writing, shall any Contributor be 152 | liable to You for damages, including any direct, indirect, special, incidental, 153 | or consequential damages of any character arising as a result of this License or 154 | out of the use or inability to use the Work (including but not limited to 155 | damages for loss of goodwill, work stoppage, computer failure or malfunction, or 156 | any and all other commercial damages or losses), even if such Contributor has 157 | been advised of the possibility of such damages. 158 | 159 | #### 9. Accepting Warranty or Additional Liability 160 | 161 | While redistributing the Work or Derivative Works thereof, You may choose to 162 | offer, and charge a fee for, acceptance of support, warranty, indemnity, or 163 | other liability obligations and/or rights consistent with this License. However, 164 | in accepting such obligations, You may act only on Your own behalf and on Your 165 | sole responsibility, not on behalf of any other Contributor, and only if You 166 | agree to indemnify, defend, and hold each Contributor harmless for any liability 167 | incurred by, or claims asserted against, such Contributor by reason of your 168 | accepting any such warranty or additional liability. 169 | 170 | _END OF TERMS AND CONDITIONS_ 171 | 172 | ### APPENDIX: How to apply the Apache License to your work 173 | 174 | To apply the Apache License to your work, attach the following boilerplate 175 | notice, with the fields enclosed by brackets `[]` replaced with your own 176 | identifying information. (Don't include the brackets!) The text should be 177 | enclosed in the appropriate comment syntax for the file format. We also 178 | recommend that a file or class name and description of purpose be included on 179 | the same “printed page” as the copyright notice for easier identification within 180 | third-party archives. 181 | 182 | Copyright [yyyy] [name of copyright owner] 183 | 184 | Licensed under the Apache License, Version 2.0 (the "License"); 185 | you may not use this file except in compliance with the License. 186 | You may obtain a copy of the License at 187 | 188 | http://www.apache.org/licenses/LICENSE-2.0 189 | 190 | Unless required by applicable law or agreed to in writing, software 191 | distributed under the License is distributed on an "AS IS" BASIS, 192 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 193 | See the License for the specific language governing permissions and 194 | limitations under the License. 195 | 196 | -------------------------------------------------------------------------------- /QuickPickDocumentPreview/licenses/artistic-v2.0.md: -------------------------------------------------------------------------------- 1 | The Artistic License 2.0 2 | ======================== 3 | 4 | _Copyright © 2000-2006, The Perl Foundation._ 5 | 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | ### Preamble 10 | 11 | This license establishes the terms under which a given free software 12 | Package may be copied, modified, distributed, and/or redistributed. 13 | The intent is that the Copyright Holder maintains some artistic 14 | control over the development of that Package while still keeping the 15 | Package available as open source and free software. 16 | 17 | You are always permitted to make arrangements wholly outside of this 18 | license directly with the Copyright Holder of a given Package. If the 19 | terms of this license do not permit the full use that you propose to 20 | make of the Package, you should contact the Copyright Holder and seek 21 | a different licensing arrangement. 22 | 23 | ### Definitions 24 | 25 | “Copyright Holder” means the individual(s) or organization(s) 26 | named in the copyright notice for the entire Package. 27 | 28 | “Contributor” means any party that has contributed code or other 29 | material to the Package, in accordance with the Copyright Holder's 30 | procedures. 31 | 32 | “You” and “your” means any person who would like to copy, 33 | distribute, or modify the Package. 34 | 35 | “Package” means the collection of files distributed by the 36 | Copyright Holder, and derivatives of that collection and/or of 37 | those files. A given Package may consist of either the Standard 38 | Version, or a Modified Version. 39 | 40 | “Distribute” means providing a copy of the Package or making it 41 | accessible to anyone else, or in the case of a company or 42 | organization, to others outside of your company or organization. 43 | 44 | “Distributor Fee” means any fee that you charge for Distributing 45 | this Package or providing support for this Package to another 46 | party. It does not mean licensing fees. 47 | 48 | “Standard Version” refers to the Package if it has not been 49 | modified, or has been modified only in ways explicitly requested 50 | by the Copyright Holder. 51 | 52 | “Modified Version” means the Package, if it has been changed, and 53 | such changes were not explicitly requested by the Copyright 54 | Holder. 55 | 56 | “Original License” means this Artistic License as Distributed with 57 | the Standard Version of the Package, in its current version or as 58 | it may be modified by The Perl Foundation in the future. 59 | 60 | “Source” form means the source code, documentation source, and 61 | configuration files for the Package. 62 | 63 | “Compiled” form means the compiled bytecode, object code, binary, 64 | or any other form resulting from mechanical transformation or 65 | translation of the Source form. 66 | 67 | 68 | ### Permission for Use and Modification Without Distribution 69 | 70 | **(1)** You are permitted to use the Standard Version and create and use 71 | Modified Versions for any purpose without restriction, provided that 72 | you do not Distribute the Modified Version. 73 | 74 | 75 | ### Permissions for Redistribution of the Standard Version 76 | 77 | **(2)** You may Distribute verbatim copies of the Source form of the 78 | Standard Version of this Package in any medium without restriction, 79 | either gratis or for a Distributor Fee, provided that you duplicate 80 | all of the original copyright notices and associated disclaimers. At 81 | your discretion, such verbatim copies may or may not include a 82 | Compiled form of the Package. 83 | 84 | **(3)** You may apply any bug fixes, portability changes, and other 85 | modifications made available from the Copyright Holder. The resulting 86 | Package will still be considered the Standard Version, and as such 87 | will be subject to the Original License. 88 | 89 | 90 | ### Distribution of Modified Versions of the Package as Source 91 | 92 | **(4)** You may Distribute your Modified Version as Source (either gratis 93 | or for a Distributor Fee, and with or without a Compiled form of the 94 | Modified Version) provided that you clearly document how it differs 95 | from the Standard Version, including, but not limited to, documenting 96 | any non-standard features, executables, or modules, and provided that 97 | you do at least ONE of the following: 98 | 99 | * **(a)** make the Modified Version available to the Copyright Holder 100 | of the Standard Version, under the Original License, so that the 101 | Copyright Holder may include your modifications in the Standard 102 | Version. 103 | * **(b)** ensure that installation of your Modified Version does not 104 | prevent the user installing or running the Standard Version. In 105 | addition, the Modified Version must bear a name that is different 106 | from the name of the Standard Version. 107 | * **(c)** allow anyone who receives a copy of the Modified Version to 108 | make the Source form of the Modified Version available to others 109 | under 110 | * **(i)** the Original License or 111 | * **(ii)** a license that permits the licensee to freely copy, 112 | modify and redistribute the Modified Version using the same 113 | licensing terms that apply to the copy that the licensee 114 | received, and requires that the Source form of the Modified 115 | Version, and of any works derived from it, be made freely 116 | available in that license fees are prohibited but Distributor 117 | Fees are allowed. 118 | 119 | 120 | ### Distribution of Compiled Forms of the Standard Version 121 | ### or Modified Versions without the Source 122 | 123 | **(5)** You may Distribute Compiled forms of the Standard Version without 124 | the Source, provided that you include complete instructions on how to 125 | get the Source of the Standard Version. Such instructions must be 126 | valid at the time of your distribution. If these instructions, at any 127 | time while you are carrying out such distribution, become invalid, you 128 | must provide new instructions on demand or cease further distribution. 129 | If you provide valid instructions or cease distribution within thirty 130 | days after you become aware that the instructions are invalid, then 131 | you do not forfeit any of your rights under this license. 132 | 133 | **(6)** You may Distribute a Modified Version in Compiled form without 134 | the Source, provided that you comply with Section 4 with respect to 135 | the Source of the Modified Version. 136 | 137 | 138 | ### Aggregating or Linking the Package 139 | 140 | **(7)** You may aggregate the Package (either the Standard Version or 141 | Modified Version) with other packages and Distribute the resulting 142 | aggregation provided that you do not charge a licensing fee for the 143 | Package. Distributor Fees are permitted, and licensing fees for other 144 | components in the aggregation are permitted. The terms of this license 145 | apply to the use and Distribution of the Standard or Modified Versions 146 | as included in the aggregation. 147 | 148 | **(8)** You are permitted to link Modified and Standard Versions with 149 | other works, to embed the Package in a larger work of your own, or to 150 | build stand-alone binary or bytecode versions of applications that 151 | include the Package, and Distribute the result without restriction, 152 | provided the result does not expose a direct interface to the Package. 153 | 154 | 155 | ### Items That are Not Considered Part of a Modified Version 156 | 157 | **(9)** Works (including, but not limited to, modules and scripts) that 158 | merely extend or make use of the Package, do not, by themselves, cause 159 | the Package to be a Modified Version. In addition, such works are not 160 | considered parts of the Package itself, and are not subject to the 161 | terms of this license. 162 | 163 | 164 | ### General Provisions 165 | 166 | **(10)** Any use, modification, and distribution of the Standard or 167 | Modified Versions is governed by this Artistic License. By using, 168 | modifying or distributing the Package, you accept this license. Do not 169 | use, modify, or distribute the Package, if you do not accept this 170 | license. 171 | 172 | **(11)** If your Modified Version has been derived from a Modified 173 | Version made by someone other than you, you are nevertheless required 174 | to ensure that your Modified Version complies with the requirements of 175 | this license. 176 | 177 | **(12)** This license does not grant you the right to use any trademark, 178 | service mark, tradename, or logo of the Copyright Holder. 179 | 180 | **(13)** This license includes the non-exclusive, worldwide, 181 | free-of-charge patent license to make, have made, use, offer to sell, 182 | sell, import and otherwise transfer the Package with respect to any 183 | patent claims licensable by the Copyright Holder that are necessarily 184 | infringed by the Package. If you institute patent litigation 185 | (including a cross-claim or counterclaim) against any party alleging 186 | that the Package constitutes direct or contributory patent 187 | infringement, then this Artistic License to you shall terminate on the 188 | date that such litigation is filed. 189 | 190 | **(14)** **Disclaimer of Warranty:** 191 | 192 | THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS 193 | IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED 194 | WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR 195 | NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL 196 | LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL 197 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 198 | DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF 199 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 200 | -------------------------------------------------------------------------------- /QuickPickDocumentPreview/licenses/bsd-2.md: -------------------------------------------------------------------------------- 1 | Simplified BSD License 2 | ====================== 3 | 4 | _Copyright © ``, ``_ 5 | _All rights reserved._ 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | The views and conclusions contained in the software and documentation are those 28 | of the authors and should not be interpreted as representing official policies, 29 | either expressed or implied, of the FreeBSD Project. 30 | -------------------------------------------------------------------------------- /QuickPickDocumentPreview/licenses/bsd-3.md: -------------------------------------------------------------------------------- 1 | Modified BSD License 2 | ==================== 3 | 4 | _Copyright © ``, ``_ 5 | _All rights reserved._ 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | 2. Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 3. Neither the name of the `` nor the 16 | names of its contributors may be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL `` BE LIABLE FOR ANY 23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /QuickPickDocumentPreview/licenses/epl-v1.0.md: -------------------------------------------------------------------------------- 1 | Eclipse Public License -v 1.0 2 | ============================= 3 | 4 | THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (“AGREEMENT”). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 5 | 6 | ### 1. Definitions 7 | 8 | “Contribution” means: 9 | * **a)** in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and 10 | * **b)** in the case of each subsequent Contributor: 11 | * **i)** changes to the Program, and 12 | * **ii)** additions to the Program; 13 | where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: **(i)** are separate modules of software distributed in conjunction with the Program under their own license agreement, and **(ii)** are not derivative works of the Program. 14 | 15 | “Contributor” means any person or entity that distributes the Program. 16 | 17 | “Licensed Patents ” mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. 18 | 19 | “Program” means the Contributions distributed in accordance with this Agreement. 20 | 21 | “Recipient” means anyone who receives the Program under this Agreement, including all Contributors. 22 | 23 | ### 2. Grant of Rights 24 | 25 | **a)** Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. 26 | 27 | **b)** Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. 28 | 29 | **c)** Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. 30 | 31 | **d)** Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. 32 | 33 | ### 3. Requirements 34 | 35 | A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: 36 | * **a)** it complies with the terms and conditions of this Agreement; and 37 | * **b)** its license agreement: 38 | * **i)** effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; 39 | * **ii)** effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; 40 | * **iii)** states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and 41 | * **iv)** states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. 42 | 43 | When the Program is made available in source code form: 44 | * **a)** it must be made available under this Agreement; and 45 | * **b)** a copy of this Agreement must be included with each copy of the Program. 46 | 47 | Contributors may not remove or alter any copyright notices contained within the Program. 48 | 49 | Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. 50 | 51 | ### 4. Commercial Distribution 52 | 53 | Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor (“Commercial Contributor”) hereby agrees to defend and indemnify every other Contributor (“Indemnified Contributor”) against any losses, damages and costs (collectively “Losses”) arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: **a)** promptly notify the Commercial Contributor in writing of such claim, and **b)** allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. 54 | 55 | For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. 56 | 57 | ### 5. No Warranty 58 | 59 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. 60 | 61 | ### 6. Disclaimer of Liability 62 | 63 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 64 | 65 | ### 7. General 66 | 67 | If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. 68 | 69 | If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. 70 | 71 | All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. 72 | 73 | Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. 74 | 75 | This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. 76 | 77 | -------------------------------------------------------------------------------- /QuickPickDocumentPreview/licenses/gnu-gpl-v1.0.md: -------------------------------------------------------------------------------- 1 | GNU General Public License 2 | ========================== 3 | 4 | _Version 1, February 1989_ 5 | _Copyright © 1989 Free Software Foundation, Inc._ 6 | _51 Franklin St, Fifth Floor Boston, MA 02110-1301 USA_ 7 | 8 | Everyone is permitted to copy and distribute verbatim copies 9 | of this license document, but changing it is not allowed. 10 | 11 | ### Preamble 12 | 13 | The license agreements of most software companies try to keep users 14 | at the mercy of those companies. By contrast, our General Public 15 | License is intended to guarantee your freedom to share and change free 16 | software--to make sure the software is free for all its users. The 17 | General Public License applies to the Free Software Foundation's 18 | software and to any other program whose authors commit to using it. 19 | You can use it for your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Specifically, the General Public License is designed to make 23 | sure that you have the freedom to give away or sell copies of free 24 | software, that you receive source code or can get it if you want it, 25 | that you can change the software or use pieces of it in new free 26 | programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of a such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must tell them their rights. 37 | 38 | We protect your rights with two steps: **(1)** copyright the software, and 39 | **(2)** offer you this license which gives you legal permission to copy, 40 | distribute and/or modify the software. 41 | 42 | Also, for each author's protection and ours, we want to make certain 43 | that everyone understands that there is no warranty for this free 44 | software. If the software is modified by someone else and passed on, we 45 | want its recipients to know that what they have is not the original, so 46 | that any problems introduced by others will not reflect on the original 47 | authors' reputations. 48 | 49 | The precise terms and conditions for copying, distribution and 50 | modification follow. 51 | 52 | ### TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 53 | 54 | **0.** This License Agreement applies to any program or other work which 55 | contains a notice placed by the copyright holder saying it may be 56 | distributed under the terms of this General Public License. The 57 | “Program”, below, refers to any such program or work, and a “work based 58 | on the Program” means either the Program or any work containing the 59 | Program or a portion of it, either verbatim or with modifications. Each 60 | licensee is addressed as “you”. 61 | 62 | **1.** You may copy and distribute verbatim copies of the Program's source 63 | code as you receive it, in any medium, provided that you conspicuously and 64 | appropriately publish on each copy an appropriate copyright notice and 65 | disclaimer of warranty; keep intact all the notices that refer to this 66 | General Public License and to the absence of any warranty; and give any 67 | other recipients of the Program a copy of this General Public License 68 | along with the Program. You may charge a fee for the physical act of 69 | transferring a copy. 70 | 71 | **2.** You may modify your copy or copies of the Program or any portion of 72 | it, and copy and distribute such modifications under the terms of Paragraph 73 | 1 above, provided that you also do the following: 74 | 75 | * **a)** cause the modified files to carry prominent notices stating that 76 | you changed the files and the date of any change; and 77 | * **b)** cause the whole of any work that you distribute or publish, that 78 | in whole or in part contains the Program or any part thereof, either 79 | with or without modifications, to be licensed at no charge to all 80 | third parties under the terms of this General Public License (except 81 | that you may choose to grant warranty protection to some or all 82 | third parties, at your option). 83 | * **c)** If the modified program normally reads commands interactively when 84 | run, you must cause it, when started running for such interactive use 85 | in the simplest and most usual way, to print or display an 86 | announcement including an appropriate copyright notice and a notice 87 | that there is no warranty (or else, saying that you provide a 88 | warranty) and that users may redistribute the program under these 89 | conditions, and telling the user how to view a copy of this General 90 | Public License. 91 | * **d)** You may charge a fee for the physical act of transferring a 92 | copy, and you may at your option offer warranty protection in 93 | exchange for a fee. 94 | 95 | Mere aggregation of another independent work with the Program (or its 96 | derivative) on a volume of a storage or distribution medium does not bring 97 | the other work under the scope of these terms. 98 | 99 | **3.** You may copy and distribute the Program (or a portion or derivative of 100 | it, under Paragraph 2) in object code or executable form under the terms of 101 | Paragraphs 1 and 2 above provided that you also do one of the following: 102 | 103 | * **a)** accompany it with the complete corresponding machine-readable 104 | source code, which must be distributed under the terms of 105 | Paragraphs 1 and 2 above; or, 106 | * **b)** accompany it with a written offer, valid for at least three 107 | years, to give any third party free (except for a nominal charge 108 | for the cost of distribution) a complete machine-readable copy of the 109 | corresponding source code, to be distributed under the terms of 110 | Paragraphs 1 and 2 above; or, 111 | * **c)** accompany it with the information you received as to where the 112 | corresponding source code may be obtained. (This alternative is 113 | allowed only for noncommercial distribution and only if you 114 | received the program in object code or executable form alone.) 115 | 116 | Source code for a work means the preferred form of the work for making 117 | modifications to it. For an executable file, complete source code means 118 | all the source code for all modules it contains; but, as a special 119 | exception, it need not include source code for modules which are standard 120 | libraries that accompany the operating system on which the executable 121 | file runs, or for standard header files or definitions files that 122 | accompany that operating system. 123 | 124 | **4.** You may not copy, modify, sublicense, distribute or transfer the 125 | Program except as expressly provided under this General Public License. 126 | Any attempt otherwise to copy, modify, sublicense, distribute or transfer 127 | the Program is void, and will automatically terminate your rights to use 128 | the Program under this License. However, parties who have received 129 | copies, or rights to use copies, from you under this General Public 130 | License will not have their licenses terminated so long as such parties 131 | remain in full compliance. 132 | 133 | **5.** By copying, distributing or modifying the Program (or any work based 134 | on the Program) you indicate your acceptance of this license to do so, 135 | and all its terms and conditions. 136 | 137 | **6.** Each time you redistribute the Program (or any work based on the 138 | Program), the recipient automatically receives a license from the original 139 | licensor to copy, distribute or modify the Program subject to these 140 | terms and conditions. You may not impose any further restrictions on the 141 | recipients' exercise of the rights granted herein. 142 | 143 | **7.** The Free Software Foundation may publish revised and/or new versions 144 | of the General Public License from time to time. Such new versions will 145 | be similar in spirit to the present version, but may differ in detail to 146 | address new problems or concerns. 147 | 148 | Each version is given a distinguishing version number. If the Program 149 | specifies a version number of the license which applies to it and “any 150 | later version”, you have the option of following the terms and conditions 151 | either of that version or of any later version published by the Free 152 | Software Foundation. If the Program does not specify a version number of 153 | the license, you may choose any version ever published by the Free Software 154 | Foundation. 155 | 156 | **8.** If you wish to incorporate parts of the Program into other free 157 | programs whose distribution conditions are different, write to the author 158 | to ask for permission. For software which is copyrighted by the Free 159 | Software Foundation, write to the Free Software Foundation; we sometimes 160 | make exceptions for this. Our decision will be guided by the two goals 161 | of preserving the free status of all derivatives of our free software and 162 | of promoting the sharing and reuse of software generally. 163 | 164 | ### NO WARRANTY 165 | 166 | **9.** BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 167 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 168 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 169 | PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 170 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 171 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 172 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 173 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 174 | REPAIR OR CORRECTION. 175 | 176 | **10.** IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 177 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 178 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 179 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 180 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 181 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 182 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 183 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 184 | POSSIBILITY OF SUCH DAMAGES. 185 | 186 | _END OF TERMS AND CONDITIONS_ 187 | 188 | ### Appendix: How to Apply These Terms to Your New Programs 189 | 190 | If you develop a new program, and you want it to be of the greatest 191 | possible use to humanity, the best way to achieve this is to make it 192 | free software which everyone can redistribute and change under these 193 | terms. 194 | 195 | To do so, attach the following notices to the program. It is safest to 196 | attach them to the start of each source file to most effectively convey 197 | the exclusion of warranty; and each file should have at least the 198 | “copyright” line and a pointer to where the full notice is found. 199 | 200 | 201 | Copyright (C) 19yy 202 | 203 | This program is free software; you can redistribute it and/or modify 204 | it under the terms of the GNU General Public License as published by 205 | the Free Software Foundation; either version 1, or (at your option) 206 | any later version. 207 | 208 | This program is distributed in the hope that it will be useful, 209 | but WITHOUT ANY WARRANTY; without even the implied warranty of 210 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 211 | GNU General Public License for more details. 212 | 213 | You should have received a copy of the GNU General Public License 214 | along with this program; if not, write to the Free Software 215 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA 216 | 217 | 218 | Also add information on how to contact you by electronic and paper mail. 219 | 220 | If the program is interactive, make it output a short notice like this 221 | when it starts in an interactive mode: 222 | 223 | Gnomovision version 69, Copyright (C) 19xx name of author 224 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 225 | This is free software, and you are welcome to redistribute it 226 | under certain conditions; type `show c' for details. 227 | 228 | The hypothetical commands `show w` and `show c` should show the 229 | appropriate parts of the General Public License. Of course, the 230 | commands you use may be called something other than `show w` and `show c`; 231 | they could even be mouse-clicks or menu items--whatever suits your program. 232 | 233 | You should also get your employer (if you work as a programmer) or your 234 | school, if any, to sign a “copyright disclaimer” for the program, if 235 | necessary. Here a sample; alter the names: 236 | 237 | Yoyodyne, Inc., hereby disclaims all copyright interest in the 238 | program `Gnomovision' (a program to direct compilers to make passes 239 | at assemblers) written by James Hacker. 240 | 241 | , 1 April 1989 242 | Ty Coon, President of Vice 243 | 244 | That's all there is to it! 245 | -------------------------------------------------------------------------------- /QuickPickDocumentPreview/licenses/gnu-gpl-v2.0.md: -------------------------------------------------------------------------------- 1 | GNU General Public License 2 | ========================== 3 | 4 | _Version 2, June 1991_ 5 | _Copyright © 1989, 1991 Free Software Foundation, Inc.,_ 6 | _51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA_ 7 | 8 | Everyone is permitted to copy and distribute verbatim copies 9 | of this license document, but changing it is not allowed. 10 | 11 | ### Preamble 12 | 13 | The licenses for most software are designed to take away your 14 | freedom to share and change it. By contrast, the GNU General Public 15 | License is intended to guarantee your freedom to share and change free 16 | software--to make sure the software is free for all its users. This 17 | General Public License applies to most of the Free Software 18 | Foundation's software and to any other program whose authors commit to 19 | using it. (Some other Free Software Foundation software is covered by 20 | the GNU Lesser General Public License instead.) You can apply it to 21 | your programs, too. 22 | 23 | When we speak of free software, we are referring to freedom, not 24 | price. Our General Public Licenses are designed to make sure that you 25 | have the freedom to distribute copies of free software (and charge for 26 | this service if you wish), that you receive source code or can get it 27 | if you want it, that you can change the software or use pieces of it 28 | in new free programs; and that you know you can do these things. 29 | 30 | To protect your rights, we need to make restrictions that forbid 31 | anyone to deny you these rights or to ask you to surrender the rights. 32 | These restrictions translate to certain responsibilities for you if you 33 | distribute copies of the software, or if you modify it. 34 | 35 | For example, if you distribute copies of such a program, whether 36 | gratis or for a fee, you must give the recipients all the rights that 37 | you have. You must make sure that they, too, receive or can get the 38 | source code. And you must show them these terms so they know their 39 | rights. 40 | 41 | We protect your rights with two steps: **(1)** copyright the software, and 42 | **(2)** offer you this license which gives you legal permission to copy, 43 | distribute and/or modify the software. 44 | 45 | Also, for each author's protection and ours, we want to make certain 46 | that everyone understands that there is no warranty for this free 47 | software. If the software is modified by someone else and passed on, we 48 | want its recipients to know that what they have is not the original, so 49 | that any problems introduced by others will not reflect on the original 50 | authors' reputations. 51 | 52 | Finally, any free program is threatened constantly by software 53 | patents. We wish to avoid the danger that redistributors of a free 54 | program will individually obtain patent licenses, in effect making the 55 | program proprietary. To prevent this, we have made it clear that any 56 | patent must be licensed for everyone's free use or not licensed at all. 57 | 58 | The precise terms and conditions for copying, distribution and 59 | modification follow. 60 | 61 | ### TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 62 | 63 | **0.** This License applies to any program or other work which contains 64 | a notice placed by the copyright holder saying it may be distributed 65 | under the terms of this General Public License. The “Program”, below, 66 | refers to any such program or work, and a “work based on the Program” 67 | means either the Program or any derivative work under copyright law: 68 | that is to say, a work containing the Program or a portion of it, 69 | either verbatim or with modifications and/or translated into another 70 | language. (Hereinafter, translation is included without limitation in 71 | the term “modification”.) Each licensee is addressed as “you”. 72 | 73 | Activities other than copying, distribution and modification are not 74 | covered by this License; they are outside its scope. The act of 75 | running the Program is not restricted, and the output from the Program 76 | is covered only if its contents constitute a work based on the 77 | Program (independent of having been made by running the Program). 78 | Whether that is true depends on what the Program does. 79 | 80 | **1.** You may copy and distribute verbatim copies of the Program's 81 | source code as you receive it, in any medium, provided that you 82 | conspicuously and appropriately publish on each copy an appropriate 83 | copyright notice and disclaimer of warranty; keep intact all the 84 | notices that refer to this License and to the absence of any warranty; 85 | and give any other recipients of the Program a copy of this License 86 | along with the Program. 87 | 88 | You may charge a fee for the physical act of transferring a copy, and 89 | you may at your option offer warranty protection in exchange for a fee. 90 | 91 | **2.** You may modify your copy or copies of the Program or any portion 92 | of it, thus forming a work based on the Program, and copy and 93 | distribute such modifications or work under the terms of Section 1 94 | above, provided that you also meet all of these conditions: 95 | 96 | * **a)** You must cause the modified files to carry prominent notices 97 | stating that you changed the files and the date of any change. 98 | * **b)** You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | * **c)** If the modified program normally reads commands interactively 103 | when run, you must cause it, when started running for such 104 | interactive use in the most ordinary way, to print or display an 105 | announcement including an appropriate copyright notice and a 106 | notice that there is no warranty (or else, saying that you provide 107 | a warranty) and that users may redistribute the program under 108 | these conditions, and telling the user how to view a copy of this 109 | License. (Exception: if the Program itself is interactive but 110 | does not normally print such an announcement, your work based on 111 | the Program is not required to print an announcement.) 112 | 113 | These requirements apply to the modified work as a whole. If 114 | identifiable sections of that work are not derived from the Program, 115 | and can be reasonably considered independent and separate works in 116 | themselves, then this License, and its terms, do not apply to those 117 | sections when you distribute them as separate works. But when you 118 | distribute the same sections as part of a whole which is a work based 119 | on the Program, the distribution of the whole must be on the terms of 120 | this License, whose permissions for other licensees extend to the 121 | entire whole, and thus to each and every part regardless of who wrote it. 122 | 123 | Thus, it is not the intent of this section to claim rights or contest 124 | your rights to work written entirely by you; rather, the intent is to 125 | exercise the right to control the distribution of derivative or 126 | collective works based on the Program. 127 | 128 | In addition, mere aggregation of another work not based on the Program 129 | with the Program (or with a work based on the Program) on a volume of 130 | a storage or distribution medium does not bring the other work under 131 | the scope of this License. 132 | 133 | **3.** You may copy and distribute the Program (or a work based on it, 134 | under Section 2) in object code or executable form under the terms of 135 | Sections 1 and 2 above provided that you also do one of the following: 136 | 137 | * **a)** Accompany it with the complete corresponding machine-readable 138 | source code, which must be distributed under the terms of Sections 139 | 1 and 2 above on a medium customarily used for software interchange; or, 140 | * **b)** Accompany it with a written offer, valid for at least three 141 | years, to give any third party, for a charge no more than your 142 | cost of physically performing source distribution, a complete 143 | machine-readable copy of the corresponding source code, to be 144 | distributed under the terms of Sections 1 and 2 above on a medium 145 | customarily used for software interchange; or, 146 | * **c)** Accompany it with the information you received as to the offer 147 | to distribute corresponding source code. (This alternative is 148 | allowed only for noncommercial distribution and only if you 149 | received the program in object code or executable form with such 150 | an offer, in accord with Subsection b above.) 151 | 152 | The source code for a work means the preferred form of the work for 153 | making modifications to it. For an executable work, complete source 154 | code means all the source code for all modules it contains, plus any 155 | associated interface definition files, plus the scripts used to 156 | control compilation and installation of the executable. However, as a 157 | special exception, the source code distributed need not include 158 | anything that is normally distributed (in either source or binary 159 | form) with the major components (compiler, kernel, and so on) of the 160 | operating system on which the executable runs, unless that component 161 | itself accompanies the executable. 162 | 163 | If distribution of executable or object code is made by offering 164 | access to copy from a designated place, then offering equivalent 165 | access to copy the source code from the same place counts as 166 | distribution of the source code, even though third parties are not 167 | compelled to copy the source along with the object code. 168 | 169 | **4.** You may not copy, modify, sublicense, or distribute the Program 170 | except as expressly provided under this License. Any attempt 171 | otherwise to copy, modify, sublicense or distribute the Program is 172 | void, and will automatically terminate your rights under this License. 173 | However, parties who have received copies, or rights, from you under 174 | this License will not have their licenses terminated so long as such 175 | parties remain in full compliance. 176 | 177 | **5.** You are not required to accept this License, since you have not 178 | signed it. However, nothing else grants you permission to modify or 179 | distribute the Program or its derivative works. These actions are 180 | prohibited by law if you do not accept this License. Therefore, by 181 | modifying or distributing the Program (or any work based on the 182 | Program), you indicate your acceptance of this License to do so, and 183 | all its terms and conditions for copying, distributing or modifying 184 | the Program or works based on it. 185 | 186 | **6.** Each time you redistribute the Program (or any work based on the 187 | Program), the recipient automatically receives a license from the 188 | original licensor to copy, distribute or modify the Program subject to 189 | these terms and conditions. You may not impose any further 190 | restrictions on the recipients' exercise of the rights granted herein. 191 | You are not responsible for enforcing compliance by third parties to 192 | this License. 193 | 194 | **7.** If, as a consequence of a court judgment or allegation of patent 195 | infringement or for any other reason (not limited to patent issues), 196 | conditions are imposed on you (whether by court order, agreement or 197 | otherwise) that contradict the conditions of this License, they do not 198 | excuse you from the conditions of this License. If you cannot 199 | distribute so as to satisfy simultaneously your obligations under this 200 | License and any other pertinent obligations, then as a consequence you 201 | may not distribute the Program at all. For example, if a patent 202 | license would not permit royalty-free redistribution of the Program by 203 | all those who receive copies directly or indirectly through you, then 204 | the only way you could satisfy both it and this License would be to 205 | refrain entirely from distribution of the Program. 206 | 207 | If any portion of this section is held invalid or unenforceable under 208 | any particular circumstance, the balance of the section is intended to 209 | apply and the section as a whole is intended to apply in other 210 | circumstances. 211 | 212 | It is not the purpose of this section to induce you to infringe any 213 | patents or other property right claims or to contest validity of any 214 | such claims; this section has the sole purpose of protecting the 215 | integrity of the free software distribution system, which is 216 | implemented by public license practices. Many people have made 217 | generous contributions to the wide range of software distributed 218 | through that system in reliance on consistent application of that 219 | system; it is up to the author/donor to decide if he or she is willing 220 | to distribute software through any other system and a licensee cannot 221 | impose that choice. 222 | 223 | This section is intended to make thoroughly clear what is believed to 224 | be a consequence of the rest of this License. 225 | 226 | **8.** If the distribution and/or use of the Program is restricted in 227 | certain countries either by patents or by copyrighted interfaces, the 228 | original copyright holder who places the Program under this License 229 | may add an explicit geographical distribution limitation excluding 230 | those countries, so that distribution is permitted only in or among 231 | countries not thus excluded. In such case, this License incorporates 232 | the limitation as if written in the body of this License. 233 | 234 | **9.** The Free Software Foundation may publish revised and/or new versions 235 | of the General Public License from time to time. Such new versions will 236 | be similar in spirit to the present version, but may differ in detail to 237 | address new problems or concerns. 238 | 239 | Each version is given a distinguishing version number. If the Program 240 | specifies a version number of this License which applies to it and “any 241 | later version”, you have the option of following the terms and conditions 242 | either of that version or of any later version published by the Free 243 | Software Foundation. If the Program does not specify a version number of 244 | this License, you may choose any version ever published by the Free Software 245 | Foundation. 246 | 247 | **10.** If you wish to incorporate parts of the Program into other free 248 | programs whose distribution conditions are different, write to the author 249 | to ask for permission. For software which is copyrighted by the Free 250 | Software Foundation, write to the Free Software Foundation; we sometimes 251 | make exceptions for this. Our decision will be guided by the two goals 252 | of preserving the free status of all derivatives of our free software and 253 | of promoting the sharing and reuse of software generally. 254 | 255 | ### NO WARRANTY 256 | 257 | **11.** BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 258 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 259 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 260 | PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 261 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 262 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 263 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 264 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 265 | REPAIR OR CORRECTION. 266 | 267 | **12.** IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 268 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 269 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 270 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 271 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 272 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 273 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 274 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 275 | POSSIBILITY OF SUCH DAMAGES. 276 | 277 | END OF TERMS AND CONDITIONS 278 | 279 | ### How to Apply These Terms to Your New Programs 280 | 281 | If you develop a new program, and you want it to be of the greatest 282 | possible use to the public, the best way to achieve this is to make it 283 | free software which everyone can redistribute and change under these terms. 284 | 285 | To do so, attach the following notices to the program. It is safest 286 | to attach them to the start of each source file to most effectively 287 | convey the exclusion of warranty; and each file should have at least 288 | the “copyright” line and a pointer to where the full notice is found. 289 | 290 | 291 | Copyright (C) 292 | 293 | This program is free software; you can redistribute it and/or modify 294 | it under the terms of the GNU General Public License as published by 295 | the Free Software Foundation; either version 2 of the License, or 296 | (at your option) any later version. 297 | 298 | This program is distributed in the hope that it will be useful, 299 | but WITHOUT ANY WARRANTY; without even the implied warranty of 300 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 301 | GNU General Public License for more details. 302 | 303 | You should have received a copy of the GNU General Public License along 304 | with this program; if not, write to the Free Software Foundation, Inc., 305 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 306 | 307 | Also add information on how to contact you by electronic and paper mail. 308 | 309 | If the program is interactive, make it output a short notice like this 310 | when it starts in an interactive mode: 311 | 312 | Gnomovision version 69, Copyright (C) year name of author 313 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 314 | This is free software, and you are welcome to redistribute it 315 | under certain conditions; type `show c' for details. 316 | 317 | The hypothetical commands `show w` and `show c` should show the appropriate 318 | parts of the General Public License. Of course, the commands you use may 319 | be called something other than `show w` and `show c`; they could even be 320 | mouse-clicks or menu items--whatever suits your program. 321 | 322 | You should also get your employer (if you work as a programmer) or your 323 | school, if any, to sign a “copyright disclaimer” for the program, if 324 | necessary. Here is a sample; alter the names: 325 | 326 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 327 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 328 | 329 | , 1 April 1989 330 | Ty Coon, President of Vice 331 | 332 | This General Public License does not permit incorporating your program into 333 | proprietary programs. If your program is a subroutine library, you may 334 | consider it more useful to permit linking proprietary applications with the 335 | library. If this is what you want to do, use the GNU Lesser General 336 | Public License instead of this License. 337 | -------------------------------------------------------------------------------- /QuickPickDocumentPreview/licenses/gnu-lgpl-v3.0.md: -------------------------------------------------------------------------------- 1 | GNU Lesser General Public License 2 | ================================= 3 | 4 | _Version 3, 29 June 2007_ 5 | _Copyright © 2007 Free Software Foundation, Inc. <>_ 6 | 7 | Everyone is permitted to copy and distribute verbatim copies 8 | of this license document, but changing it is not allowed. 9 | 10 | 11 | This version of the GNU Lesser General Public License incorporates 12 | the terms and conditions of version 3 of the GNU General Public 13 | License, supplemented by the additional permissions listed below. 14 | 15 | ### 0. Additional Definitions 16 | 17 | As used herein, “this License” refers to version 3 of the GNU Lesser 18 | General Public License, and the “GNU GPL” refers to version 3 of the GNU 19 | General Public License. 20 | 21 | “The Library” refers to a covered work governed by this License, 22 | other than an Application or a Combined Work as defined below. 23 | 24 | An “Application” is any work that makes use of an interface provided 25 | by the Library, but which is not otherwise based on the Library. 26 | Defining a subclass of a class defined by the Library is deemed a mode 27 | of using an interface provided by the Library. 28 | 29 | A “Combined Work” is a work produced by combining or linking an 30 | Application with the Library. The particular version of the Library 31 | with which the Combined Work was made is also called the “Linked 32 | Version”. 33 | 34 | The “Minimal Corresponding Source” for a Combined Work means the 35 | Corresponding Source for the Combined Work, excluding any source code 36 | for portions of the Combined Work that, considered in isolation, are 37 | based on the Application, and not on the Linked Version. 38 | 39 | The “Corresponding Application Code” for a Combined Work means the 40 | object code and/or source code for the Application, including any data 41 | and utility programs needed for reproducing the Combined Work from the 42 | Application, but excluding the System Libraries of the Combined Work. 43 | 44 | ### 1. Exception to Section 3 of the GNU GPL 45 | 46 | You may convey a covered work under sections 3 and 4 of this License 47 | without being bound by section 3 of the GNU GPL. 48 | 49 | ### 2. Conveying Modified Versions 50 | 51 | If you modify a copy of the Library, and, in your modifications, a 52 | facility refers to a function or data to be supplied by an Application 53 | that uses the facility (other than as an argument passed when the 54 | facility is invoked), then you may convey a copy of the modified 55 | version: 56 | 57 | * **a)** under this License, provided that you make a good faith effort to 58 | ensure that, in the event an Application does not supply the 59 | function or data, the facility still operates, and performs 60 | whatever part of its purpose remains meaningful, or 61 | 62 | * **b)** under the GNU GPL, with none of the additional permissions of 63 | this License applicable to that copy. 64 | 65 | ### 3. Object Code Incorporating Material from Library Header Files 66 | 67 | The object code form of an Application may incorporate material from 68 | a header file that is part of the Library. You may convey such object 69 | code under terms of your choice, provided that, if the incorporated 70 | material is not limited to numerical parameters, data structure 71 | layouts and accessors, or small macros, inline functions and templates 72 | (ten or fewer lines in length), you do both of the following: 73 | 74 | * **a)** Give prominent notice with each copy of the object code that the 75 | Library is used in it and that the Library and its use are 76 | covered by this License. 77 | * **b)** Accompany the object code with a copy of the GNU GPL and this license 78 | document. 79 | 80 | ### 4. Combined Works 81 | 82 | You may convey a Combined Work under terms of your choice that, 83 | taken together, effectively do not restrict modification of the 84 | portions of the Library contained in the Combined Work and reverse 85 | engineering for debugging such modifications, if you also do each of 86 | the following: 87 | 88 | * **a)** Give prominent notice with each copy of the Combined Work that 89 | the Library is used in it and that the Library and its use are 90 | covered by this License. 91 | 92 | * **b)** Accompany the Combined Work with a copy of the GNU GPL and this license 93 | document. 94 | 95 | * **c)** For a Combined Work that displays copyright notices during 96 | execution, include the copyright notice for the Library among 97 | these notices, as well as a reference directing the user to the 98 | copies of the GNU GPL and this license document. 99 | 100 | * **d)** Do one of the following: 101 | - **0)** Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | - **1)** Use a suitable shared library mechanism for linking with the 109 | Library. A suitable mechanism is one that **(a)** uses at run time 110 | a copy of the Library already present on the user's computer 111 | system, and **(b)** will operate properly with a modified version 112 | of the Library that is interface-compatible with the Linked 113 | Version. 114 | 115 | * **e)** Provide Installation Information, but only if you would otherwise 116 | be required to provide such information under section 6 of the 117 | GNU GPL, and only to the extent that such information is 118 | necessary to install and execute a modified version of the 119 | Combined Work produced by recombining or relinking the 120 | Application with a modified version of the Linked Version. (If 121 | you use option **4d0**, the Installation Information must accompany 122 | the Minimal Corresponding Source and Corresponding Application 123 | Code. If you use option **4d1**, you must provide the Installation 124 | Information in the manner specified by section 6 of the GNU GPL 125 | for conveying Corresponding Source.) 126 | 127 | ### 5. Combined Libraries 128 | 129 | You may place library facilities that are a work based on the 130 | Library side by side in a single library together with other library 131 | facilities that are not Applications and are not covered by this 132 | License, and convey such a combined library under terms of your 133 | choice, if you do both of the following: 134 | 135 | * **a)** Accompany the combined library with a copy of the same work based 136 | on the Library, uncombined with any other library facilities, 137 | conveyed under the terms of this License. 138 | * **b)** Give prominent notice with the combined library that part of it 139 | is a work based on the Library, and explaining where to find the 140 | accompanying uncombined form of the same work. 141 | 142 | ### 6. Revised Versions of the GNU Lesser General Public License 143 | 144 | The Free Software Foundation may publish revised and/or new versions 145 | of the GNU Lesser General Public License from time to time. Such new 146 | versions will be similar in spirit to the present version, but may 147 | differ in detail to address new problems or concerns. 148 | 149 | Each version is given a distinguishing version number. If the 150 | Library as you received it specifies that a certain numbered version 151 | of the GNU Lesser General Public License “or any later version” 152 | applies to it, you have the option of following the terms and 153 | conditions either of that published version or of any later version 154 | published by the Free Software Foundation. If the Library as you 155 | received it does not specify a version number of the GNU Lesser 156 | General Public License, you may choose any version of the GNU Lesser 157 | General Public License ever published by the Free Software Foundation. 158 | 159 | If the Library as you received it specifies that a proxy can decide 160 | whether future versions of the GNU Lesser General Public License shall 161 | apply, that proxy's public statement of acceptance of any version is 162 | permanent authorization for you to choose that version for the 163 | Library. 164 | -------------------------------------------------------------------------------- /QuickPickDocumentPreview/licenses/mit.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | ===================== 3 | 4 | Copyright © `` `` 5 | 6 | Permission is hereby granted, free of charge, to any person 7 | obtaining a copy of this software and associated documentation 8 | files (the “Software”), to deal in the Software without 9 | restriction, including without limitation the rights to use, 10 | copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the 12 | Software is furnished to do so, subject to the following 13 | conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | -------------------------------------------------------------------------------- /QuickPickDocumentPreview/licenses/mpl-v2.0.md: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | ### 1. Definitions 5 | 6 | **1.1. “Contributor”** 7 | means each individual or legal entity that creates, contributes to 8 | the creation of, or owns Covered Software. 9 | 10 | **1.2. “Contributor Version”** 11 | means the combination of the Contributions of others (if any) used 12 | by a Contributor and that particular Contributor's Contribution. 13 | 14 | **1.3. “Contribution”** 15 | means Covered Software of a particular Contributor. 16 | 17 | **1.4. “Covered Software”** 18 | means Source Code Form to which the initial Contributor has attached 19 | the notice in Exhibit A, the Executable Form of such Source Code 20 | Form, and Modifications of such Source Code Form, in each case 21 | including portions thereof. 22 | 23 | **1.5. “Incompatible With Secondary Licenses”** 24 | means 25 | 26 | * **(a)** that the initial Contributor has attached the notice described 27 | in Exhibit B to the Covered Software; or 28 | * **(b)** that the Covered Software was made available under the terms of 29 | version 1.1 or earlier of the License, but not also under the 30 | terms of a Secondary License. 31 | 32 | **1.6. “Executable Form”** 33 | means any form of the work other than Source Code Form. 34 | 35 | **1.7. “Larger Work”** 36 | means a work that combines Covered Software with other material, in 37 | a separate file or files, that is not Covered Software. 38 | 39 | **1.8. “License”** 40 | means this document. 41 | 42 | **1.9. “Licensable”** 43 | means having the right to grant, to the maximum extent possible, 44 | whether at the time of the initial grant or subsequently, any and 45 | all of the rights conveyed by this License. 46 | 47 | **1.10. “Modifications”** 48 | means any of the following: 49 | 50 | * **(a)** any file in Source Code Form that results from an addition to, 51 | deletion from, or modification of the contents of Covered 52 | Software; or 53 | * **(b)** any new file in Source Code Form that contains any Covered 54 | Software. 55 | 56 | **1.11. “Patent Claims” of a Contributor** 57 | means any patent claim(s), including without limitation, method, 58 | process, and apparatus claims, in any patent Licensable by such 59 | Contributor that would be infringed, but for the grant of the 60 | License, by the making, using, selling, offering for sale, having 61 | made, import, or transfer of either its Contributions or its 62 | Contributor Version. 63 | 64 | **1.12. “Secondary License”** 65 | means either the GNU General Public License, Version 2.0, the GNU 66 | Lesser General Public License, Version 2.1, the GNU Affero General 67 | Public License, Version 3.0, or any later versions of those 68 | licenses. 69 | 70 | **1.13. “Source Code Form”** 71 | means the form of the work preferred for making modifications. 72 | 73 | **1.14. “You” (or “Your”)** 74 | means an individual or a legal entity exercising rights under this 75 | License. For legal entities, “You” includes any entity that 76 | controls, is controlled by, or is under common control with You. For 77 | purposes of this definition, “control” means **(a)** the power, direct 78 | or indirect, to cause the direction or management of such entity, 79 | whether by contract or otherwise, or **(b)** ownership of more than 80 | fifty percent (50%) of the outstanding shares or beneficial 81 | ownership of such entity. 82 | 83 | 84 | ### 2. License Grants and Conditions 85 | 86 | #### 2.1. Grants 87 | 88 | Each Contributor hereby grants You a world-wide, royalty-free, 89 | non-exclusive license: 90 | 91 | * **(a)** under intellectual property rights (other than patent or trademark) 92 | Licensable by such Contributor to use, reproduce, make available, 93 | modify, display, perform, distribute, and otherwise exploit its 94 | Contributions, either on an unmodified basis, with Modifications, or 95 | as part of a Larger Work; and 96 | * **(b)** under Patent Claims of such Contributor to make, use, sell, offer 97 | for sale, have made, import, and otherwise transfer either its 98 | Contributions or its Contributor Version. 99 | 100 | #### 2.2. Effective Date 101 | 102 | The licenses granted in Section 2.1 with respect to any Contribution 103 | become effective for each Contribution on the date the Contributor first 104 | distributes such Contribution. 105 | 106 | #### 2.3. Limitations on Grant Scope 107 | 108 | The licenses granted in this Section 2 are the only rights granted under 109 | this License. No additional rights or licenses will be implied from the 110 | distribution or licensing of Covered Software under this License. 111 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 112 | Contributor: 113 | 114 | * **(a)** for any code that a Contributor has removed from Covered Software; 115 | or 116 | * **(b)** for infringements caused by: **(i)** Your and any other third party's 117 | modifications of Covered Software, or **(ii)** the combination of its 118 | Contributions with other software (except as part of its Contributor 119 | Version); or 120 | * **(c)** under Patent Claims infringed by Covered Software in the absence of 121 | its Contributions. 122 | 123 | This License does not grant any rights in the trademarks, service marks, 124 | or logos of any Contributor (except as may be necessary to comply with 125 | the notice requirements in Section 3.4). 126 | 127 | #### 2.4. Subsequent Licenses 128 | 129 | No Contributor makes additional grants as a result of Your choice to 130 | distribute the Covered Software under a subsequent version of this 131 | License (see Section 10.2) or under the terms of a Secondary License (if 132 | permitted under the terms of Section 3.3). 133 | 134 | #### 2.5. Representation 135 | 136 | Each Contributor represents that the Contributor believes its 137 | Contributions are its original creation(s) or it has sufficient rights 138 | to grant the rights to its Contributions conveyed by this License. 139 | 140 | #### 2.6. Fair Use 141 | 142 | This License is not intended to limit any rights You have under 143 | applicable copyright doctrines of fair use, fair dealing, or other 144 | equivalents. 145 | 146 | #### 2.7. Conditions 147 | 148 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 149 | in Section 2.1. 150 | 151 | 152 | ### 3. Responsibilities 153 | 154 | #### 3.1. Distribution of Source Form 155 | 156 | All distribution of Covered Software in Source Code Form, including any 157 | Modifications that You create or to which You contribute, must be under 158 | the terms of this License. You must inform recipients that the Source 159 | Code Form of the Covered Software is governed by the terms of this 160 | License, and how they can obtain a copy of this License. You may not 161 | attempt to alter or restrict the recipients' rights in the Source Code 162 | Form. 163 | 164 | #### 3.2. Distribution of Executable Form 165 | 166 | If You distribute Covered Software in Executable Form then: 167 | 168 | * **(a)** such Covered Software must also be made available in Source Code 169 | Form, as described in Section 3.1, and You must inform recipients of 170 | the Executable Form how they can obtain a copy of such Source Code 171 | Form by reasonable means in a timely manner, at a charge no more 172 | than the cost of distribution to the recipient; and 173 | 174 | * **(b)** You may distribute such Executable Form under the terms of this 175 | License, or sublicense it under different terms, provided that the 176 | license for the Executable Form does not attempt to limit or alter 177 | the recipients' rights in the Source Code Form under this License. 178 | 179 | #### 3.3. Distribution of a Larger Work 180 | 181 | You may create and distribute a Larger Work under terms of Your choice, 182 | provided that You also comply with the requirements of this License for 183 | the Covered Software. If the Larger Work is a combination of Covered 184 | Software with a work governed by one or more Secondary Licenses, and the 185 | Covered Software is not Incompatible With Secondary Licenses, this 186 | License permits You to additionally distribute such Covered Software 187 | under the terms of such Secondary License(s), so that the recipient of 188 | the Larger Work may, at their option, further distribute the Covered 189 | Software under the terms of either this License or such Secondary 190 | License(s). 191 | 192 | #### 3.4. Notices 193 | 194 | You may not remove or alter the substance of any license notices 195 | (including copyright notices, patent notices, disclaimers of warranty, 196 | or limitations of liability) contained within the Source Code Form of 197 | the Covered Software, except that You may alter any license notices to 198 | the extent required to remedy known factual inaccuracies. 199 | 200 | #### 3.5. Application of Additional Terms 201 | 202 | You may choose to offer, and to charge a fee for, warranty, support, 203 | indemnity or liability obligations to one or more recipients of Covered 204 | Software. However, You may do so only on Your own behalf, and not on 205 | behalf of any Contributor. You must make it absolutely clear that any 206 | such warranty, support, indemnity, or liability obligation is offered by 207 | You alone, and You hereby agree to indemnify every Contributor for any 208 | liability incurred by such Contributor as a result of warranty, support, 209 | indemnity or liability terms You offer. You may include additional 210 | disclaimers of warranty and limitations of liability specific to any 211 | jurisdiction. 212 | 213 | 214 | ### 4. Inability to Comply Due to Statute or Regulation 215 | 216 | If it is impossible for You to comply with any of the terms of this 217 | License with respect to some or all of the Covered Software due to 218 | statute, judicial order, or regulation then You must: **(a)** comply with 219 | the terms of this License to the maximum extent possible; and **(b)** 220 | describe the limitations and the code they affect. Such description must 221 | be placed in a text file included with all distributions of the Covered 222 | Software under this License. Except to the extent prohibited by statute 223 | or regulation, such description must be sufficiently detailed for a 224 | recipient of ordinary skill to be able to understand it. 225 | 226 | 227 | ### 5. Termination 228 | 229 | **5.1.** The rights granted under this License will terminate automatically 230 | if You fail to comply with any of its terms. However, if You become 231 | compliant, then the rights granted under this License from a particular 232 | Contributor are reinstated **(a)** provisionally, unless and until such 233 | Contributor explicitly and finally terminates Your grants, and **(b)** on an 234 | ongoing basis, if such Contributor fails to notify You of the 235 | non-compliance by some reasonable means prior to 60 days after You have 236 | come back into compliance. Moreover, Your grants from a particular 237 | Contributor are reinstated on an ongoing basis if such Contributor 238 | notifies You of the non-compliance by some reasonable means, this is the 239 | first time You have received notice of non-compliance with this License 240 | from such Contributor, and You become compliant prior to 30 days after 241 | Your receipt of the notice. 242 | 243 | **5.2.** If You initiate litigation against any entity by asserting a patent 244 | infringement claim (excluding declaratory judgment actions, 245 | counter-claims, and cross-claims) alleging that a Contributor Version 246 | directly or indirectly infringes any patent, then the rights granted to 247 | You by any and all Contributors for the Covered Software under Section 248 | 2.1 of this License shall terminate. 249 | 250 | **5.3.** In the event of termination under Sections 5.1 or 5.2 above, all 251 | end user license agreements (excluding distributors and resellers) which 252 | have been validly granted by You or Your distributors under this License 253 | prior to termination shall survive termination. 254 | 255 | 256 | ### 6. Disclaimer of Warranty 257 | 258 | > Covered Software is provided under this License on an “as is” 259 | > basis, without warranty of any kind, either expressed, implied, or 260 | > statutory, including, without limitation, warranties that the 261 | > Covered Software is free of defects, merchantable, fit for a 262 | > particular purpose or non-infringing. The entire risk as to the 263 | > quality and performance of the Covered Software is with You. 264 | > Should any Covered Software prove defective in any respect, You 265 | > (not any Contributor) assume the cost of any necessary servicing, 266 | > repair, or correction. This disclaimer of warranty constitutes an 267 | > essential part of this License. No use of any Covered Software is 268 | > authorized under this License except under this disclaimer. 269 | 270 | ### 7. Limitation of Liability 271 | 272 | > Under no circumstances and under no legal theory, whether tort 273 | > (including negligence), contract, or otherwise, shall any 274 | > Contributor, or anyone who distributes Covered Software as 275 | > permitted above, be liable to You for any direct, indirect, 276 | > special, incidental, or consequential damages of any character 277 | > including, without limitation, damages for lost profits, loss of 278 | > goodwill, work stoppage, computer failure or malfunction, or any 279 | > and all other commercial damages or losses, even if such party 280 | > shall have been informed of the possibility of such damages. This 281 | > limitation of liability shall not apply to liability for death or 282 | > personal injury resulting from such party's negligence to the 283 | > extent applicable law prohibits such limitation. Some 284 | > jurisdictions do not allow the exclusion or limitation of 285 | > incidental or consequential damages, so this exclusion and 286 | > limitation may not apply to You. 287 | 288 | 289 | ### 8. Litigation 290 | 291 | Any litigation relating to this License may be brought only in the 292 | courts of a jurisdiction where the defendant maintains its principal 293 | place of business and such litigation shall be governed by laws of that 294 | jurisdiction, without reference to its conflict-of-law provisions. 295 | Nothing in this Section shall prevent a party's ability to bring 296 | cross-claims or counter-claims. 297 | 298 | 299 | ### 9. Miscellaneous 300 | 301 | This License represents the complete agreement concerning the subject 302 | matter hereof. If any provision of this License is held to be 303 | unenforceable, such provision shall be reformed only to the extent 304 | necessary to make it enforceable. Any law or regulation which provides 305 | that the language of a contract shall be construed against the drafter 306 | shall not be used to construe this License against a Contributor. 307 | 308 | 309 | ### 10. Versions of the License 310 | 311 | #### 10.1. New Versions 312 | 313 | Mozilla Foundation is the license steward. Except as provided in Section 314 | 10.3, no one other than the license steward has the right to modify or 315 | publish new versions of this License. Each version will be given a 316 | distinguishing version number. 317 | 318 | #### 10.2. Effect of New Versions 319 | 320 | You may distribute the Covered Software under the terms of the version 321 | of the License under which You originally received the Covered Software, 322 | or under the terms of any subsequent version published by the license 323 | steward. 324 | 325 | #### 10.3. Modified Versions 326 | 327 | If you create software not governed by this License, and you want to 328 | create a new license for such software, you may create and use a 329 | modified version of this License if you rename the license and remove 330 | any references to the name of the license steward (except to note that 331 | such modified license differs from this License). 332 | 333 | #### 10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses 334 | 335 | If You choose to distribute Source Code Form that is Incompatible With 336 | Secondary Licenses under the terms of this version of the License, the 337 | notice described in Exhibit B of this License must be attached. 338 | 339 | ## Exhibit A - Source Code Form License Notice 340 | 341 | This Source Code Form is subject to the terms of the Mozilla Public 342 | License, v. 2.0. If a copy of the MPL was not distributed with this 343 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 344 | 345 | If it is not possible or desirable to put the notice in a particular 346 | file, then You may include the notice in a location (such as a LICENSE 347 | file in a relevant directory) where a recipient would be likely to look 348 | for such a notice. 349 | 350 | You may add additional accurate notices of copyright ownership. 351 | 352 | ## Exhibit B - “Incompatible With Secondary Licenses” Notice 353 | 354 | This Source Code Form is "Incompatible With Secondary Licenses", as 355 | defined by the Mozilla Public License, v. 2.0. 356 | 357 | 358 | -------------------------------------------------------------------------------- /QuickPickDocumentPreview/licenses/unlicense.md: -------------------------------------------------------------------------------- 1 | Unlicense (Public Domain) 2 | ============================ 3 | 4 | This is free and unencumbered software released into the public domain. 5 | 6 | Anyone is free to copy, modify, publish, use, compile, sell, or 7 | distribute this software, either in source code form or as a compiled 8 | binary, for any purpose, commercial or non-commercial, and by any 9 | means. 10 | 11 | In jurisdictions that recognize copyright laws, the author or authors 12 | of this software dedicate any and all copyright interest in the 13 | software to the public domain. We make this dedication for the benefit 14 | of the public at large and to the detriment of our heirs and 15 | successors. We intend this dedication to be an overt act of 16 | relinquishment in perpetuity of all present and future rights to this 17 | software under copyright law. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 23 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 24 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | For more information, please refer to <> 28 | -------------------------------------------------------------------------------- /QuickPickDocumentPreview/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vscode-quick-pick-document-preview", 3 | "displayName": "Quick Pick Document Preview", 4 | "description": "", 5 | "version": "0.0.1", 6 | "publisher": "hoovercj", 7 | "engines": { 8 | "vscode": "^1.10.0" 9 | }, 10 | "categories": [ 11 | "Other" 12 | ], 13 | "activationEvents": [ 14 | "onCommand:licenses.preview" 15 | ], 16 | "main": "./out/src/extension", 17 | "contributes": { 18 | "commands": [{ 19 | "command": "licenses.preview", 20 | "title": "Preview Licenses" 21 | }] 22 | }, 23 | "scripts": { 24 | "vscode:prepublish": "tsc -p ./", 25 | "compile": "tsc -watch -p ./", 26 | "postinstall": "node ./node_modules/vscode/bin/install", 27 | "test": "node ./node_modules/vscode/bin/test" 28 | }, 29 | "devDependencies": { 30 | "typescript": "^2.0.3", 31 | "vscode": "^1.1.0", 32 | "mocha": "^2.3.3", 33 | "@types/node": "^6.0.40", 34 | "@types/mocha": "^2.2.32" 35 | } 36 | } -------------------------------------------------------------------------------- /QuickPickDocumentPreview/preview.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoovercj/vscode-api-playground/50bbb3ebaff0f5cdafc326160146d6f550f62532/QuickPickDocumentPreview/preview.html -------------------------------------------------------------------------------- /QuickPickDocumentPreview/src/FileContentProvider.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | import * as path from 'path'; 3 | import * as vscode from 'vscode'; 4 | 5 | /** 6 | * A content provider that provides content by reading from files. 7 | * This is useful for exposing bundled source or documentation 8 | * files in a readonly preview form, especially in a quickpick setting. 9 | * 10 | * @export FileContentProvider as the default class. 11 | * @class FileContentProvider. 12 | * @implements {vscode.TextDocumentContentProvider} 13 | */ 14 | export default class FileContentProvider implements vscode.TextDocumentContentProvider { 15 | 16 | public _onDidChange = new vscode.EventEmitter(); 17 | private pathProvider: (filename: string) => string; 18 | private uri; 19 | 20 | public filename; 21 | public cache = {}; 22 | 23 | public constructor(uri: vscode.Uri, pathProvider: (filename: string) => string) { 24 | this.uri = uri; 25 | this.pathProvider = pathProvider; 26 | } 27 | 28 | get onDidChange() { 29 | return this._onDidChange.event; 30 | } 31 | 32 | /** 33 | * This is called any time `vscode.workspace.openTextDocument` or `vscode.previewHtml` 34 | * are called with a uri that matches the scheme this provider is registered for. 35 | * It is also called any time the onDidChange event is fired with a matching uri scheme. 36 | * 37 | * @param {vscode.Uri} uri The uri to provide content for. 38 | * @returns {(string | Thenable)} The content for the uri. 39 | * 40 | * @memberOf FileContentProvider 41 | */ 42 | public provideTextDocumentContent(uri: vscode.Uri): string | Thenable { 43 | // If there isn't currently any file selected, just return an empty string. 44 | if (!this.filename) { 45 | return ''; 46 | } 47 | 48 | // If there is a cached version of the file contents available, return that. 49 | if (this.cache[this.filename] != null) { 50 | return this.cache[this.filename].getText(); 51 | } 52 | 53 | // If there isn't a cached version, use the pathProvider to get the file path 54 | // from the filename, "open" the text document to get the text and cache it, 55 | // and return the text. 56 | return vscode.workspace.openTextDocument(new vscode.Uri().with({scheme: 'file', path: path.join(this.pathProvider(this.filename))})).then(doc => { 57 | this.cache[this.filename] = doc; 58 | return doc.getText(); 59 | }); 60 | } 61 | 62 | public clearCache() { 63 | this.cache = {}; 64 | } 65 | 66 | /** 67 | * Given a filename, triggers an update of the contents 68 | * of files provided by this content provider. 69 | * 70 | * @param {string} filename The name of the file to use for contents. 71 | * 72 | * @memberOf FileContentProvider 73 | */ 74 | public update(filename: string) { 75 | this.filename = filename; 76 | this._onDidChange.fire(this.uri); 77 | } 78 | } -------------------------------------------------------------------------------- /QuickPickDocumentPreview/src/extension.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | import * as vscode from 'vscode'; 3 | import * as path from 'path'; 4 | import * as fs from 'fs'; 5 | 6 | import FileContentProvider from './FileContentProvider'; 7 | 8 | // The command to trigger this extension. 9 | const COMMAND = 'licenses.preview'; 10 | 11 | // The scheme to provide content for (i.e the 'file' part of 'file://'). 12 | const SCHEME = 'licensepreview'; 13 | // This will show up as the tab title. 14 | const PATH = 'license.preview'; 15 | // Since we want to reuse a single preview pane, we define one uri up front to reuse. 16 | const URI = new vscode.Uri().with({scheme: SCHEME, path: PATH}); 17 | 18 | let ctx: vscode.ExtensionContext; 19 | let filenames = [] as string[]; 20 | 21 | export function activate(context: vscode.ExtensionContext) { 22 | ctx = context; 23 | const directoryPath = context.asAbsolutePath('licenses'); 24 | 25 | // Since the files we need are bundled with the extension, 26 | // we Populate the list of filenames asyncronously as the 27 | // extension activates so we don't have to do it every time 28 | // the command is invoked. 29 | fs.readdir(directoryPath, (err, files) => { 30 | if (err) { 31 | console.log(err); 32 | return; 33 | } 34 | 35 | filenames = files; 36 | }); 37 | 38 | // This function allows the TextDocumentContentProvider 39 | // to map filenames to full paths without having to know 40 | // if the filenames passed in are absolute or relative, 41 | // or what they are relative to. 42 | const pathProvider = (filename: string) => { 43 | return path.join(directoryPath, filename); 44 | } 45 | 46 | const provider = new FileContentProvider(URI, pathProvider); 47 | 48 | // Registering a provider for a given scheme means that all calls to "vscode.workspace.openTextDocument" 49 | // or "vscode.previewHtml" will get their content from the provider. 50 | const disposable1 = vscode.workspace.registerTextDocumentContentProvider(SCHEME, provider); 51 | 52 | const disposable2 = vscode.commands.registerCommand(COMMAND, async () => 53 | { 54 | provider.clearCache(); 55 | 56 | // Open a document with the predefined URI and then show it. 57 | const doc = await vscode.workspace.openTextDocument(URI); 58 | const column = vscode.window.activeTextEditor ? vscode.window.activeTextEditor.viewColumn : vscode.ViewColumn.One; 59 | const editor = await vscode.window.showTextDocument(doc, column, true); 60 | 61 | // Show a quick pick with a list of licenses. 62 | const pick = await vscode.window.showQuickPick(filenames, { 63 | // Each time a new item is focused, pass the selection to the provider. 64 | // This will make VS Code refresh the document contents to show the new item. 65 | onDidSelectItem: async (license) => provider.update(license) 66 | }); 67 | 68 | // If nothing was selected and the currently active editor is the preview editor, close it. 69 | if (!pick && vscode.window.activeTextEditor.document.uri.scheme === URI.scheme) { 70 | vscode.commands.executeCommand('workbench.action.closeActiveEditor'); 71 | } 72 | 73 | // TODO: Next VS Code update has the ability to provide content to the file. 74 | // Use that instead of leaving the preview editor open. 75 | // const content = await provider.provideTextDocumentContent(URI); 76 | // vscode.workspace.openTextDocument({language: 'markdown', content: content}) 77 | }); 78 | 79 | context.subscriptions.push(disposable1, disposable2); 80 | } 81 | 82 | // This method is called when your extension is deactivated. 83 | export function deactivate() { 84 | ctx.subscriptions.forEach(subscription => subscription.dispose()); 85 | } -------------------------------------------------------------------------------- /QuickPickDocumentPreview/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 myExtension from '../src/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("Something 1", () => { 19 | assert.equal(-1, [1, 2, 3].indexOf(5)); 20 | assert.equal(-1, [1, 2, 3].indexOf(0)); 21 | }); 22 | }); -------------------------------------------------------------------------------- /QuickPickDocumentPreview/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; -------------------------------------------------------------------------------- /QuickPickDocumentPreview/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "outDir": "out", 6 | "lib": [ 7 | "es6" 8 | ], 9 | "sourceMap": true, 10 | "rootDir": "." 11 | }, 12 | "exclude": [ 13 | "node_modules", 14 | ".vscode-test" 15 | ] 16 | } -------------------------------------------------------------------------------- /QuickPickDocumentPreview/vsix/vscode-quick-pick-document-preview-0.0.1.vsix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoovercj/vscode-api-playground/50bbb3ebaff0f5cdafc326160146d6f550f62532/QuickPickDocumentPreview/vsix/vscode-quick-pick-document-preview-0.0.1.vsix -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # API Playground 2 | 3 | This repo comprises several subdirectories, each of which is a self-contained extension that demonstrates a particular API, repros a bug, answers a stackoverflow question, etc. 4 | 5 | Each directory also contains a .vsix file that you can use to install the extension and try it out for yourself. 6 | 7 | ## Extensions: 8 | * [HelloWorld](HelloWorld/README.md): The default extension generated by the vscode yeoman generator 9 | * [SettingsCycler](SettingsCycler/README.md): An extension that provides commands to toggle or cycle through settings, such as diabling and enabling the minimap, switching between themes, etc. [Marketplace](https://marketplace.visualstudio.com/items?itemName=hoovercj.vscode-settings-cycler) 10 | * [NewFileWithLanguageMode](NewFileWithLanguageMode/README.md): An extension that provides commands to open new files with the language mode set. It allows opening files with the same language mode as the current file, or configuring keybindings to open files with any language mode. [Marketplace](https://marketplace.visualstudio.com/items?itemName=hoovercj.vscode-newfile-languagemode) / [Stackoverflow](https://stackoverflow.com/questions/42677180/is-there-a-way-to-make-visual-code-create-html-file-by-default) 11 | * [QuickPickDocumentPreview](QuickPickDocumentPreview/README.md): An extension that demonstrates using a TextDocumentContentProvider to preview different license files while cycling through a QuickPick menu. 12 | * [FocusActiveEditor](FocusActiveEditor/README.md): An extension that will collapse directories and focus the active editor when switching between editors. [Stackoverflow](https://stackoverflow.com/questions/42673828/how-to-collapse-explorer-folders-before-focusing-a-file-in-vcode) 13 | * [SymbolIcons](SymbolIcons/README.md): An extension that shows a list of all symbol types in vscode to demonstrate their icons. [Github](https://github.com/Microsoft/vscode/issues/21315) -------------------------------------------------------------------------------- /SettingsCycler/.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | node_modules -------------------------------------------------------------------------------- /SettingsCycler/.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/src/**/*.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 | -------------------------------------------------------------------------------- /SettingsCycler/.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 | } -------------------------------------------------------------------------------- /SettingsCycler/.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": "0.1.0", 12 | 13 | // we want to run npm 14 | "command": "npm", 15 | 16 | // the command is a shell script 17 | "isShellCommand": true, 18 | 19 | // show the output window only if unrecognized errors occur. 20 | "showOutput": "silent", 21 | 22 | // we run the custom script "compile" as defined in package.json 23 | "args": ["run", "compile", "--loglevel", "silent"], 24 | 25 | // The tsc compiler is started in watching mode 26 | "isWatching": true, 27 | 28 | // use the standard tsc in watch mode problem matcher to find compile problems in the output. 29 | "problemMatcher": "$tsc-watch" 30 | } -------------------------------------------------------------------------------- /SettingsCycler/README.md: -------------------------------------------------------------------------------- 1 | # Settings Cycler 2 | 3 | ## Summary 4 | Sometimes VS Code ships a new feature without a toggle command (`editor.minimap.enabled`, `explorer.autoReveal`). Sometimes you want to easily toggle between a light and dark themes. Maybe you want to do something even more complex and toggle multiple settings at once. 5 | 6 | This extension allows configuring commands to cycle through settings. At its simplest, this allows toggling things such as the minimap and statusbar visibility. At it's most complex, it allows cycling through lists of complex object values. 7 | 8 | ([See below](#how-to-use)) for how to use it. 9 | 10 | __Note:__ The configuration schema has changed in v1.0.0. I'm sorry for the breaking change, but if the extension detects old settings it will prompt to migrate them. 11 | 12 | ![Demo](images/demo.gif) 13 | 14 | ## How to Use: 15 | 16 | There are two ways to configure commands. Directly in the keybindings file using the `settings.cycle` command with args, or by adding `settings.cycle` to user or workspace settings. 17 | 18 | By default, the extension will only modify user settings unless the `overrideWorkspaceSettings` option is set to true for a group. When true, it will still default to user settings unless there is already a workspace setting in place that it can override, in which case ALL of the specified settings will be set in workspace settings. 19 | 20 | Adding `"settings.cycle.warnOnWorkspaceSettingsCollisions": true` will give a visual warning when a command fails. 21 | 22 | Note: I've used booleans and strings for the settings in the examples below, but any javascript object can be assigned. 23 | 24 | ### Option 1: Keybindings.json only 25 | 26 | If you like to keep your settings files small, you can use keybindings.json to pass the settings directly to the `settings.cycle` command as args as shown below: 27 | 28 | ```json 29 | { 30 | "key": "F4", 31 | "command": "toggle", 32 | "when": "editorTextFocus", 33 | "args": { 34 | "id": "zen", // must be unique 35 | "overrideWorkspaceSettings": true, 36 | "values": [ // Note: use the same settings in each values object 37 | { 38 | "editor.minimap.enabled": true, 39 | "workbench.statusBar.visible": true 40 | }, 41 | { 42 | "editor.minimap.enabled": false, 43 | "workbench.statusBar.visible": false 44 | } 45 | ] 46 | } 47 | } 48 | ``` 49 | 50 | ### Option 2: User settings + Keybindings.json 51 | 52 | #### Step 1: Add a configuration for the setting 53 | 54 | ```json 55 | "settings.cycle": [ 56 | { 57 | "id": "colorTheme", // must be unique 58 | "overrideWorkspaceSettings": false, 59 | "values": [ 60 | { 61 | "workbench.colorTheme": "Default Dark+" 62 | }, 63 | { 64 | "workbench.colorTheme": "Default Light+" 65 | } 66 | ] 67 | } 68 | ], 69 | ``` 70 | 71 | #### Step 2: Configure a keyboard shortcut 72 | 73 | Each `id` will generate a command that looks like `settings.cycle.`. So to configure a keybinding to toggle between the values set for `colorTheme`, add something like this to `keybindings.json`. 74 | 75 | ```json 76 | { 77 | "key": "ctrl+shift+t", 78 | "command": "settings.cycle.colorTheme", 79 | } 80 | ``` 81 | 82 | ## Issues 83 | 84 | If there are issues, set `"settings.cycle.logLevel": "log"`, copy the output, and [submit an issue](https://www.github.com/hoovercj/vscode-api-playground/new). 85 | 86 | ## Inspiration: 87 | A gitter user asked if it was possible to toggle `explorer.autoReveal` via a keyboard shortcut. It isn't, but I realized how general this problem was. Then @rebornix from the VS Code team chimed in and showed how this idea could be further expanded to work for multiple settings at once and be declared directly in the keybindings. Read his blog post about it [here](https://medium.com/hack-visual-studio-code/toggle-any-setting-in-vs-code-using-keyboard-shortcut-arguments-cdb5ddc56955). 88 | 89 | ## See More 90 | 91 | This is a part of the my [API Playground repository](https://www.github.com/hoovercj/vscode-api-playground). Each subdirectory is a self-contained extension that demonstrates a particular API, repros a bug, answers a stackoverflow question, etc. 92 | 93 | ## Apis Used: 94 | * [Commands](https://code.visualstudio.com/docs/extensionAPI/vscode-api#_commands) - The commands API provides a way to add commands which can be triggered from the command palette or via key bindings. As demonstrated in this extension, they can be generated dynamically at runtime to create rich, semantic commands, or a single command can be used by passing different args to it. 95 | * [Configuration](https://code.visualstudio.com/docs/extensionAPI/vscode-api#WorkspaceConfiguration) - The configuration API handles user and workspace settings for vscode. It allows extensions to react to configuration changes, to read configuration settings, and to write to them. 96 | 97 | ## Acknowledgements 98 | * v1.0.0 schema changes and idea for using command args come from @rebornix and his [toggle](https://github.com/rebornix/vscode-toggle) extension. 99 | 100 | ## Release Notes 101 | 102 | ### 1.0.0 103 | * Changed `settings.cycle` configuration schema 104 | * Added `settings.cycle` command which takes the new schema as args 105 | * Can now cycle multiple settings at once 106 | * Can now add arguments directly to the keybindings 107 | 108 | ### 0.0.2 109 | * Fixed README icon 110 | 111 | ### 0.0.1 112 | Initial release 113 | * Added `settings.cycle` configuration 114 | * Generate `settings.cycle.` commands -------------------------------------------------------------------------------- /SettingsCycler/_package.json.with.scope: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vscode-settings-cycler", 3 | "displayName": "Settings Cycler", 4 | "description": "Allows cycling through vscode settings using keyboard shortcuts", 5 | "version": "0.0.1", 6 | "publisher": "hoovercj", 7 | "engines": { 8 | "vscode": "^1.10.0" 9 | }, 10 | "author": { 11 | "name": "Cody Hoover", 12 | "url": "www.codyhoover.com", 13 | "email": "vscode@codyhoover.com" 14 | }, 15 | "bugs": { 16 | "url": "https://www.github.com/hoovercj/vscode-api-playground/issues" 17 | }, 18 | "repository": { 19 | "type": "git", 20 | "url": "https://www.github.com/hoovercj/vscode-api-playground" 21 | }, 22 | "icon": "images/icon.png", 23 | "license": "MIT", 24 | "categories": [ 25 | "Other" 26 | ], 27 | "activationEvents": [ 28 | "*" 29 | ], 30 | "main": "./out/src/extension", 31 | "contributes": { 32 | "configuration": { 33 | "properties": { 34 | "settings.cycle": { 35 | "type": "array", 36 | "default": [], 37 | "items": { 38 | "type": "object", 39 | "properties": { 40 | "setting": { 41 | "type": "string", 42 | "description": "The full setting name to change." 43 | }, 44 | "values": { 45 | "type": "array", 46 | "items": { 47 | "description": "A valid value for the setting" 48 | }, 49 | "default": [true, false] 50 | } 51 | // "scope": { 52 | // "type": "string", 53 | // "enum": [ 54 | // "user", 55 | // "workspace", 56 | // "default" 57 | // ], 58 | // "default": "default", 59 | // "description": "The scope to toggle the setting for. By default the settings will be inspected and the least specific possible setting will be changed. If only the user or workspace setting is set, that will be toggled, but if a both are set then the workspace setting will be toggled. To force the extension to use or or the other, use that for this setting." 60 | // } 61 | } 62 | } 63 | } 64 | } 65 | } 66 | }, 67 | "scripts": { 68 | "vscode:prepublish": "tsc -p ./", 69 | "compile": "tsc -watch -p ./", 70 | "postinstall": "node ./node_modules/vscode/bin/install" 71 | }, 72 | "devDependencies": { 73 | "typescript": "^2.0.3", 74 | "vscode": "^1.0.0", 75 | "mocha": "^2.3.3", 76 | "@types/node": "^6.0.40", 77 | "@types/mocha": "^2.2.32" 78 | }, 79 | "dependencies": { 80 | "deep-equal": "^1.0.1" 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /SettingsCycler/images/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoovercj/vscode-api-playground/50bbb3ebaff0f5cdafc326160146d6f550f62532/SettingsCycler/images/demo.gif -------------------------------------------------------------------------------- /SettingsCycler/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoovercj/vscode-api-playground/50bbb3ebaff0f5cdafc326160146d6f550f62532/SettingsCycler/images/icon.png -------------------------------------------------------------------------------- /SettingsCycler/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vscode-settings-cycler", 3 | "displayName": "Settings Cycler", 4 | "description": "Allows cycling through vscode settings using keyboard shortcuts", 5 | "version": "1.0.0", 6 | "publisher": "hoovercj", 7 | "engines": { 8 | "vscode": "^1.10.0" 9 | }, 10 | "author": { 11 | "name": "Cody Hoover", 12 | "url": "www.codyhoover.com", 13 | "email": "vscode@codyhoover.com" 14 | }, 15 | "bugs": { 16 | "url": "https://www.github.com/hoovercj/vscode-api-playground/issues" 17 | }, 18 | "repository": { 19 | "type": "git", 20 | "url": "https://www.github.com/hoovercj/vscode-api-playground" 21 | }, 22 | "icon": "images/icon.png", 23 | "license": "MIT", 24 | "categories": [ 25 | "Other" 26 | ], 27 | "activationEvents": [ 28 | "*" 29 | ], 30 | "main": "./out/src/extension", 31 | "contributes": { 32 | "configuration": { 33 | "properties": { 34 | "settings.cycle": { 35 | "type": "array", 36 | "items": { 37 | "type": "object", 38 | "properties": { 39 | "id": { 40 | "type": "string", 41 | "description": "The name of the command to be created for this grouping of settings. Should be unique across all groups." 42 | }, 43 | "values": { 44 | "type": "array", 45 | "description": "An array of setting groups to cycle through.", 46 | "items": { 47 | "type": "object", 48 | "description": "An object with the setting name as the object key and the setting value (string, boolean, object, etc.) as the object value." 49 | } 50 | }, 51 | "overrideWorkspaceSettings": { 52 | "type": "boolean", 53 | "description": "When false (default), and a setting in the command is present in workspace settings, the command will abort without changing any settings. When true, if there is a workspace setting set, it will be overridden.", 54 | "default": false 55 | } 56 | } 57 | } 58 | }, 59 | "settings.cycle.warnOnWorkspaceSettingsCollisions": { 60 | "type": "boolean", 61 | "default": true, 62 | "description": "Display a warning when commands fail to cycle settings due to existing workspace settings." 63 | }, 64 | "settings.cycle.logLevel": { 65 | "type": "string", 66 | "enum": [ 67 | "none", 68 | "error", 69 | "info", 70 | "log" 71 | ] 72 | } 73 | } 74 | } 75 | }, 76 | "scripts": { 77 | "vscode:prepublish": "tsc -p ./", 78 | "compile": "tsc -watch -p ./", 79 | "postinstall": "node ./node_modules/vscode/bin/install" 80 | }, 81 | "devDependencies": { 82 | "typescript": "^2.0.3", 83 | "vscode": "^1.0.0", 84 | "mocha": "^2.3.3", 85 | "@types/node": "^6.0.40", 86 | "@types/mocha": "^2.2.32" 87 | }, 88 | "dependencies": { 89 | "deep-equal": "^1.0.1" 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /SettingsCycler/publish.bat: -------------------------------------------------------------------------------- 1 | vsce publish --baseImagesUrl https://github.com/hoovercj/vscode-api-playground/raw/master/SettingsCycler -------------------------------------------------------------------------------- /SettingsCycler/src/extension.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | import { MessageOptions, ExtensionContext, workspace, WorkspaceConfiguration, window, commands as Commands, languages } from 'vscode'; 3 | import { ILogger, Logger, LogLevel } from './logger'; 4 | 5 | const deepEqual = require('deep-equal') 6 | 7 | type Dictionary = { [key: string]: V }; 8 | 9 | let ctx: ExtensionContext; 10 | let customCommandDisposables = []; 11 | let commandsSettings = [] as Command[]; 12 | var indexCache: Dictionary = {}; 13 | let logger: ILogger; 14 | 15 | export function activate(context: ExtensionContext) { 16 | ctx = context; 17 | initializeLogger(); 18 | detectLegacySettings(); 19 | createCommandsForSettings(); 20 | ctx.subscriptions.push(Commands.registerCommand('settings.cycle', cycleSetting)); 21 | workspace.onDidChangeConfiguration(onDidChangeConfiguration); 22 | logger.log("Activation complete"); 23 | } 24 | 25 | enum Scope { 26 | Global, 27 | Workspace, 28 | None 29 | } 30 | 31 | class Command { 32 | id: string; 33 | values: Dictionary[]; 34 | overrideWorkspaceSettings: boolean 35 | } 36 | 37 | function cycleSetting(command: Command): void { 38 | logger.info(`Cycle Setting: ${command.id}`); 39 | if (!command || !command.id) { 40 | logger.error("Error cycling setting: please specify an 'id'."); 41 | return; 42 | } 43 | 44 | if (!command.values) { 45 | logger.error(`Error cycling setting: no values provided for id ${command.id}`); 46 | return; 47 | } 48 | 49 | 50 | // Decide which scope (if at all) to set 51 | const config = workspace.getConfiguration(); 52 | const commandSettings = getCommandSettings(command); 53 | const scope = getScopeForCommand(commandSettings, command.overrideWorkspaceSettings, config); 54 | if (scope === Scope.None) { 55 | const message = `Cannot cycle setting for ${command.id} as a setting already exists in the current workspace. Set \`"overrideWorkspaceSettings": true\` to override anyway.`; 56 | logger.warn(message) 57 | if (config.get('settings.cycle.warnOnWorkspaceSettingsCollisions', true)) { 58 | window.showWarningMessage(message); 59 | } 60 | return; 61 | } 62 | const useGlobal = scope === Scope.Global; 63 | const currentSettings = getCurrentSettings(commandSettings, config, useGlobal) 64 | const index = getNextIndex(command, currentSettings, indexCache); 65 | setNewSettings(command.values[index], config, useGlobal); 66 | indexCache[command.id] = index; 67 | } 68 | 69 | function getCommandSettings(command: Command): Set { 70 | const allSettings = new Set(); 71 | 72 | command.values.forEach(value => 73 | Object.keys(value).forEach(setting => 74 | allSettings.add(setting) 75 | ) 76 | ); 77 | 78 | logger.log(`"${command.id}" cycles these settings: ${[...allSettings].join(', ')}`); 79 | 80 | return allSettings; 81 | } 82 | 83 | function getCurrentSettings(settingsIds: Set, config: WorkspaceConfiguration, useGlobal: boolean): Dictionary { 84 | let currentOptions: Dictionary = {}; 85 | 86 | [...settingsIds].forEach(key => { 87 | let val = config.inspect(key); 88 | if (useGlobal) { 89 | currentOptions[key] = val.globalValue !== undefined ? val.globalValue : val.defaultValue; 90 | } else { 91 | currentOptions[key] = val.globalValue !== undefined ? val.workspaceValue : val.defaultValue; 92 | } 93 | logger.log('Reading current settings:'); 94 | logger.log(`${key}: ${config.get(key)}`); 95 | logger.log(`-- Global: ${JSON.stringify(val.globalValue)}`); 96 | logger.log(`-- Workspace: ${JSON.stringify(val.workspaceValue)}`); 97 | logger.log(`-- Default: ${JSON.stringify(val.defaultValue)}`); 98 | }); 99 | return currentOptions; 100 | } 101 | 102 | function getNextIndex(command: Command, currentSettings: Dictionary, indexCache?: Dictionary): number { 103 | 104 | if (indexCache && indexCache[command.id] !== undefined) { 105 | const cachedIndex = indexCache[command.id]; 106 | const newIndex = (indexCache[command.id] + 1) % command.values.length; 107 | logger.log(`Cached ${command.id} index: ${cachedIndex}`); 108 | logger.log(`New ${command.id} index: ${newIndex}`); 109 | return newIndex; 110 | } 111 | 112 | // Note: This assumes that the list of settings will be the same at each stage 113 | for (let index = 0; index < command.values.length; index++) { 114 | const candidate = command.values[index]; 115 | if (deepEqual(candidate, currentSettings)) { 116 | const newIndex = (index + 1) % command.values.length; 117 | logger.log(`New ${command.id} index: ${newIndex}`); 118 | return newIndex; 119 | } 120 | } 121 | 122 | logger.log(`New ${command.id} index: 0 - Actual settings don't match settings specified for ${command.id}.`); 123 | return 0; 124 | } 125 | 126 | function setNewSettings(newSettings: Dictionary, config: WorkspaceConfiguration, useGlobal: boolean) { 127 | Object.keys(newSettings).forEach(key => { 128 | logger.info(`Setting ${key} in ${useGlobal ? 'global' : 'workspace'} settings: ${JSON.stringify(newSettings[key])}`); 129 | config.update(key, newSettings[key], useGlobal); 130 | }); 131 | } 132 | 133 | function getScopeForCommand(settingsIds: Set, overrideWorkspaceSettings: boolean, config: WorkspaceConfiguration): Scope { 134 | 135 | let scope = Scope.Global; 136 | 137 | for (let key of settingsIds.values()) { 138 | let setting = config.inspect(key); 139 | let settingScope = getScopeForSetting(overrideWorkspaceSettings, setting); 140 | if (settingScope === Scope.None) { 141 | return Scope.None; 142 | } else if (settingScope === Scope.Workspace) { 143 | scope = settingScope; 144 | } 145 | } 146 | return scope; 147 | } 148 | 149 | function getScopeForSetting(overrideWorkspaceSettings: boolean, setting: { key: string; globalValue?: {}; workspaceValue?: {}; }): Scope { 150 | // TODO: If the scope is specified as global and the workspace setting shadows it, it doesn't update 151 | // Scope is removed from package.json until the above behavior is changed 152 | 153 | const hasWorkspaceValue = setting.workspaceValue != null; 154 | 155 | // Default to global if there is no workspace setting 156 | if (!hasWorkspaceValue) { 157 | return Scope.Global; 158 | // If there is a workspace setting, only override it if 159 | // the settings say to. 160 | } else if (overrideWorkspaceSettings) { 161 | logger.log(`${setting.key} has a workspacevalue that will be overridden`); 162 | return Scope.Workspace; 163 | // If they don't say to override, set the scope to none. 164 | // This is because updating the settings won't do anything 165 | // anyway until the TODO above is addressed. 166 | } else { 167 | return Scope.None; 168 | } 169 | } 170 | 171 | function createCommandsForSettings(): void { 172 | const config = workspace.getConfiguration('settings'); 173 | const commands = config.get('cycle'); 174 | 175 | // Don't dispose and create new commands these settings haven't changed 176 | if (deepEqual(commandsSettings, commands)) { 177 | logger.log(`Cycler Settings have not changed, don't create new commands`); 178 | return; 179 | } 180 | 181 | logger.info(`Registering commands for ${commands.map(command => command.id).join(', ')}`); 182 | disposeCustomCommands(); 183 | commandsSettings = commands; 184 | commands.forEach(command => { 185 | customCommandDisposables.push(Commands.registerCommand(`settings.cycle.${command.id}`, () => { 186 | cycleSetting(command); 187 | })); 188 | }); 189 | } 190 | 191 | function onDidChangeConfiguration() { 192 | initializeLogger(); 193 | createCommandsForSettings(); 194 | } 195 | 196 | function initializeLogger() { 197 | const logLevel = LogLevel[workspace.getConfiguration('settings.cycle').get('logLevel', 'error')]; 198 | if (logger) { 199 | logger.setLogLevel(logLevel) 200 | } else { 201 | logger = new Logger(logLevel); 202 | } 203 | } 204 | 205 | function disposeCustomCommands(): void { 206 | customCommandDisposables.forEach(command => command.dispose()); 207 | customCommandDisposables = []; 208 | } 209 | 210 | function detectLegacySettings(): void { 211 | const settingsConfiguration = workspace.getConfiguration('settings'); 212 | const config = settingsConfiguration.inspect('cycle'); 213 | const useGlobal = config.workspaceValue !== 'undefined'; 214 | const settings: any = useGlobal ? config.globalValue : config.workspaceValue; 215 | 216 | if (!settings) { 217 | return; 218 | } 219 | 220 | const newSettings = []; 221 | for (let index = 0; index < settings.length; index++) { 222 | const oldSetting = settings[index]; 223 | const id = oldSetting.setting; 224 | const oldValues = oldSetting.values; 225 | 226 | if (typeof(id) !== "string" || oldValues.length <= 0) { 227 | return; 228 | } 229 | 230 | const newValues = []; 231 | oldValues.map(value => { 232 | const newValue = {}; 233 | newValue[id] = value 234 | newValues.push(newValue); 235 | }); 236 | 237 | const newSetting = { 238 | id, 239 | values: newValues 240 | } as Command; 241 | newSettings.push(newSetting) 242 | } 243 | 244 | if (newSettings.length > 0) { 245 | logger.log(`Found ${newSettings.length} legacy settings`); 246 | window.showInformationMessage("Settings Cycler's configuration schema has changed. Automatically update your settings?", "Yes").then(value => { 247 | if (value === "Yes") { 248 | logger.log(`Converting ${newSettings.length} legacy settings to new settings.`); 249 | settingsConfiguration.update('cycle', newSettings, useGlobal); 250 | } 251 | }); 252 | } 253 | } 254 | 255 | 256 | // this method is called when your extension is deactivated 257 | export function deactivate() { 258 | disposeCustomCommands(); 259 | logger.dispose(); 260 | ctx.subscriptions.forEach(subscription => subscription.dispose()) 261 | } -------------------------------------------------------------------------------- /SettingsCycler/src/logger.ts: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------------------------- 2 | * Copyright (c) Cody Hoover. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | * ------------------------------------------------------------------------------------------ */ 5 | 6 | import { OutputChannel, window } from 'vscode'; 7 | 8 | export enum LogLevel { 9 | none, 10 | error, 11 | warn, 12 | info, 13 | log 14 | } 15 | 16 | export interface ILogger { 17 | setLogLevel(level: LogLevel): void; 18 | error(message: string): void; 19 | warn(message: string): void; 20 | info(message: string): void; 21 | log(message: string): void; 22 | dispose(): void; 23 | } 24 | 25 | export class Logger implements ILogger { 26 | private level: LogLevel; 27 | private outputChannel: OutputChannel; 28 | 29 | public constructor(level: LogLevel = LogLevel.error) { 30 | this.level = level; 31 | this.outputChannel = window.createOutputChannel('Settings Cycler'); 32 | } 33 | 34 | public setLogLevel(level: LogLevel): void { 35 | console.log('Settings Cycler: Log level ' + level); 36 | this.level = level; 37 | } 38 | 39 | public log(message: string): void { 40 | if (this.level >= LogLevel.log) { 41 | console.log('Settings Cycler: ' + message); 42 | this.outputChannel.appendLine(message); 43 | } 44 | } 45 | 46 | public info(message: string): void { 47 | if (this.level >= LogLevel.info) { 48 | console.info('Settings Cycler: ' + message); 49 | this.outputChannel.appendLine(message); 50 | } 51 | } 52 | 53 | public warn(message: string): void { 54 | if (this.level >= LogLevel.warn) { 55 | console.warn('Settings Cycler: ' + message); 56 | this.outputChannel.appendLine(message); 57 | } 58 | } 59 | 60 | public error(message: string): void { 61 | if (this.level >= LogLevel.error) { 62 | console.error('Settings Cycler: ' + message); 63 | this.outputChannel.appendLine(message); 64 | } 65 | } 66 | 67 | public dispose(): void { 68 | if (this.outputChannel) { 69 | this.outputChannel.dispose(); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /SettingsCycler/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 myExtension from '../src/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("Something 1", () => { 19 | assert.equal(-1, [1, 2, 3].indexOf(5)); 20 | assert.equal(-1, [1, 2, 3].indexOf(0)); 21 | }); 22 | }); -------------------------------------------------------------------------------- /SettingsCycler/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; -------------------------------------------------------------------------------- /SettingsCycler/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "outDir": "out", 6 | "lib": [ 7 | "es6" 8 | ], 9 | "sourceMap": true, 10 | "rootDir": "." 11 | }, 12 | "exclude": [ 13 | "node_modules", 14 | ".vscode-test" 15 | ] 16 | } -------------------------------------------------------------------------------- /SettingsCycler/vsix/vscode-settings-cycler-0.0.1.vsix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoovercj/vscode-api-playground/50bbb3ebaff0f5cdafc326160146d6f550f62532/SettingsCycler/vsix/vscode-settings-cycler-0.0.1.vsix -------------------------------------------------------------------------------- /SettingsCycler/vsix/vscode-settings-cycler-1.0.0.vsix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoovercj/vscode-api-playground/50bbb3ebaff0f5cdafc326160146d6f550f62532/SettingsCycler/vsix/vscode-settings-cycler-1.0.0.vsix -------------------------------------------------------------------------------- /SymbolIcons/.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | node_modules -------------------------------------------------------------------------------- /SymbolIcons/.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/src/**/*.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 | -------------------------------------------------------------------------------- /SymbolIcons/.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 | } -------------------------------------------------------------------------------- /SymbolIcons/.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": "0.1.0", 12 | 13 | // we want to run npm 14 | "command": "npm", 15 | 16 | // the command is a shell script 17 | "isShellCommand": true, 18 | 19 | // show the output window only if unrecognized errors occur. 20 | "showOutput": "silent", 21 | 22 | // we run the custom script "compile" as defined in package.json 23 | "args": ["run", "compile", "--loglevel", "silent"], 24 | 25 | // The tsc compiler is started in watching mode 26 | "isWatching": true, 27 | 28 | // use the standard tsc in watch mode problem matcher to find compile problems in the output. 29 | "problemMatcher": "$tsc-watch" 30 | } -------------------------------------------------------------------------------- /SymbolIcons/README.md: -------------------------------------------------------------------------------- 1 | # Symbol Icons 2 | 3 | ## Summary 4 | This extension implements the DocumentSymbolProvider interface to make it easy to preview the icons each of the symbol kinds in the vscode api (e.g. field, property, method, class, etc.). 5 | 6 | ## Inspiration: 7 | I noticed that fields and properties were using the same icon in the document symbols list but not in the intellisense/autocomplete list. I found the root cause, opened a [github issue](https://github.com/Microsoft/vscode/issues/21315), and used this extension to verify my fix. 8 | 9 | ## How to Use: 10 | Open a file named "icons.ts" and press `ctrl+shift+O` on a Windows machine or use the `Go to Symbol in File...` command to see a list of symbols. 11 | ![Document symbol icons](images/documentSymbolPreview.png) 12 | 13 | ## Apis Used: 14 | * [DocumentSymbolProvider](https://code.visualstudio.com/docs/extensionAPI/vscode-api#_a-namedocumentsymbolprovideraspan-classcodeitem-id590documentsymbolproviderspan) - Provides symbol list and navigation to symbols within a document 15 | 16 | ## See More 17 | 18 | This is a part of the my API Playground repository. Each subdirectory is a self-contained extension that demonstrates a particular API, repros a bug, answers a stackoverflow question, etc. 19 | 20 | ## Release Notes 21 | 22 | ### 0.0.1 23 | 24 | Initial release with a document symbol provider that shows each icon. -------------------------------------------------------------------------------- /SymbolIcons/images/documentSymbolPreview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoovercj/vscode-api-playground/50bbb3ebaff0f5cdafc326160146d6f550f62532/SymbolIcons/images/documentSymbolPreview.png -------------------------------------------------------------------------------- /SymbolIcons/images/documentSymbolPreviewOld.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoovercj/vscode-api-playground/50bbb3ebaff0f5cdafc326160146d6f550f62532/SymbolIcons/images/documentSymbolPreviewOld.png -------------------------------------------------------------------------------- /SymbolIcons/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "symbols-test", 3 | "displayName": "symbols-test", 4 | "description": "", 5 | "version": "0.0.1", 6 | "publisher": "hoovercj", 7 | "engines": { 8 | "vscode": "^1.5.0" 9 | }, 10 | "categories": [ 11 | "Other" 12 | ], 13 | "activationEvents": [ 14 | "*" 15 | ], 16 | "main": "./out/src/extension", 17 | "contributes": { 18 | }, 19 | "scripts": { 20 | "vscode:prepublish": "tsc -p ./", 21 | "compile": "tsc -watch -p ./", 22 | "postinstall": "node ./node_modules/vscode/bin/install" 23 | }, 24 | "devDependencies": { 25 | "typescript": "^2.0.3", 26 | "vscode": "^1.0.0", 27 | "mocha": "^2.3.3", 28 | "@types/node": "^6.0.40", 29 | "@types/mocha": "^2.2.32" 30 | } 31 | } -------------------------------------------------------------------------------- /SymbolIcons/src/extension.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | import { ExtensionContext } from 'vscode'; 3 | import { SymbolKindIconPreviewDocumentSymbolProvider } from './symbolKindIconPreviewDocumentSymbolProvider'; 4 | 5 | let ctx: ExtensionContext; 6 | 7 | export function activate(context: ExtensionContext) { 8 | ctx = context; 9 | const symbolKindPreviewDocumentSymbolProvider = new SymbolKindIconPreviewDocumentSymbolProvider(context); 10 | symbolKindPreviewDocumentSymbolProvider.register(); 11 | } 12 | 13 | // this method is called when your extension is deactivated 14 | export function deactivate() { 15 | ctx.subscriptions.forEach(subscription => subscription.dispose()) 16 | } -------------------------------------------------------------------------------- /SymbolIcons/src/symbolKindIconPreviewDocumentSymbolProvider.ts: -------------------------------------------------------------------------------- 1 | import { ExtensionContext, DocumentSymbolProvider, languages, TextDocument, CancellationToken, SymbolInformation, SymbolKind, Location, Position, DocumentFilter } from 'vscode'; 2 | 3 | export class SymbolKindIconPreviewDocumentSymbolProvider implements DocumentSymbolProvider { 4 | 5 | private context: ExtensionContext; 6 | 7 | constructor(context: ExtensionContext) { 8 | this.context = context; 9 | } 10 | 11 | public register() { 12 | let symbolProviderRegistration = languages.registerDocumentSymbolProvider({ language: 'typescript', pattern: "**/icons.ts"}, this); 13 | this.context.subscriptions.push(symbolProviderRegistration); 14 | } 15 | 16 | public provideDocumentSymbols (document: TextDocument, token: CancellationToken): SymbolInformation[] | Thenable { 17 | return [ 18 | { 19 | location: new Location(document.uri, new Position(0,0)), 20 | kind: SymbolKind.Array, 21 | name: "Array" 22 | }, 23 | { 24 | location: new Location(document.uri, new Position(0,0)), 25 | kind: SymbolKind.Boolean, 26 | name: "Boolean" 27 | }, 28 | { 29 | location: new Location(document.uri, new Position(0,0)), 30 | kind: SymbolKind.Class, 31 | name: "Class" 32 | }, 33 | { 34 | location: new Location(document.uri, new Position(0,0)), 35 | kind: SymbolKind.Constant, 36 | name: "Constant" 37 | }, 38 | { 39 | location: new Location(document.uri, new Position(0,0)), 40 | kind: SymbolKind.Constructor, 41 | name: "Constructor" 42 | }, 43 | { 44 | location: new Location(document.uri, new Position(0,0)), 45 | kind: SymbolKind.Enum, 46 | name: "Enum" 47 | }, 48 | { 49 | location: new Location(document.uri, new Position(0,0)), 50 | kind: SymbolKind.Field, 51 | name: "Field" 52 | }, 53 | { 54 | location: new Location(document.uri, new Position(0,0)), 55 | kind: SymbolKind.File, 56 | name: "File" 57 | }, 58 | { 59 | location: new Location(document.uri, new Position(0,0)), 60 | kind: SymbolKind.Function, 61 | name: "Function" 62 | }, 63 | { 64 | location: new Location(document.uri, new Position(0,0)), 65 | kind: SymbolKind.Interface, 66 | name: "Interface" 67 | }, 68 | { 69 | location: new Location(document.uri, new Position(0,0)), 70 | kind: SymbolKind.Key, 71 | name: "Key" 72 | }, 73 | { 74 | location: new Location(document.uri, new Position(0,0)), 75 | kind: SymbolKind.Method, 76 | name: "Method" 77 | }, 78 | { 79 | location: new Location(document.uri, new Position(0,0)), 80 | kind: SymbolKind.Module, 81 | name: "Module" 82 | }, 83 | { 84 | location: new Location(document.uri, new Position(0,0)), 85 | kind: SymbolKind.Namespace, 86 | name: "Namespace" 87 | }, 88 | { 89 | location: new Location(document.uri, new Position(0,0)), 90 | kind: SymbolKind.Null, 91 | name: "Null" 92 | }, 93 | { 94 | location: new Location(document.uri, new Position(0,0)), 95 | kind: SymbolKind.Number, 96 | name: "Number" 97 | }, 98 | { 99 | location: new Location(document.uri, new Position(0,0)), 100 | kind: SymbolKind.Object, 101 | name: "Object" 102 | }, 103 | { 104 | location: new Location(document.uri, new Position(0,0)), 105 | kind: SymbolKind.Package, 106 | name: "Package" 107 | }, 108 | { 109 | location: new Location(document.uri, new Position(0,0)), 110 | kind: SymbolKind.Property, 111 | name: "Property" 112 | }, 113 | { 114 | location: new Location(document.uri, new Position(0,0)), 115 | kind: SymbolKind.String, 116 | name: "String" 117 | }, 118 | { 119 | location: new Location(document.uri, new Position(0,0)), 120 | kind: SymbolKind.Variable, 121 | name: "Variable" 122 | }, 123 | ]; 124 | } 125 | } -------------------------------------------------------------------------------- /SymbolIcons/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 myExtension from '../src/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("Something 1", () => { 19 | assert.equal(-1, [1, 2, 3].indexOf(5)); 20 | assert.equal(-1, [1, 2, 3].indexOf(0)); 21 | }); 22 | }); -------------------------------------------------------------------------------- /SymbolIcons/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; -------------------------------------------------------------------------------- /SymbolIcons/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "outDir": "out", 6 | "lib": [ 7 | "es6" 8 | ], 9 | "sourceMap": true, 10 | "rootDir": "." 11 | }, 12 | "exclude": [ 13 | "node_modules", 14 | ".vscode-test" 15 | ] 16 | } -------------------------------------------------------------------------------- /SymbolIcons/vsix/vscode-api-playground-symbol-icons-0.0.1.vsix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoovercj/vscode-api-playground/50bbb3ebaff0f5cdafc326160146d6f550f62532/SymbolIcons/vsix/vscode-api-playground-symbol-icons-0.0.1.vsix --------------------------------------------------------------------------------