Skip to content

Commit

Permalink
Update readme for release v1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
lfurzewaddock committed Feb 25, 2016
1 parent 5da7851 commit 2978cdc
Showing 1 changed file with 132 additions and 0 deletions.
132 changes: 132 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,59 @@ Execute the extension with the keyboard shortcut;
- **Mac**: `Command` + `Alt` + `O`
- **Windows/Linux**: `Ctrl` + `Alt` + `O`

### Customise behaviour per language (optional)

By default plain text based files will open directly in the app set by your OS.

To change this default behaviour you will need to edit 'Workspace Settings' or 'User Settings'.

From within VS Code open the 'File' menu, select 'Preferences', and then select either 'Workspace Settings' or 'User Settings'.

Options are set per 'language', not per file type, so for example setting options for the language 'plaintext', will change the behaviour of several file types including '.txt' and '.log'.

The minimum JSON to change the behaviour of a single language, e.g. html is;

```javascript
"vscode-opn.perLang": {
"opnOptions": [
{
"forLang": "html",
"openInApp": "chrome"
}
]
}
```

#### forLang

*Required*
Type: `string`
Examples include;
- "html"
- "plaintext"
- "css"
- "json"
- "javascript"

#### openInApp

*Required*
Type: `string`
Examples include;
- "chrome"
- "firefox"
- "iexplore"
- "notepad"
- "notepad++"
- "wordpad"
- "winword"
- "winmerge"

*Notes:* The app name examples above are platform dependent and valid for an MS Windows environment. For Google's Chrome web browser for example, you would use `google chrome` on OS X, `google-chrome` on Linux and `chrome` on Windows.


The following example sets all available options for `html` and `plaintext` languages;

```javascript
"vscode-opn.perLang": {
"opnOptions": [
Expand All @@ -83,6 +136,67 @@ Execute the extension with the keyboard shortcut;
"vscode-opn.webServerPort": 8080
```

#### openInAppArgs

*Optional*
Type: `array`
Examples include: ["--incognito", "-private-window"]

*Notes:* A string array of arguments to pass to the app. For example, `--incognito` will tell Google Chrome to open a new window in "Private Browsing Mode", whereas `-private-window` will do something similar in Mozilla Firefox.

#### isUseWebServer

*Optional*
Type: `boolean`
Default: `false`

*Notes:* If you set up a site on your local web server such as MS Windows IIS and your VS Code project folder is within the site root, you can open file URLs instead of URIs. This is useful for code that requires a server environment to run, such as AJAX. You will first need to update the vscode-opn default web server settings with your own.

#### isUseFsPath

*Optional*
Type: `boolean`
Default: `false`

*Notes:* During testing in an MS Win 10 environment both Notepad++ and MS WordPad did not support file URIs. This option will use the local file system path instead. This issue may affect other apps and other platforms too.

#### isWaitForAppExit

*Optional*
Type: `boolean`
Default: `true`

*Notes:* See node.js module [**opn option: wait**](https://github.com/sindresorhus/opn/blob/master/readme.md#wait) for more info.


### Web server settings (applies to all languages)

Required by the per language option: `isUseWebServer`.

#### vscode-opn.webServerProtocol

*Optional*
Type: `string`
Default: `"http"`

*Notes:* Enter a protocol, e.g. "http" or "https".

#### vscode-opn.webServerHostname

*Optional*
Type: `string`
Default: `"localhost"`

*Notes:* Enter the hostname or IP of your local web server.

#### vscode-opn.webServerPort

*Optional*
Type: `number`
Default: `8080`

*Notes:* Enter the port of your local web server.


## Tested

Expand All @@ -103,6 +217,24 @@ Execute the extension with the keyboard shortcut;
- `.docx`
- `.xlsx`
- `.pdf`

## Release notes

Version 1.1.2
Date: 25 Feb 2016

- Set original feature as the default behaviour.
- NEW FEATURE: Setting per language for which app to use
- NEW FEATURE: Setting per language to pass argument(s) to app
- NEW FEATURE: Setting per language to open file URL in local web server
- NEW FEATURE: Setting per language to use file system path, instead of URI
- NEW FEATURE: Setting per language to wait for the opened app to exit before calling the callback

Version 1.0.2
Date: 17 Feb 2016

- FEATURE: Open file URIs directly in the default application for the file type set in the OS.


## Contributions

Expand Down

0 comments on commit 2978cdc

Please sign in to comment.