formulahendry / vscode-code-runner Goto Github PK
View Code? Open in Web Editor NEWCode Runner for Visual Studio Code
Home Page: https://marketplace.visualstudio.com/items?itemName=formulahendry.code-runner
License: MIT License
Code Runner for Visual Studio Code
Home Page: https://marketplace.visualstudio.com/items?itemName=formulahendry.code-runner
License: MIT License
Hi, great extensions, thanks.
I use nvm to manage a multi-version node environment.
The problem is like below:
//to enable running bash as a login shell (which runs `.bash_profile`)
"terminal.integrated.shellArgs.osx": [
"-l"
],
console.log(process.version)
, the output is v4.7.0
node test.js
, the output is v6.9.2
nvm
will add the following lines to the .bash_profile
:export NVM_DIR="/Users/albertgao/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
"code-runner.executorMap": {}
It would be super nice if the code-runner could use the interpreter which comes from the integrated terminal or at least we can configure it :) Thanks.
Add the ability to run VBScript directly from the VS Code.
I'm not sure if this is something you want to add since there are workarounds, such as customizing the user's 'settings.json' to add the language.
I'm using vs code with the ocaml extension , and it has been a joy .
Please can you add support for running ocaml code too , it would be fantastic for the ocaml users of vs code
In the setting file, how to enter the workspaceRoot directory? such as "cpp": "cd $workspaceRoot && build && out.exe".
Refer to contributes.menus
I use a lot the code runner in javascript to play with other libraries or to create a spike for a function and usually I end up filling my snippets with console.log to get the output.
Probably it would be useful that the extension automatically prints to the console the result of the evaluation.
The ramda playground is a good example: http://ramdajs.com/repl/
Opinions?
Thx
Since this extension can support C# and managed C++ (VC++) languages, and we know that VB.NET is also "natively" supported in VS Code as part of the .NET platform like the two other mentioned languages, then I would like to ask why this extension ddn't added support VB.NET, and if it is going to add support for that language in the near future (I imagine it only would require little modifications).
Thanks for read.
i set the path of python like this:
"code-runner.executorMap": {
"python": "C:\Program Files\Python35\python.exe"
}
but run faid:
[Running] C:\Program Files\Python35\python.exe "c:\Users\Administrator\Desktop\中文\temp-fuopntmsyc.py"
'C:\Program' �����ڲ����ⲿ���Ҳ���ǿ����еij���
���������ļ���
[Done] exited with code=1 in 0.045 seconds
what can i do ,thank you!
Also take care of the back slash and the space of file path
As mentioned in the readme I've installed the scriptcs
extension and it works fine on the terminal for the *.csx
scripts but it's not the same with run code
command in VsCode.
Console.WriteLine("Hello C#")
The above displays the expected output with scriptcs scratch.csx
but inside VsCode
it raises the following error
[Running] scriptcs "/Users/eklavya/Projects/Amsterdam/RosettaCode/scratch.csx"
Unexpected named argument: Users/eklavya/Projects/Amsterdam/RosettaCode/scratch.csx
Usage: scriptcs options
OPTION DESCRIPTION
-ScriptName (-script) Script file name, must be specified first
-Repl (-R) Launch REPL mode when running script. To just launch REPL, simply omit the 'script' argument.
-Help (-?) Displays help
-Debug (-D) Emits PDB symbols allowing for attaching a Visual Studio debugger
-Cache (-C) Flag which determines whether to run in memory or from a .dll
-LogLevel (-log) Flag which defines the log level used.
-Install (-i) Installs and restores packages which are specified in packages.config
-Global (-g) Installs and restores global packages which are specified in packages.config
-Save (-S) Creates a packages.config file based on the packages directory
-Clean (-Cl) Cleans installed packages from working directory
-AllowPreRelease (-pre) Allows installation of packages' prelease versions
-Version (-V) Outputs version information
-Watch (-W) Watch the script file and reload it when changed
-Modules (-M) Specify modules to load
-Config (-Co) Defines config file name
-PackageVersion (-P) Defines the version of the package to install. Used in conjunction with -install
-Output (-O) Write all console output to the specified file
EXAMPLE: scriptcs server.csx -logLevel debug
Executes the 'server.csx' script and displays detailed log messages. Useful for debugging.
[Done] exited with code=1 in 0.302 seconds
So if you have autosave on (on "onFocusChange") it does not consider changing the focus when running the script with this extension (which I believe is the expected behavior since every time I'd like to run a script I would need to change the focus back to the file to keep working on it).
But if you have autosave on, you would expect the file to be saved before running it. So could the extension have an option to save the file before running it? :)
I just tried add it at pull requests instead issues but no text field open to me can write it.
But, if possible, add support to debug programs.
I would like to have it at least for Groovy, Swift, Java, Ruby and C#.
VB.Net support would be nice too.
Thanks.
The default "code-runner.executorMap" of "c": "gcc $fullFileName && ./a.out" and "cpp": "g++ $fullFileName && ./a.out", but in pc the default output file name is "a.exe", and exec method should be "a.exe" or "a".
Support reading data from user input. #16
Currently context menu of Output panel has "Run Code" menu, which return "Code language not supported or defined."
Is it bug or a feature?
When running, for example, a js (node) script, it sets the cwd to the global node installation so any modules you have locally installed won't recognize and err...
Can you add support variables like ${fileDirname} for "Set the working directory" setting?
I need exec scripts from local directory.
thank you.
Hi, thanks the very neat extension.
I tried to configure the Code Runner to open html files in Chrome, but not working.
Config:
"code-runner.executorMap": {
"javascript": "node"
},
"code-runner.defaultLanguage": "javascript",
"code-runner.clearPreviousOutput": true,
"code-runner.saveFileBeforeRun": false,
"code-runner.executorMapByFileExtension": {
".html": "chrome.exe"
}
But I m getting below error:
[Running] chrome.exe "d:\angular-directive-demo.html"
'chrome.exe' is not recognized as an internal or external command,
operable program or batch file.
[Done] exited with code=1 in 0.176 seconds
I tried given the chrome.exe's complete path as well, but same issue.
Is there any way to invoke any arbitrary command/exe?
Code Runner: 0.4.1
VSCode: 1.7.1
Windows 8.1
Thanks.
Dear guys:
I use Visual Studio Code recently, and I found something strange today. When I use the plugin named "Code Runner" to test my code which involves the function "prompt()", the terminal always show the error "prompt is not defined". (Please refer the code)
var names = ["David", "Cynthia", "Raymond", "Clayton", "Jennifer"];
var name = prompt();
var position = names.indexOf(name);
if (position >= 0) {
console.log("Found at position " + position);
} else {
console.log("not found in array.");
}
Please help me to figure out the reason and to find out how to replace "prompt()" by other function?
Thank you so much!
When I run typescript file,gibberish happened.I juest write one line code,"console.info("jike");"
,so as follows:
[Running] ts-node "f:\vscodeSpace\typingsTest\app.ts"
'ts-node' �����ڲ����ⲿ���Ҳ���ǿ����еij���
���������ļ���
如题
Lets say I'm looking at a es6 script and I have the Babel watch task open to transpile my code to a "build" directory in the root of my project. How would I use this extension in such a scenario?
Hi, would it be possible to add a 'run code' option under the File menu? Also I think it would be nice if you choose to open a new window and see the results there.
Thank you!
EDIT: this issue is irrelevant and don't belong in this repo. Apologies
The runner creates an output panel every time its goes, should it reuse only one?
Is it possible to define default language for code execution?
For example I open new plain text file (Ctrl+N) and do some javascript in it and want to run it but it says 'Code language not supported or defined'.
Can I set to run code as javascript if code language is not defined?
For fast code testing without saving new file it would be even better to have commands like 'run code js', 'run code php' and so on.
or add more characters to clearly separate the script runs...?
First of all,thanks for your ext! It's really awesome
on windows
the default encoding of cmd is cp936,but the this ext output default is utf8 that will case a decoding problem,
like this:
i wonder if it's better to add a feature for some language to set the environment variable before executing *.py file
Hi,
please add an option to configure multiple commands for filetypes:
this would be usefull if you need to execute your code in different environments.
Examples:
If you have multiple tools configured, the code runner will ask you wich tool you want to use.
You should be able to configure the order, in which the tools will be listed.
(priority config, alphabetical or recently used)
Configuration example:
{ "code-runner.executorMap": { "bash": { "local" : "bash", "remote" : "ssh" }, "sql": { "mysql" : "mysql", "oracle" : "sqlplus", "postgreSQL" : "psql" }, } }
通常在工作目录下执行
mvn test -Dtest=com.test.api.testcase#case1
即可运行一个测试case
希望run code可以加入此类文件的执行
I want to do nodemon somefile.js (nodemon installed locally so I need to go through the npm script).
so in scripts in package.json I have
"mon": "nodemon",
and in code-runner execmap settings:
"mon": "npm run mon",
I get this:
> [email protected] mon c:\Users\rickm\Documents\Google Drive\Side-projects\Programming\NodeJS\playground-js
> nodemon "c:\Users\rickm\Documents\Google Drive\Side-projects\Programming\NodeJS\playground-js\server_frameworks\spirit\return-early.js"
[nodemon] 1.10.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node "c:\\Users\\rickm\\Documents\\Google Drive\\Side-projects\\Programming\\NodeJS\\playground-js\\server_frameworks\\spirit\\return-early.js"`
module.js:442
throw err;
^
Error: Cannot find module 'c:\Users\rickm\Documents\Google Drive\Side-projects\Programming\NodeJS\playground-js\"c:\Users\rickm\Documents\Google'
Is there an obvious way to run this JavaScript snippet?
--- js code ---
require('moment')
console.log('--- start')
console.log('moment().format(): ', moment().format())
console.log('--- end')
--- output ---
[Running] node "c:\lab\temp-ackikjupmw.js"
--- start
C:\lab\temp-ackikjupmw.js:3
console.log('moment().format(): ', moment().format())
^
ReferenceError: moment is not defined
at Object. (C:\lab\temp-ackikjupmw.js:3:36)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Function.Module.runMain (module.js:575:10)
at startup (node.js:160:18)
at node.js:449:3
[Done] exited with code=1 in 0.189 seconds
Hello,
I'm a total noob at programming, so I appreciate your help and patience. I've been searching around for the best IDE (or IDE-like) setting to learn Python and I think I'd like to settle on VS Code. I'm trying to run a simple program that prompts the user for input, but when I do, the program just hangs indefinitely until I terminate it. I can't input the string and complete the program run. What am I missing? I'm running ht latest version of Python 3.5x. Thanks!
Any way to keep the focus in the code window when running? Adding option to this plugin or is there any known way already?
I have it open in CS Code terminal in window and after run the cursor is in the terminal so I have to manually click the code again, and then, and then...
👍 this plugin!
Currently, the extension looks for the command in the OS path. But having global installs is a horrible dev experience. The alternative is to create a npm script (which calls the local install of the npm module) and
create andexecmap in vscode-runner that goes through that npm script. It gets messy.
It would be super nice for the extension to support this:
"code-runner.executorMap": {
"mon": "./node_modules/.bin/nodemon",
}
So if you have installed x module (with a runnable) locally, it runs it. This is super helpful when cloning repos and working with modules like babel, nodemon, gulp, etc, etc...Which is the dev's day to day life.
I'm using the "Code Runner" VS extension and I'm not able to change PowerShell executable path to point to ver. 6.0.0.10:
"C:/Program Files/PowerShell/6.0.0.10/PowerShell.exe" in "settings.json" file.
Following instructions on link: https://github.com/PowerShell/PowerShell/blob/master/docs/learning-powershell/using-vscode.md
In VS Code Output panel $PSVersionTable results stills shows: PSVersion 5.1.14300.1000.
I did open an incident VS code but the path change works on their Debug option:
"VS Code "powershell.developer.powerShellExePath" not changing path to executable #295"
$PSVersionTable
: See attached image.In my settings:
"code-runner.executorMapByFileExtension": {
"*.js": "node",
".es": "npm run babel-node",
".ts": "npm run ts-node"
},
// Set the executor of each language.
"code-runner.executorMap": {
"sup": "npm run sup",
"sup-babel": "npm run sup-babel",
"javascript": "node",
"php": "php",
"python": "python",
"perl": "perl",
"ruby": "ruby",
"go": "go run",
"lua": "lua",
"groovy": "groovy",
"powershell": "powershell -ExecutionPolicy ByPass -File",
"bat": "",
"shellscript": "bash",
"fsharp": "fsi",
"csharp": "scriptcs",
"vbscript": "cscript //Nologo"
},
When I run a .es file, it runs node instead of npm run babel-node.
Note: no difference if setting "*.es" or ".es"
Java, C++, Ocaml, etc.
It would be useful have a setting to remove the pre ([Running]) and post ([Done]) labels in the output console.
thx
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.