Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ The extension has no control over DevDocs. For best user experience, you should

For further information, please refer to [DevDocs Help](http://devdocs.io/help).

## Extension Settings

This extension contributes the following setting:

```json
"devdocs.column": {
"type": "number",
"default": 2,
"description": "A number which indicates which column (1, 2, or 3) to display DevDocs in"
}
```

## Known Issues

* Document list in `devdocs.settings` page might be buggy (lose scroll position on first click)
Expand Down
12 changes: 12 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@
}
]
},
"configuration": {
"title": "DevDocs: Configuration",
"properties": {
"devdocs.column": {
"type": "number",
"minimum": 1,
"maximum": 3,
"default": 2,
"description": "A number which indicates which column (1, 2, or 3) to display DevDocs in"
}
}
},
"keybindings": [
{
"key": "alt+shift+d",
Expand Down
9 changes: 8 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,15 @@ export function activate(context: vscode.ExtensionContext) {
let devdocs = new DevDocsContentProvider()
let registration = vscode.workspace.registerTextDocumentContentProvider(SCHEME, devdocs)

const getColumn = () => {
const column = vscode.workspace.getConfiguration('devdocs').get<number>('column');
return column < 1 || column > 3
? vscode.ViewColumn.Two
: <vscode.ViewColumn>column
}

const openHtml = (uri: vscode.Uri, title) => {
return vscode.commands.executeCommand('vscode.previewHtml', uri, vscode.ViewColumn.Two, title)
return vscode.commands.executeCommand('vscode.previewHtml', uri, getColumn(), title)
.then((success) => {
}, (reason) => {
vscode.window.showErrorMessage(reason)
Expand Down