├── .editorconfig ├── .eslintrc.json ├── .gitignore ├── .vscode ├── extensions.json ├── launch.json └── settings.json ├── .vscodeignore ├── CHANGELOG.md ├── CONTRIBUTING.md ├── README.md ├── extension.js ├── images ├── cursors-group.png ├── editor-group.png ├── functions-group.png ├── nasc-macbook-pro-vscode-touch-bar.png ├── source-group.png └── tools-groups.png ├── jsconfig.json ├── license ├── nasc-macbook-pro-vscode-touch-bar.jpg ├── package.json └── test ├── extension.test.js └── index.js /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs 2 | # editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | indent_style = space 8 | indent_size = 4 9 | 10 | # We recommend you to keep these unchanged 11 | end_of_line = lf 12 | charset = utf-8 13 | trim_trailing_whitespace = true 14 | insert_final_newline = true 15 | 16 | [*.md] 17 | trim_trailing_whitespace = false 18 | indent_size = 4 19 | 20 | [package.json] 21 | indent_size = 4 22 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": false, 4 | "commonjs": true, 5 | "es6": true, 6 | "node": true 7 | }, 8 | "parserOptions": { 9 | "ecmaFeatures": { 10 | "jsx": true 11 | }, 12 | "sourceType": "module" 13 | }, 14 | "rules": { 15 | "no-const-assign": "warn", 16 | "no-this-before-super": "warn", 17 | "no-undef": "warn", 18 | "no-unreachable": "warn", 19 | "no-unused-vars": "warn", 20 | "constructor-super": "warn", 21 | "valid-typeof": "warn" 22 | } 23 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .vscode-test/ 3 | .vsix 4 | yarn.lock 5 | .DS_Store 6 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "dbaeumer.vscode-eslint" 6 | ] 7 | } -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that launches the extension 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 | }, 13 | { 14 | "name": "Launch Tests", 15 | "type": "extensionHost", 16 | "request": "launch", 17 | "runtimeExecutable": "${execPath}", 18 | "args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/test" ], 19 | "stopOnEntry": false 20 | } 21 | ] 22 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | } -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | test/** 4 | .gitignore 5 | jsconfig.json 6 | vsc-extension-quickstart.md 7 | .eslintrc.json 8 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | All notable changes to the "nasc-touchbar" extension will be documented in this file. 3 | 4 | ## IMPORTANT NOTE: 5 | Important, if the buttons don't fit in the bar, they will not be shown (this is a current bug in VSCode support for the TouchBar and soon to be fixed). 6 | If the bar disappeared, see the options (ctrl+, or cmd+,), filter by "nasc" and adjust the settings. 7 | 8 | Usually, if your are not using the "Strip" group of buttons, you can fit **9** buttons on it. If you have the OS's _Strip_ buttons enabled, you can fit **6** buttons. 9 | 10 | ## 1.0 11 | 12 | - Support for _goToDefinition_ 13 | - Support for _addCursorAbove_ 14 | - Support for _addCursorBellow_ 15 | - Support for _toggleSidebar_ 16 | - Support for _togglePanel_ 17 | - Support for _showCommands_ 18 | 19 | ## 1.2.0 20 | 21 | - Support for _renaming symbols_ 22 | 23 | ## 1.5.0 24 | 25 | - Added support for enabling and disabling buttons in user settings 26 | 27 | ## 1.6.1 28 | 29 | - Added support for "goToNext" 30 | - Added support for "duplicateLine" 31 | 32 | ## 1.7.0 33 | 34 | - Toggle white space characters 35 | - Peek definition 36 | - Show references 37 | - Settings 38 | - Indent 39 | - Outdent 40 | - Jump to matching bracket 41 | - Block comment 42 | - Comment line 43 | 44 | ## 1.8.0 45 | 46 | - Added support for groups of tools 47 | - Supporting group _enableFuncGroup_ 48 | - Supporting group _enableSrcGroup_ 49 | - Supporting group _enableCursorsGroup_ 50 | - Supporting group _enableEditorGroup_ 51 | 52 | ## 1.12.0 53 | 54 | - Merged pending pull requests 55 | - Fixed to work with VSCode v1.3.1.0+ 56 | - Fixed typos 57 | - Added button "go to next error in files" 58 | - Added support for `dash` for those who use the extension 59 | 60 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Hey, thanks for contributing! :) 4 | 5 | These are some guide lines to help you out. 6 | 7 | ### Adding buttons 8 | 9 | When adding buttons, try to ensure these steps: 10 | 11 | - Create the button/feature (use default false, to avoid braking existing layouts) 12 | - Try and use ASCII characters for the button icon, if possible. 13 | - Create the settings entry for the button (use default _false_) 14 | - Add the feature and option to the documentation (readme.md) 15 | - Open a Pull Request at [https://github.com/NascHQ/nasc-vscode-mac-touchbar](https://github.com/NascHQ/nasc-vscode-mac-touchbar) 16 | 17 | ### Steps to contribute 18 | 19 | - Clone the project from github 20 | 21 | ```git clone https://github.com/NascHQ/nasc-vscode-mac-touchbar.git``` 22 | 23 | - Install its dependencies with yarn or npm 24 | 25 | ``` 26 | cd nasc-vscode-mac-touchbar 27 | yarn install 28 | ``` 29 | 30 | - Run the editor with your extension 31 | 32 | Just click "play" and a new window of the editor will open, running your version of this extension. 33 | 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Nasc's Macbook Pro Touch Bar features for VSCode 2 | 3 | This adds a few useful features to your Macbook Pro's touch bar while you are working in VSCode. 4 | **Read the notes in the end of this document** 5 | 6 | Installation link (if your are not seeing this from inside VSCode): https://marketplace.visualstudio.com/items?itemName=felipe.nasc-touchbar#overview 7 | 8 | ## Features 9 | 10 | This is how your touchbar will look like: 11 | 12 | ![Touchbar visualization](images/nasc-macbook-pro-vscode-touch-bar.png) 13 | 14 | ![Touchbar visualization](images/editor-group.png) 15 | ![Touchbar visualization](images/functions-group.png) 16 | ![Touchbar visualization](images/source-group.png) 17 | ![Touchbar visualization](images/cursors-group.png) 18 | ![Touchbar visualization](images/tools-groups.png) 19 | 20 | The list of features are: 21 | 22 | - Go to definition 23 | - Add cursor above 24 | - Add cursor below 25 | - Run command 26 | - Toggle side bar 27 | - Toggle Panel/terminal 28 | - Rename/replace all 29 | - Duplicate lines 30 | - Toggle white space characters 31 | - Peek definition 32 | - Show references 33 | - Settings 34 | - Indent 35 | - Outdent 36 | - Jump to matching bracket 37 | - Block comment 38 | - Comment line 39 | - Select next 40 | - Go to next 41 | - Open Dash / Zeal 42 | - Search Dash / Zeal with current selection 43 | 44 | ## Settings 45 | 46 | You can choose the buttons by setting the following settings. 47 | Please have in mind the limit of 5 active buttons (if you have the OS control strip enabled, 9 buttons if you don't). More than that will break the layout and the buttons will not be visible. It is possible to hide the default VSCode buttons, see **NOTES** at the end of the documentation. 48 | 49 | - "nasc-touchbar.goToDefinition": (default _true_) Go to the function or variable definition 50 | - "nasc-touchbar.addCursorAbove": (default _false_) Add a cursor in the line above 51 | - "nasc-touchbar.addCursorBelow": (default _true_) Add a cursor in the line below 52 | - "nasc-touchbar.selectNext": (default _false_) Selects next match 53 | - "nasc-touchbar.toggleSidebar": (default _false_) Toggles the sidebar 54 | - "nasc-touchbar.togglePanel": (default _true_) Toggles the panel in the bottom of the editor 55 | - "nasc-touchbar.showCommands": (default _true_) Shows the _run command_ prompt 56 | - "nasc-touchbar.rename": (default _true_) Rename (replace all) variable or function names 57 | - "nasc-touchbar.copyLineDown": (default _false_) Duplicates the current line (or selected lines) 58 | - "nasc-touchbar.goToNext": (default _false_) Go to next match 59 | - "nasc-touchbar.toggleWhiteSpace": (default _false_) Show or hide white spaces 60 | - "nasc-touchbar.peekDefinition": (default _false_) Peek definition/declaration 61 | - "nasc-touchbar.showReferences": (default _false_) List references who use the current symbol 62 | - "nasc-touchbar.settings": (default _false_) Open user settings 63 | - "nasc-touchbar.indent": (default _false_) Indent text 64 | - "nasc-touchbar.outdent": (default _false_) Outdent text 65 | - "nasc-touchbar.jumpToBracket": (default _false_) Jump to matching bracket 66 | - "nasc-touchbar.blockComment": (default _false_) Toggles block comments ( /* ... */ ) for the current selection 67 | - "nasc-touchbar.commentLine": (default _false_) Toggles line comments ( // ) for the current selection 68 | - "nasc-touchbar.formatDocument": (default _false_) Formats the current document 69 | - "nasc-touchbar.docs": (default _false_) Show documentation for current file in Dash / Zeal. Requires extension _deerawan.vscode-dash_ 70 | - "nasc-touchbar.docsSelection": (default _false_) Shows documentation for current selection in Dash / Zeal, depending on the doctype. Requires extension _deerawan.vscode-dash_ If "nasc-touchbar.docs" is enabled, then the docs icon will display when there is no selection, and will swap to this tool once text is selected. 71 | - "nasc-touchbar.enableFuncGroup": (default _false_) Adds a group with the buttons related to _Functions_ 72 | - "nasc-touchbar.enableSrcGroup": (default _false_) Adds a group with the buttons related to the _Source code_ 73 | - "nasc-touchbar.enableCursorsGroup": (default _false_) Adds a group with the buttons related to your _cursors_ 74 | - "nasc-touchbar.enableEditorGroup": (default _false_) Adds a group with the buttons related to _editor's tools_ 75 | 76 | ## Groups 77 | 78 | When you enable groups, each group has a bunch of features. 79 | Here they are: 80 | 81 | Functions 82 | 83 | - Close group 84 | - Peek definition 85 | - Show references 86 | - Rename/replace all 87 | - Jump to matching bracket 88 | 89 | Source 90 | 91 | - Close group 92 | - Duplicate lines 93 | - Indent 94 | - Outdent 95 | - Block comment 96 | 97 | Cursors 98 | 99 | - Close group 100 | - Select next 101 | - Go to next 102 | - Add cursor above 103 | - Add cursor bellow 104 | 105 | Editor 106 | 107 | - Close group 108 | - Run command 109 | - Toggle side bar 110 | - Toggle Pannel/terminal 111 | - Togle white space characters 112 | 113 | ## Contributing: 114 | 115 | Please, refer to the [_CONTRIBUTING.md_](https://github.com/NascHQ/nasc-vscode-mac-touchbar/blob/master/CONTRIBUTING.md) file and help this project grow :) 116 | 117 | ## NOTES: 118 | 119 | Important, if the buttons don't fit in the bar, they will not be shown (this is a current bug in VSCode support for the TouchBar and soon to be fixed). 120 | If the bar disappeared, see the options (ctrl+, or cmd+,), filter by "nasc" and adjust the settings. 121 | 122 | Usually, if your are not using the "Strip" group of buttons, you can fit **9** buttons on it. If you have the OS's _Strip_ buttons enabled, you can fit **5** buttons. 123 | 124 | If you would like to create more space by removing VSCode's default buttons you can do so with the `keyboard.touchbar.ignored` setting, adding some or all of the following to the ignored list: 125 | - workbench.action.navigateBack 126 | - workbench.action.navigateForward 127 | - workbench.action.debug.start 128 | - workbench.action.debug.run 129 | - workbench.action.debug.restart 130 | - workbench.action.debug.stepOver 131 | - workbench.action.debug.stepInto 132 | - workbench.action.debug.stepOut 133 | - workbench.action.debug.stop 134 | - workbench.action.debug.continue 135 | - workbench.action.debug.pause 136 | See [this pull request](https://github.com/microsoft/vscode/pull/70174) to vscode for more information on the implementation of this customisation. This is not a feature of nasc-vscode-mac-touchbar, but a feature of vscode, and so the above list may change at any time. 137 | 138 | 139 | ## Donate: 140 | 141 | Buy us a beer :) 142 | 143 | **BTC:** 1GuTME1bGbk7hY7ssrUBh3M1k4AeyVCSjW 144 | **ETH:** 0x49f1612d4a8e9165f2eb94be79af9dbbf3815af5 145 | -------------------------------------------------------------------------------- /extension.js: -------------------------------------------------------------------------------- 1 | const vscode = require('vscode'); 2 | const GO_MODE = { language: 'js', scheme: 'file' }; 3 | 4 | class GoDefinitionProvider { 5 | provideDefinition () { 6 | return new Promise((resolve, reject) => { 7 | return { 8 | document: vscode.TextDocument, 9 | position: vscode.Position, 10 | token: vscode.CancellationToken 11 | } 12 | }) 13 | } 14 | } 15 | 16 | function getTextFromLine (selection) { 17 | let position = selection.active; 18 | let newPositionA = position.with(selection.line, 0); 19 | let newPositionB = position.with(selection.line, selection.character); 20 | let newSelection = new vscode.Selection(newPositionA, newPositionB) 21 | const editor = vscode.window.activeTextEditor; 22 | return editor.document.getText(newSelection) 23 | } 24 | function countTabs (sel) { 25 | let matching = getTextFromLine(sel).match(/\t/g) 26 | return matching ? matching.length : 0 27 | } 28 | 29 | function addCursor (direction) { 30 | var editor = vscode.window.activeTextEditor; 31 | if (!editor) { 32 | return; // No open text editor 33 | } 34 | var position = editor.selection.active; 35 | var selections = editor.selections 36 | var selection 37 | 38 | if (selections.length > 1) { 39 | selections = selections.sort((a, b) => { 40 | return a.start.line > b.start.line 41 | }) 42 | selection = direction === 'above' ? selections[0] : selections[selections.length -1] 43 | if (selection.start.line === 0) { 44 | return 45 | } 46 | position = selection.active 47 | } else { 48 | selection = selections[0] 49 | } 50 | var diffBase = direction === 'above' ? -1 : 1 51 | var newPosition = position.with(position.line + diffBase, position.character); 52 | var newSelection = new vscode.Selection(newPosition, newPosition); 53 | 54 | if (!editor.options.insertSpaces) { 55 | let tabs = countTabs(selection) 56 | let tabs2 = countTabs(newSelection) 57 | let diff = (tabs - tabs2) 58 | 59 | if (Math.abs(diff) > 0) { 60 | diff = diff * editor.options.tabSize - diff 61 | } 62 | newPosition = position.with(position.line + diffBase, position.character + diff); 63 | newSelection = new vscode.Selection(newPosition, newPosition); 64 | } 65 | let ar = Array.from(selections) 66 | ar.push(newSelection) 67 | editor.selections = ar 68 | } 69 | 70 | function activate(context) { 71 | const go2Def = new GoDefinitionProvider() 72 | const aCA = vscode.commands.registerCommand('nasc.touchBar.addCursorAbove', function () { 73 | addCursor('above') 74 | }) 75 | const aCB = vscode.commands.registerCommand('nasc.touchBar.addCursorBelow', function () { 76 | addCursor('below') 77 | }) 78 | 79 | vscode.commands.registerCommand('nasc.touchBar.closeGroup', function () { 80 | vscode.commands.executeCommand('setContext', 'enabledGroup', false) 81 | vscode.commands.executeCommand('setContext', 'enabledFuncGroup', false) 82 | vscode.commands.executeCommand('setContext', 'enabledSrcGroup', false) 83 | vscode.commands.executeCommand('setContext', 'enabledEditorGroup', false) 84 | vscode.commands.executeCommand('setContext', 'enabledCursorsGroup', false) 85 | // vscode.workspace.getConfiguration().update('nasc-touchbar.enabledGroup', 0) 86 | }) 87 | vscode.commands.registerCommand('nasc.touchBar.enableFuncGroup', function () { 88 | vscode.commands.executeCommand('setContext', 'enabledGroup', true) 89 | vscode.commands.executeCommand('setContext', 'enabledFuncGroup', true) 90 | // vscode.workspace.getConfiguration().update('nasc-touchbar.enabledGroup', 1) 91 | }) 92 | vscode.commands.registerCommand('nasc.touchBar.enableSrcGroup', function () { 93 | vscode.commands.executeCommand('setContext', 'enabledGroup', true) 94 | vscode.commands.executeCommand('setContext', 'enabledSrcGroup', true) 95 | // vscode.workspace.getConfiguration().update('nasc-touchbar.enabledGroup', 2) 96 | }) 97 | vscode.commands.registerCommand('nasc.touchBar.enableEditorGroup', function () { 98 | vscode.commands.executeCommand('setContext', 'enabledGroup', true) 99 | vscode.commands.executeCommand('setContext', 'enabledEditorGroup', true) 100 | // vscode.workspace.getConfiguration().update('nasc-touchbar.enabledGroup', 3) 101 | }) 102 | vscode.commands.registerCommand('nasc.touchBar.enableCursorsGroup', function () { 103 | vscode.commands.executeCommand('setContext', 'enabledGroup', true) 104 | vscode.commands.executeCommand('setContext', 'enabledCursorsGroup', true) 105 | // vscode.workspace.getConfiguration().update('nasc-touchbar.enabledGroup', 4) 106 | }) 107 | 108 | vscode.commands.registerCommand('nasc.touchBar.goToDefinition', function () { 109 | vscode.commands.executeCommand('editor.action.goToDeclaration'); 110 | }); 111 | 112 | const prov = vscode.languages.registerDefinitionProvider( 113 | GO_MODE, go2Def 114 | ) 115 | context.subscriptions.push(aCA) 116 | context.subscriptions.push(aCB) 117 | // context.subscriptions.push(eFG) 118 | context.subscriptions.push(prov); 119 | } 120 | exports.activate = activate; 121 | 122 | function deactivate() { 123 | } 124 | exports.deactivate = deactivate; 125 | -------------------------------------------------------------------------------- /images/cursors-group.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/on2-dev/nasc-vscode-mac-touchbar/c5bc9b64d5bfbd54acbc54bdf11424c02653ba38/images/cursors-group.png -------------------------------------------------------------------------------- /images/editor-group.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/on2-dev/nasc-vscode-mac-touchbar/c5bc9b64d5bfbd54acbc54bdf11424c02653ba38/images/editor-group.png -------------------------------------------------------------------------------- /images/functions-group.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/on2-dev/nasc-vscode-mac-touchbar/c5bc9b64d5bfbd54acbc54bdf11424c02653ba38/images/functions-group.png -------------------------------------------------------------------------------- /images/nasc-macbook-pro-vscode-touch-bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/on2-dev/nasc-vscode-mac-touchbar/c5bc9b64d5bfbd54acbc54bdf11424c02653ba38/images/nasc-macbook-pro-vscode-touch-bar.png -------------------------------------------------------------------------------- /images/source-group.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/on2-dev/nasc-vscode-mac-touchbar/c5bc9b64d5bfbd54acbc54bdf11424c02653ba38/images/source-group.png -------------------------------------------------------------------------------- /images/tools-groups.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/on2-dev/nasc-vscode-mac-touchbar/c5bc9b64d5bfbd54acbc54bdf11424c02653ba38/images/tools-groups.png -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "lib": [ 6 | "es6" 7 | ] 8 | }, 9 | "exclude": [ 10 | "node_modules" 11 | ] 12 | } -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | Copyright 2017 Nasc 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | 9 | -------------------------------------------------------------------------------- /nasc-macbook-pro-vscode-touch-bar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/on2-dev/nasc-vscode-mac-touchbar/c5bc9b64d5bfbd54acbc54bdf11424c02653ba38/nasc-macbook-pro-vscode-touch-bar.jpg -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nasc-touchbar", 3 | "displayName": "Nasc VSCode Touchbar", 4 | "description": "Adds useful tools to your macbook touchbar.", 5 | "version": "1.12.0", 6 | "publisher": "felipe", 7 | "engines": { 8 | "vscode": "^1.17.0" 9 | }, 10 | "repository": "https://github.com/NascHQ/nasc-vscode-mac-touchbar", 11 | "categories": [ 12 | "Other" 13 | ], 14 | "keywords": [ 15 | "macbook pro", 16 | "touchbar", 17 | "extra buttons", 18 | "shortcuts", 19 | "vscode", 20 | "visual studio code", 21 | "macbook", 22 | "developers", 23 | "touch bar" 24 | ], 25 | "activationEvents": [ 26 | "onCommand:nasc.touchBar.goToDefinition", 27 | "onCommand:nasc.touchBar.addCursorAbove", 28 | "onCommand:nasc.touchBar.addCursorBelow", 29 | "onCommand:nasc.touchBar.enableFuncGroup", 30 | "onCommand:nasc.touchBar.enableSrcGroup", 31 | "onCommand:nasc.touchBar.enableEditorGroup", 32 | "onCommand:nasc.touchBar.enableCursorsGroup" 33 | ], 34 | "main": "./extension", 35 | "capabilities": { 36 | "definitionProvider": "true" 37 | }, 38 | "contributes": { 39 | "commands": [ 40 | { 41 | "command": "nasc.touchBar.goToDefinition", 42 | "group": "nasc", 43 | "when": "editorHasSelection", 44 | "title": "→ƒ" 45 | }, 46 | { 47 | "command": "nasc.touchBar.addCursorAbove", 48 | "group": "nasc", 49 | "title": "↑𝙸" 50 | }, 51 | { 52 | "command": "nasc.touchBar.addCursorBelow", 53 | "group": "nasc", 54 | "title": "↓𝙸" 55 | }, 56 | { 57 | "command": "workbench.action.toggleSidebarVisibility", 58 | "group": "nasc", 59 | "title": "◧" 60 | }, 61 | { 62 | "command": "workbench.action.togglePanel", 63 | "group": "nasc", 64 | "title": "⬓" 65 | }, 66 | { 67 | "command": "workbench.action.showCommands", 68 | "group": "nasc", 69 | "title": ">_" 70 | }, 71 | { 72 | "command": "editor.action.formatDocument", 73 | "group": "nasc", 74 | "title": "⇝ƒ⇜" 75 | }, 76 | { 77 | "command": "editor.action.rename", 78 | "group": "nasc", 79 | "title": "✎_" 80 | }, 81 | { 82 | "command": "editor.action.marker.nextInFiles", 83 | "group": "nasc", 84 | "title": "⇝" 85 | }, 86 | { 87 | "command": "editor.action.copyLinesDownAction", 88 | "group": "nasc", 89 | "title": "☰↓" 90 | }, 91 | { 92 | "command": "editor.action.addSelectionToNextFindMatch", 93 | "group": "nasc", 94 | "title": "🔎+" 95 | }, 96 | { 97 | "command": "editor.action.moveSelectionToNextFindMatch", 98 | "group": "nasc", 99 | "title": "🔎" 100 | }, 101 | { 102 | "command": "editor.action.toggleRenderWhitespace", 103 | "group": "nasc", 104 | "title": "a..b" 105 | }, 106 | { 107 | "command": "editor.action.previewDeclaration", 108 | "group": "nasc", 109 | "title": "ƒ [" 110 | }, 111 | { 112 | "command": "editor.action.referenceSearch.trigger", 113 | "group": "nasc", 114 | "title": "ƒ⥺" 115 | }, 116 | { 117 | "command": "workbench.action.openGlobalSettings", 118 | "group": "nasc", 119 | "title": "⚙" 120 | }, 121 | { 122 | "command": "editor.action.indentLines", 123 | "group": "nasc", 124 | "title": "→☰" 125 | }, 126 | { 127 | "command": "editor.action.outdentLines", 128 | "group": "nasc", 129 | "title": "←☰" 130 | }, 131 | { 132 | "command": "editor.action.jumpToBracket", 133 | "group": "nasc", 134 | "title": "→}" 135 | }, 136 | { 137 | "command": "editor.action.blockComment", 138 | "group": "nasc", 139 | "title": "/* */" 140 | }, 141 | { 142 | "command": "editor.action.commentLine", 143 | "group": "nasc", 144 | "title": "//" 145 | }, 146 | { 147 | "command": "nasc.touchBar.enableFuncGroup", 148 | "group": "nasc", 149 | "title": "{ ƒ }" 150 | }, 151 | { 152 | "command": "nasc.touchBar.enableSrcGroup", 153 | "group": "nasc", 154 | "title": "{ ☰ }" 155 | }, 156 | { 157 | "command": "nasc.touchBar.enableCursorsGroup", 158 | "group": "nasc", 159 | "title": "{ 𝙸 }" 160 | }, 161 | { 162 | "command": "nasc.touchBar.enableEditorGroup", 163 | "group": "nasc", 164 | "title": "{ ✎_ }" 165 | }, 166 | { 167 | "command": "nasc.touchBar.closeGroup", 168 | "group": "nasc", 169 | "title": " 🅧 " 170 | }, 171 | { 172 | "command": "git.sync", 173 | "group": "nasc", 174 | "title": "↻" 175 | }, 176 | { 177 | "command": "extension.dash.emptySyntax", 178 | "group": "nasc", 179 | "title": "🧠" 180 | }, 181 | { 182 | "command": "extension.dash.specific", 183 | "group": "nasc", 184 | "title": "🧠🔎" 185 | } 186 | ], 187 | "menus": { 188 | "touchBar": [ 189 | { 190 | "command": "nasc.touchBar.enableFuncGroup", 191 | "group": "nasc", 192 | "when": "config.nasc-touchbar.enableFuncGroup && !enabledGroup" 193 | }, 194 | { 195 | "command": "nasc.touchBar.enableSrcGroup", 196 | "group": "nasc", 197 | "when": "config.nasc-touchbar.enableSrcGroup && !enabledGroup" 198 | }, 199 | { 200 | "command": "nasc.touchBar.enableCursorsGroup", 201 | "group": "nasc", 202 | "when": "config.nasc-touchbar.enableCursorsGroup && !enabledGroup" 203 | }, 204 | { 205 | "command": "nasc.touchBar.enableEditorGroup", 206 | "group": "nasc", 207 | "when": "config.nasc-touchbar.enableEditorGroup && !enabledGroup" 208 | }, 209 | { 210 | "command": "nasc.touchBar.closeGroup", 211 | "group": "nasc", 212 | "when": "enabledGroup" 213 | }, 214 | { 215 | "command": "nasc.touchBar.goToDefinition", 216 | "group": "nasc", 217 | "when": "config.nasc-touchbar.goToDefinition && !enabledGroup" 218 | }, 219 | { 220 | "command": "editor.action.formatDocument", 221 | "group": "nasc", 222 | "when": "config.nasc-touchbar.formatDocument && !enabledGroup" 223 | }, 224 | { 225 | "command": "editor.action.rename", 226 | "group": "nasc", 227 | "when": "config.nasc-touchbar.rename && !enabledGroup" 228 | }, 229 | { 230 | "command": "editor.action.rename", 231 | "group": "nasc", 232 | "when": "enabledFuncGroup" 233 | }, 234 | { 235 | "command": "editor.action.marker.nextInFiles", 236 | "group": "nasc", 237 | "when": "config.nasc-touchbar.nextInFiles" 238 | }, 239 | { 240 | "command": "editor.action.previewDeclaration", 241 | "group": "nasc", 242 | "when": "config.nasc-touchbar.peekDefinition && !enabledGroup" 243 | }, 244 | { 245 | "command": "editor.action.previewDeclaration", 246 | "group": "nasc", 247 | "when": "enabledFuncGroup" 248 | }, 249 | { 250 | "command": "editor.action.referenceSearch.trigger", 251 | "group": "nasc", 252 | "when": "config.nasc-touchbar.showReferences && !enabledGroup" 253 | }, 254 | { 255 | "command": "editor.action.referenceSearch.trigger", 256 | "group": "nasc", 257 | "when": "enabledFuncGroup" 258 | }, 259 | { 260 | "command": "editor.action.jumpToBracket", 261 | "group": "nasc", 262 | "when": "config.nasc-touchbar.jumpToBracket && !enabledGroup" 263 | }, 264 | { 265 | "command": "editor.action.jumpToBracket", 266 | "group": "nasc", 267 | "when": "enabledFuncGroup" 268 | }, 269 | { 270 | "command": "nasc.touchBar.addCursorAbove", 271 | "group": "nasc", 272 | "when": "config.nasc-touchbar.addCursorAbove" 273 | }, 274 | { 275 | "command": "nasc.touchBar.addCursorAbove", 276 | "group": "nasc", 277 | "when": "enabledCursorsGroup" 278 | }, 279 | { 280 | "command": "nasc.touchBar.addCursorBelow", 281 | "group": "nasc", 282 | "when": "config.nasc-touchbar.addCursorBelow && !enabledGroup" 283 | }, 284 | { 285 | "command": "nasc.touchBar.addCursorBelow", 286 | "group": "nasc", 287 | "when": "enabledCursorsGroup" 288 | }, 289 | { 290 | "command": "editor.action.addSelectionToNextFindMatch", 291 | "group": "nasc", 292 | "when": "config.nasc-touchbar.selectNext && !enabledGroup" 293 | }, 294 | { 295 | "command": "editor.action.addSelectionToNextFindMatch", 296 | "group": "nasc", 297 | "when": "enabledCursorsGroup" 298 | }, 299 | { 300 | "command": "editor.action.moveSelectionToNextFindMatch", 301 | "group": "nasc", 302 | "when": "config.nasc-touchbar.goToNext && !enabledGroup" 303 | }, 304 | { 305 | "command": "editor.action.moveSelectionToNextFindMatch", 306 | "group": "nasc", 307 | "when": "enabledCursorsGroup" 308 | }, 309 | { 310 | "command": "workbench.action.toggleSidebarVisibility", 311 | "group": "nasc", 312 | "when": "config.nasc-touchbar.toggleSidebar && !enabledGroup" 313 | }, 314 | { 315 | "command": "workbench.action.toggleSidebarVisibility", 316 | "group": "nasc", 317 | "when": "enabledEditorGroup" 318 | }, 319 | { 320 | "command": "workbench.action.togglePanel", 321 | "group": "nasc", 322 | "when": "config.nasc-touchbar.togglePanel && !enabledGroup" 323 | }, 324 | { 325 | "command": "workbench.action.togglePanel", 326 | "group": "nasc", 327 | "when": "enabledEditorGroup" 328 | }, 329 | { 330 | "command": "workbench.action.showCommands", 331 | "group": "nasc", 332 | "when": "config.nasc-touchbar.showCommands && !enabledGroup" 333 | }, 334 | { 335 | "command": "workbench.action.showCommands", 336 | "group": "nasc", 337 | "when": "enabledEditorGroup" 338 | }, 339 | { 340 | "command": "editor.action.toggleRenderWhitespace", 341 | "group": "nasc", 342 | "when": "config.nasc-touchbar.toggleWhiteSpace && !enabledGroup" 343 | }, 344 | { 345 | "command": "editor.action.toggleRenderWhitespace", 346 | "group": "nasc", 347 | "when": "enabledEditorGroup" 348 | }, 349 | { 350 | "command": "workbench.action.openGlobalSettings", 351 | "group": "nasc", 352 | "when": "config.nasc-touchbar.settings && !enabledGroup" 353 | }, 354 | { 355 | "command": "editor.action.copyLinesDownAction", 356 | "group": "nasc", 357 | "when": "config.nasc-touchbar.copyLineDown && !enabledGroup" 358 | }, 359 | { 360 | "command": "editor.action.copyLinesDownAction", 361 | "group": "nasc", 362 | "when": "enabledSrcGroup" 363 | }, 364 | { 365 | "command": "editor.action.indentLines", 366 | "group": "nasc", 367 | "when": "config.nasc-touchbar.indent && !enabledGroup" 368 | }, 369 | { 370 | "command": "editor.action.indentLines", 371 | "group": "nasc", 372 | "when": "enabledSrcGroup" 373 | }, 374 | { 375 | "command": "editor.action.outdentLines", 376 | "group": "nasc", 377 | "when": "config.nasc-touchbar.outdent && !enabledGroup" 378 | }, 379 | { 380 | "command": "editor.action.outdentLines", 381 | "group": "nasc", 382 | "when": "enabledSrcGroup" 383 | }, 384 | { 385 | "command": "editor.action.blockComment", 386 | "group": "nasc", 387 | "when": "config.nasc-touchbar.blockComment && !enabledGroup" 388 | }, 389 | { 390 | "command": "editor.action.blockComment", 391 | "group": "nasc", 392 | "when": "enabledSrcGroup" 393 | }, 394 | { 395 | "command": "editor.action.commentLine", 396 | "group": "nasc", 397 | "when": "config.nasc-touchbar.commentLine && !enabledGroup" 398 | }, 399 | { 400 | "command": "git.sync", 401 | "group": "nasc", 402 | "when": "config.nasc-touchbar.gitSync && !enabledGroup" 403 | }, 404 | { 405 | "command": "extension.dash.emptySyntax", 406 | "group": "nasc", 407 | "when": "config.nasc-touchbar.docs && !editorHasSelection && !enabledGroup || config.nasc-touchbar.docs && !config.nasc-touchbar.docsSelection && !enabledGroup" 408 | }, 409 | { 410 | "command": "extension.dash.specific", 411 | "group": "nasc", 412 | "when": "config.nasc-touchbar.docsSelection && editorHasSelection && !enabledGroup || config.nasc-touchbar.docsSelection && !config.nasc-touchbar.docs && !enabledGroup" 413 | } 414 | ] 415 | }, 416 | "configuration": [ 417 | { 418 | "title": "Nasc Touch Bar Settings", 419 | "type": "object", 420 | "properties": { 421 | "nasc-touchbar.goToDefinition": { 422 | "type": "boolean", 423 | "default": true, 424 | "description": "Go to Definition" 425 | }, 426 | "nasc-touchbar.addCursorBelow": { 427 | "type": "boolean", 428 | "default": true, 429 | "description": "Add cursor below" 430 | }, 431 | "nasc-touchbar.formatDocument": { 432 | "type": "boolean", 433 | "default": true, 434 | "description": "Format the document" 435 | }, 436 | "nasc-touchbar.rename": { 437 | "type": "boolean", 438 | "default": true, 439 | "description": "Rename Symbol. It will replace the variable or function name (for example) everywhere" 440 | }, 441 | "nasc-touchbar.nextInFiles": { 442 | "type": "boolean", 443 | "default": false, 444 | "description": "Jump to next error in project" 445 | }, 446 | "nasc-touchbar.togglePanel": { 447 | "type": "boolean", 448 | "default": true, 449 | "description": "Toggle Panel" 450 | }, 451 | "nasc-touchbar.showCommands": { 452 | "type": "boolean", 453 | "default": true, 454 | "description": "Show Commands" 455 | }, 456 | "nasc-touchbar.selectNext": { 457 | "type": "boolean", 458 | "default": false, 459 | "description": "Select the next matching string (if a word is selected, uses this to search)" 460 | }, 461 | "nasc-touchbar.enableFuncGroup": { 462 | "type": "boolean", 463 | "default": false, 464 | "description": "Enables the Function group" 465 | }, 466 | "nasc-touchbar.enableSrcGroup": { 467 | "type": "boolean", 468 | "default": false, 469 | "description": "Enables the Source group" 470 | }, 471 | "nasc-touchbar.enableCursorsGroup": { 472 | "type": "boolean", 473 | "default": false, 474 | "description": "Enables the Cursors group" 475 | }, 476 | "nasc-touchbar.enableEditorGroup": { 477 | "type": "boolean", 478 | "default": false, 479 | "description": "Enables the Editor group" 480 | }, 481 | "nasc-touchbar.toggleSidebar": { 482 | "type": "boolean", 483 | "default": false, 484 | "description": "Toggle Sidebar" 485 | }, 486 | "nasc-touchbar.addCursorAbove": { 487 | "type": "boolean", 488 | "default": false, 489 | "description": "Add cursor above" 490 | }, 491 | "nasc-touchbar.copyLineDown": { 492 | "type": "boolean", 493 | "default": false, 494 | "description": "Copy the current line below" 495 | }, 496 | "nasc-touchbar.goToNext": { 497 | "type": "boolean", 498 | "default": false, 499 | "description": "Go to the next match (if a word is selected, uses this to search)" 500 | }, 501 | "nasc-touchbar.toggleWhiteSpace": { 502 | "type": "boolean", 503 | "default": false, 504 | "description": "Show or hide white spaces" 505 | }, 506 | "nasc-touchbar.peekDefinition": { 507 | "type": "boolean", 508 | "default": false, 509 | "description": "Peek definition/declaration" 510 | }, 511 | "nasc-touchbar.showReferences": { 512 | "type": "boolean", 513 | "default": false, 514 | "description": "List references who use the current symbol" 515 | }, 516 | "nasc-touchbar.settings": { 517 | "type": "boolean", 518 | "default": false, 519 | "description": "Open user settings" 520 | }, 521 | "nasc-touchbar.indent": { 522 | "type": "boolean", 523 | "default": false, 524 | "description": "Indent text" 525 | }, 526 | "nasc-touchbar.outdent": { 527 | "type": "boolean", 528 | "default": false, 529 | "description": "Outdent text" 530 | }, 531 | "nasc-touchbar.jumpToBracket": { 532 | "type": "boolean", 533 | "default": false, 534 | "description": "Jump to matching bracket" 535 | }, 536 | "nasc-touchbar.blockComment": { 537 | "type": "boolean", 538 | "default": false, 539 | "description": "Toggles block comments ( /* ... */ ) for the current selection" 540 | }, 541 | "nasc-touchbar.commentLine": { 542 | "type": "boolean", 543 | "default": false, 544 | "description": "Toggles line comments ( // ) for the current selection" 545 | }, 546 | "nasc-touchbar.gitSync": { 547 | "type": "boolean", 548 | "default": false, 549 | "description": "Git Sync" 550 | }, 551 | "nasc-touchbar.docs": { 552 | "type": "boolean", 553 | "default": false, 554 | "description": "Documentation" 555 | }, 556 | "nasc-touchbar.docsSelection": { 557 | "type": "boolean", 558 | "default": false, 559 | "description": "Opens documentation for current selection" 560 | } 561 | } 562 | } 563 | ] 564 | }, 565 | "scripts": { 566 | "postinstall": "node ./node_modules/vscode/bin/install", 567 | "test": "node ./node_modules/vscode/bin/test", 568 | "deploy": "vsce publish minor", 569 | "deploy-fix": "vsce publish patch", 570 | "deploy-upgrade": "vsce publish major" 571 | }, 572 | "license": "MIT", 573 | "icon": "nasc-macbook-pro-vscode-touch-bar.jpg", 574 | "devDependencies": { 575 | "typescript": "^2.5.2", 576 | "vscode": "^1.1.5", 577 | "mocha": "^3.5.0", 578 | "eslint": "^4.6.1", 579 | "@types/node": "^7.0.0", 580 | "@types/mocha": "^2.2.42" 581 | } 582 | } 583 | -------------------------------------------------------------------------------- /test/extension.test.js: -------------------------------------------------------------------------------- 1 | /* global suite, test */ 2 | 3 | // 4 | // Note: This example test is leveraging the Mocha test framework. 5 | // Please refer to their documentation on https://mochajs.org/ for help. 6 | // 7 | 8 | // The module 'assert' provides assertion methods from node 9 | const assert = require('assert'); 10 | 11 | // You can import and use all API from the 'vscode' module 12 | // as well as import your extension to test it 13 | const vscode = require('vscode'); 14 | const myExtension = require('../extension'); 15 | 16 | // Defines a Mocha test suite to group tests of similar kind together 17 | suite("Extension Tests", function() { 18 | 19 | // Defines a Mocha unit test 20 | test("Something 1", function() { 21 | assert.equal(-1, [1, 2, 3].indexOf(5)); 22 | assert.equal(-1, [1, 2, 3].indexOf(0)); 23 | }); 24 | }); -------------------------------------------------------------------------------- /test/index.js: -------------------------------------------------------------------------------- 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 | const 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.js (suite, test, etc.) 19 | useColors: true // colored output from test results 20 | }); 21 | 22 | module.exports = testRunner; --------------------------------------------------------------------------------