diff --git a/extensions/configuration-editing/OSSREADME.json b/extensions/configuration-editing/OSSREADME.json new file mode 100644 index 00000000000..4744d2b3f24 --- /dev/null +++ b/extensions/configuration-editing/OSSREADME.json @@ -0,0 +1,9 @@ +// ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS: + +[{ + "name": "Microsoft/node-jsonc-parser", + "version": "0.0.0", + "license": "MIT", + "isProd": true, + "repositoryURL": "https://github.com/Microsoft/node-jsonc-parser" +}] diff --git a/extensions/configuration-editing/package.json b/extensions/configuration-editing/package.json new file mode 100644 index 00000000000..60ca2473717 --- /dev/null +++ b/extensions/configuration-editing/package.json @@ -0,0 +1,25 @@ +{ + "name": "configuration-editing", + "version": "0.0.1", + "publisher": "vscode", + "engines": { + "vscode": "^1.0.0" + }, + "categories": [ + "Languages", "Other" + ], + "activationEvents": [ + "onLanguage:json" + ], + "main": "./out/extension", + "scripts": { + "compile": "gulp compile-extension:configuration-editing", + "watch": "gulp watch-extension:configuration-editing" + }, + "devDependencies": { + "vscode": "^0.11.0" + }, + "dependencies": { + "jsonc-parser": "^0.2.1" + } +} diff --git a/extensions/configuration-editing/src/extension.ts b/extensions/configuration-editing/src/extension.ts new file mode 100644 index 00000000000..41680f1795d --- /dev/null +++ b/extensions/configuration-editing/src/extension.ts @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +'use strict'; + +import * as vscode from 'vscode'; +import {getLocation} from 'jsonc-parser'; + +export function activate(context) { + + const commands = vscode.commands.getCommands(true); + + //keybindings.json command-suggestions + const disposable = vscode.languages.registerCompletionItemProvider({ pattern: '**/keybindings.json' }, { + + provideCompletionItems(document, position, token) { + const location = getLocation(document.getText(), document.offsetAt(position)); + if (location.path[1] === 'command') { + return commands.then(ids => { + return ids.map(id => { + let item = new vscode.CompletionItem(id); + item.kind = vscode.CompletionItemKind.Value; + return item; + }); + }); + } + } + }); + + context.subscriptions.push(disposable); +} diff --git a/extensions/configuration-editing/src/typings/ref.d.ts b/extensions/configuration-editing/src/typings/ref.d.ts new file mode 100644 index 00000000000..7f4835e6747 --- /dev/null +++ b/extensions/configuration-editing/src/typings/ref.d.ts @@ -0,0 +1,10 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +/// +/// +/// +/// +/// \ No newline at end of file