Skip to content

Commit

Permalink
Resolve #93: add config entry to set whether to preserve focus on cod…
Browse files Browse the repository at this point in the history
…e editor after code run is triggered
  • Loading branch information
formulahendry committed Mar 12, 2017
1 parent acf9288 commit 00fa1f0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 0.6.14 (2017-03-12)
* Resolve [GitHub issue#93](https://github.com/formulahendry/vscode-code-runner/issues/93): Add config entry to set whether to preserve focus on code editor after code run is triggered

### 0.6.13 (2017-03-05)
* Add support for AutoHotkey

Expand Down Expand Up @@ -68,7 +71,7 @@
* Add support to run code in Integrated Terminal

### 0.3.4
* Resolve [GitHub issue#24](https://github.com/formulahendry/vscode-code-runner/issues/24): Add config entry to set whether to Whether to show extra execution message
* Resolve [GitHub issue#24](https://github.com/formulahendry/vscode-code-runner/issues/24): Add config entry to set whether to show extra execution message

### 0.3.3
* Add support to run by language from a suggestion list
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ To set whether to show extra execution message like [Running] ... and [Done] ...
}
```

To set whether to preserve focus on code editor after code run is triggered (default is true, the code editor will keep focus; when it is false, Terminal or Output Channel will take focus):
```json
{
"code-runner.preserveFocus": true
}
```

## About CWD Setting (current working directory)
1. By default, use the `code-runner.cwd` setting
2. If `code-runner.cwd` is not set and `code-runner.fileDirectoryAsCwd` is `true`, use the directory of the file to be executed
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "code-runner",
"displayName": "Code Runner",
"description": "Run code snippet/file for C, C++, Java, JS, PHP, Python, Perl, Ruby, Go, Lua, Groovy, PowerShell, BAT/CMD, BASH/SH, F#, C#, VBScript, TypeScript, CoffeeScript, Scala, Swift, Julia, Crystal, OCaml, R, AppleScript, Elixir, VB.NET, Clojure, Haxe, Objective-C, Rust, Racket, AutoHotkey",
"version": "0.6.13",
"version": "0.6.14",
"publisher": "formulahendry",
"icon": "images/logo.png",
"engines": {
Expand Down Expand Up @@ -195,6 +195,11 @@
"type": "boolean",
"default": false,
"description": "Whether to run code in Integrated Terminal"
},
"code-runner.preserveFocus": {
"type": "boolean",
"default": true,
"description": "Whether to preserve focus on code editor after code run is triggered"
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions src/codeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ export class CodeManager {
if (this._terminal === null) {
this._terminal = vscode.window.createTerminal('Code');
}
this._terminal.show(true);
this._terminal.show(this._config.get<boolean>('preserveFocus'));
executor = this.changeExecutorFromCmdToPs(executor);
this._appInsightsClient.sendEvent(executor);
let command = this.getFinalCommandToRunCodeFile(executor, appendFile);
Expand All @@ -315,7 +315,7 @@ export class CodeManager {
this._outputChannel.clear();
}
let showExecutionMessage = this._config.get<boolean>('showExecutionMessage');
this._outputChannel.show(true);
this._outputChannel.show(this._config.get<boolean>('preserveFocus'));
let exec = require('child_process').exec;
let command = this.getFinalCommandToRunCodeFile(executor, appendFile);
if (showExecutionMessage) {
Expand Down

0 comments on commit 00fa1f0

Please sign in to comment.