├── .gitignore ├── .vscode └── launch.json ├── .vscodeignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── extension.js ├── jsconfig.json ├── media ├── ActiveFileInStatusBar.gif ├── icon.png └── icon.svg ├── package.json ├── test ├── extension.test.js └── index.js └── typings ├── node.d.ts └── vscode-typings.d.ts /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.vsix 3 | -------------------------------------------------------------------------------- /.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 | }, 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 | } -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | typings/** 3 | test/** 4 | .gitignore 5 | jsconfig.json 6 | vsc-extension-quickstart.md 7 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [1.0.3] - 2017-08-08 4 | ### Fixed 5 | - [#1](https://github.com/RoscoP/ActiveFileInStatusBar/issues/1) - Copy to clipboard doesn't respect fullPath setting 6 | - [#2](https://github.com/RoscoP/ActiveFileInStatusBar/issues/2) - Update configuration on config changed instead of file open 7 | - [#4](https://github.com/RoscoP/ActiveFileInStatusBar/issues/4) - Force display of absolute path when file is outside of opened folder 8 | - [#7](https://github.com/RoscoP/ActiveFileInStatusBar/issues/7) - The last active file is still shown even if there is no active editor 9 | 10 | ### Changed 11 | - Removed SVG marketplace icon as per changes to the [VSCode Marketplace requirements](https://code.visualstudio.com/docs/extensions/publish-extension#_usage). 12 | 13 | ### Added 14 | - Configuration `ActiveFileInStatusBar.color` for the color of the text of the file name in the statusbar. 15 | - Changelog file. 16 | - License file. 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 RoscoP - https://github.com/RoscoP/ActiveFileInStatusBar 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Active File In Status Bar # 2 | [Visual Studio Code](https://code.visualstudio.com/) extension for showing the full path of the currently active file in the status bar. 3 | 4 | ![ActiveFileInStatusBar in action](media/ActiveFileInStatusBar.gif) 5 | 6 | ## Install ## 7 | Install [ActiveFileInStatusBar](https://marketplace.visualstudio.com/items?itemName=RoscoP.ActiveFileInStatusBar) directly from the Visual Studio Code extension gallery. 8 | 9 | ## Options ## 10 | 11 | ```javascript 12 | // Enable/Disable ActiveFileInStatusBar 13 | "ActiveFileInStatusBar.enable": true, 14 | // Show fullpath or relative path in status bar. 15 | "ActiveFileInStatusBar.fullpath": true, 16 | // Reveal the active file in the file system. 17 | "ActiveFileInStatusBar.revealFile": false, 18 | // Set text color for the filename in the status bar. 19 | "ActiveFileInStatusBar.color": "", 20 | ``` 21 | 22 | ## Contribute ## 23 | See ActiveFileInStatusBar's [github page](https://github.com/RoscoP/ActiveFileInStatusBar) 24 | -------------------------------------------------------------------------------- /extension.js: -------------------------------------------------------------------------------- 1 | var vscode = require('vscode'); 2 | var copypaste = require('copy-paste'); 3 | var path = require('path'); 4 | 5 | var sb = null; 6 | 7 | function OnStatusBarUpdate( textEditor ) { 8 | textEditor = textEditor ? textEditor : vscode.window.activeTextEditor; 9 | if( textEditor ){ 10 | var config = vscode.workspace.getConfiguration('ActiveFileInStatusBar'); 11 | if( !textEditor.document || textEditor.document.isUntitled ){ 12 | sb.text = ''; 13 | sb.hide(); 14 | } 15 | else { 16 | var filePath = textEditor.document.fileName; 17 | if (!config.fullpath){ 18 | filePath = vscode.workspace.asRelativePath(textEditor.document.fileName) 19 | filePath = path.normalize(filePath) 20 | } 21 | sb.tooltip = 'Copy active file to clipboard'; 22 | if (config.revealFile) { 23 | sb.tooltip = 'Reveal file'; 24 | } 25 | sb.color = config.color; 26 | sb.text = filePath; 27 | sb.show(); 28 | } 29 | } 30 | } 31 | 32 | function CreateStatusBar() { 33 | var config = vscode.workspace.getConfiguration('ActiveFileInStatusBar'); 34 | var sb = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, -1); 35 | sb.text = ''; 36 | sb.command = 'extension.ActiveFileInStatusBarClicked'; 37 | return sb; 38 | } 39 | 40 | // this method is called when your extension is activated 41 | // your extension is activated the very first time the command is executed 42 | function activate(context) { 43 | var config = vscode.workspace.getConfiguration('ActiveFileInStatusBar'); 44 | if (config.enable) { 45 | sb = CreateStatusBar(); 46 | vscode.window.onDidChangeActiveTextEditor( OnStatusBarUpdate ); 47 | vscode.workspace.onDidChangeConfiguration( OnStatusBarUpdate ); 48 | OnStatusBarUpdate( vscode.window.activeTextEditor ); 49 | 50 | context.subscriptions.push(sb); 51 | } 52 | 53 | // The command has been defined in the package.json file 54 | // Now provide the implementation of the command with registerCommand 55 | // The commandId parameter must match the command field in package.json 56 | var disposable = vscode.commands.registerCommand('extension.ActiveFileInStatusBarClicked', function (args) { 57 | var config = vscode.workspace.getConfiguration('ActiveFileInStatusBar'); 58 | if (config.revealFile){ 59 | vscode.commands.executeCommand('workbench.action.files.revealActiveFileInWindows') 60 | } 61 | else { 62 | copypaste.copy(sb.text) 63 | } 64 | }); 65 | context.subscriptions.push(disposable); 66 | 67 | } 68 | exports.activate = activate; 69 | 70 | // this method is called when your extension is deactivated 71 | function deactivate() { 72 | } 73 | exports.deactivate = deactivate; -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "ES5", 5 | "noLib": true 6 | }, 7 | "exclude": [ 8 | "node_modules" 9 | ] 10 | } -------------------------------------------------------------------------------- /media/ActiveFileInStatusBar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RoscoP/ActiveFileInStatusBar/4dbc56248363938e1475119d191f8390feb76769/media/ActiveFileInStatusBar.gif -------------------------------------------------------------------------------- /media/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RoscoP/ActiveFileInStatusBar/4dbc56248363938e1475119d191f8390feb76769/media/icon.png -------------------------------------------------------------------------------- /media/icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ActiveFileInStatusBar", 3 | "displayName": "Active File In StatusBar", 4 | "description": "Add statusbar entry to show path for currently active file.", 5 | "version": "1.0.3", 6 | "publisher": "RoscoP", 7 | "engines": { 8 | "vscode": "^0.10.1" 9 | }, 10 | "categories": [ 11 | "Other" 12 | ], 13 | "activationEvents": [ 14 | "*" 15 | ], 16 | "icon": "media/icon.png", 17 | "galleryBanner": { 18 | "theme": "dark", 19 | "color": "#614051" 20 | }, 21 | "icon_attribution": "Icon made by [Anton Saputro](http://www.flaticon.com/authors/anton-saputro) from [Flaticon](http://www.flaticon.com) is licensed by [Creative Commons BY 3.0](http://creativecommons.org/licenses/by/3.0/)", 22 | "main": "./extension", 23 | "contributes": { 24 | "commands": [{ 25 | "command": "extension.ActiveFileInStatusBarClicked", 26 | "title": "ActiveFileInStatusBarClicked" 27 | }], 28 | "configuration": { 29 | "type": "object", 30 | "title": "ActiveFileInStatusBar configuration", 31 | "properties": { 32 | "ActiveFileInStatusBar.enable": { 33 | "type": "boolean", 34 | "default": true, 35 | "description": "Enable/Disable ActiveFileInStatusBar" 36 | }, 37 | "ActiveFileInStatusBar.fullpath": { 38 | "type": "boolean", 39 | "default": true, 40 | "description": "Show fullpath or relative path in status bar." 41 | }, 42 | "ActiveFileInStatusBar.revealFile": { 43 | "type": "boolean", 44 | "default": false, 45 | "description": "Reveal the active file in the file system." 46 | }, 47 | "ActiveFileInStatusBar.color": { 48 | "type": "string", 49 | "default": "", 50 | "description": "Set text color for the filename in the status bar." 51 | } 52 | } 53 | } 54 | }, 55 | "repository": { 56 | "type": "git", 57 | "url": "https://github.com/RoscoP/ActiveFileInStatusBar" 58 | }, 59 | "dependencies": { 60 | "copy-paste": "^1.2.0" 61 | }, 62 | "devDependencies": { 63 | "vscode": "0.10.x" 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /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 | var 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 | var vscode = require('vscode'); 14 | var 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 | 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.js (suite, test, etc.) 19 | useColors: true // colored output from test results 20 | }); 21 | 22 | module.exports = testRunner; -------------------------------------------------------------------------------- /typings/node.d.ts: -------------------------------------------------------------------------------- 1 | /// -------------------------------------------------------------------------------- /typings/vscode-typings.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | --------------------------------------------------------------------------------