-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
740827a
commit 7ce701d
Showing
22 changed files
with
9,608 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"presets": [ | ||
["env", { | ||
"targets": { | ||
"node": "current" | ||
} | ||
}] | ||
], | ||
"plugins": [ | ||
"add-module-exports" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Babel output directory | ||
lib/* | ||
|
||
# Node Modules | ||
node_modules/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"extends": "airbnb", | ||
"env": { | ||
"node": true | ||
}, | ||
"rules": { | ||
"no-var": "off", | ||
"quotes": ["error", "double"], | ||
"prefer-arrow-callback": [ "error", { "allowNamedFunctions": true } ], | ||
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["./bin/**/*", "./test/**/*.js", "./webpack/**/*.js"]}], | ||
"no-param-reassign": ["error", { "props": false }], | ||
"no-use-before-define":"off", | ||
"strict":"off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Set default behavior to automatically normalize line endings. | ||
* text=auto | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.nyc_output | ||
coverage | ||
lib | ||
node_modules | ||
*.vsix | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Babel output directory | ||
lib/* | ||
|
||
# Node Modules | ||
node_modules/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// A launch configuration that launches the extension inside a new window | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "attach", | ||
"name": "Attach to Remote", | ||
"address": "localhost", | ||
"port": 5858, | ||
"sourceMaps": false, | ||
"localRoot": "${workspaceFolder}", | ||
"remoteRoot": "${command:extension.vscode-wsl-workspaceFolder}" | ||
}, | ||
{ | ||
"name": "Test Extension", | ||
"type": "extensionHost", | ||
"request": "launch", | ||
"runtimeExecutable": "${execPath}", | ||
"preLaunchTask": "npm: babel", | ||
"sourceMaps": true, | ||
"args": [ | ||
"--extensionDevelopmentPath=${workspaceFolder}" | ||
] | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Launch npm Debug", | ||
"useWSL": true, | ||
"stopOnEntry": true, | ||
"sourceMaps": false, | ||
"args": [], | ||
"cwd": "${workspaceFolder}", | ||
"runtimeExecutable": "npm", | ||
"runtimeArgs": [ | ||
"run-script", | ||
"debug" | ||
], | ||
"env": { | ||
"NODE_ENV": "development" | ||
}, | ||
"port": 5858, | ||
"console": "internalConsole" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
* | ||
*/** | ||
**/.DS_Store | ||
!lib/*.js | ||
!node_modules/** | ||
!public/** | ||
!README.md | ||
!CHANGELOG.md | ||
!LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Change Log | ||
All notable changes to the "vscode-wsl-workspacefolder" extension will be documented in this file. | ||
|
||
## [1.0.0] | ||
- Initial release | ||
|
||
## [1.0.1] | ||
- Minor corrections/changes to docs | ||
|
||
## [1.0.2] | ||
- Minor corrections/changes to docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# VS Code extension: WSL workspaceFolder | ||
|
||
Gets workspaceFolder path in WSL path format, using WSL `wslpath` tool. | ||
|
||
Use command as a placeholder where WSL path for the workspaceFolder is required, e.g. the 'remoteRoot' attribute in launch config for debug, etc. | ||
|
||
## Features | ||
|
||
This extension returns the workspaceFolder path, converted from Windows path format to WSL path format. For example, a workspaceFolder with a windows path of `c:\\Users\\Me\\Projects\\project` would return a WSL path of `/mnt/c/Users/Me/Projects/project`. | ||
|
||
## Requirements | ||
|
||
- MS Windows 10 using WSL (Windows Subsystem for Linux) | ||
- MS Windows 10 => version 17046 for [wslpath tool](https://github.com/MicrosoftDocs/WSL/blob/master/WSL/release-notes.md#build-17046) | ||
- Extension code contributors should either install current release of WSL workspaceFolder or replace command reference in .vscode/launch.json | ||
|
||
## Extension Settings | ||
|
||
This extension contributes the following command: | ||
|
||
* `extension.vscode-wsl-workspaceFolder`: returns WSL format path string to workspaceFolder | ||
|
||
## Usage | ||
|
||
e.g. `.vscode/launch.json` | ||
|
||
``` | ||
// A launch configuration that launches the extension inside a new window | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "attach", | ||
"name": "Attach to Remote", | ||
"address": "localhost", | ||
"port": 5858, | ||
"sourceMaps": false, | ||
"localRoot": "${workspaceFolder}", | ||
"remoteRoot": "${command:extension.vscode-wsl-workspaceFolder}" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
## Known Issues | ||
|
||
- When invoked by VS Code in MS Windows 10 environment, which does not use WSL, this extension will still attempt to return a WSL path format, even when this is not possible/required. | ||
|
||
## Release Notes | ||
|
||
### 1.0.0 | ||
|
||
Initial release of VS Code extension `vscode-wsl-workspacefolder` | ||
|
||
### 1.0.1 | ||
|
||
Minor corrections/changes to docs | ||
|
||
### 1.0.2 | ||
|
||
Minor corrections/changes to docs | ||
|
||
### Extension Icon | ||
|
||
Folder icon (no text) sourced from [theSquid.ink 40](https://www.iconfinder.com/icons/416376/envelope_files_folder_interface_office_icon), under [Creative Commons (Attribution 3.0 Unported)](https://creativecommons.org/licenses/by/3.0/) licence. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/env node | ||
|
||
"use strict"; | ||
|
||
const open = require("opn"); | ||
const parseArgs = require("minimist"); | ||
|
||
const args = parseArgs(process.argv.slice(2), { | ||
boolean: ["help", "h", "wait"], | ||
"--": true, | ||
}); | ||
|
||
if (args.h || args.help) { | ||
error(null, true); | ||
} else if (targetFileOrUrl(args._[0])) { | ||
openTarget(targetFileOrUrl(args._[0]), args.wait, args["--"]); | ||
} else if (process.argv.length <= 2) { | ||
error("Target to open not provided!", true); | ||
} else { | ||
error("Usage incorrect!", true); | ||
} | ||
|
||
function targetFileOrUrl(targetArgs) { | ||
if (typeof targetArgs === "string" && targetArgs.length > 0) { | ||
const [fileOrUrl] = args._; | ||
return fileOrUrl; | ||
} | ||
return null; | ||
} | ||
|
||
function openTarget(target, wait, options) { | ||
var appOptions = { | ||
wait, | ||
}; | ||
if (options.length > 0) { | ||
appOptions.app = options; | ||
} | ||
open(target, appOptions); | ||
} | ||
|
||
function printHelp() { | ||
/* eslint-disable no-console */ | ||
console.log(` | ||
opn-cli usage: <file|url> [--wait] [-- <app> [args] | ||
-h, --help output usage information | ||
<file|url> open target file/url in OS default app for file type | ||
--wait wait for app opened to exit before fulfilling promise | ||
-- <app> [args] specify which app to open instead of OS default app including optional arguments | ||
`); | ||
/* eslint-enable no-console */ | ||
} | ||
|
||
function error(err, showHelp = false) { | ||
if (err) { | ||
/* eslint-disable no-console */ | ||
console.log(` | ||
${err.toString()} | ||
`); | ||
/* eslint-enable no-console */ | ||
} | ||
if (showHelp) { | ||
printHelp(); | ||
} | ||
} |
Oops, something went wrong.