ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Eval​Printer

by philippotto ALL

Transpiles, evaluates and prints code. Provides immediate feedback for code execution within Sublime Text.

Details

  • 1.2.2
  • github.​com
  • github.​com
  • 10 years ago
  • 58 minutes ago
  • 10 years ago

Installs

  • Total 4K
  • Win 2K
  • Mac 906
  • Linux 544
Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7 Mar 6
Windows 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 2 0 0 0 0 0 1 0 0 0
Mac 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

Sublime-EvalPrinter Build Status

EvalPrinter is a Sublime Text 2/3 Plugin which transpiles, evaluates and prints code. This allows rapid testing of code snippets without leaving your code editor. To see which languages are supported, see the appropriate section.

Motivation

You are writing some code and you are unsure if it does what you want? Is JavaScript's second parameter for String.prototype.slice the index of the last character? Or is it the amount of characters to slice? Does Python's reverse-method for lists return a reversed copy or does it modify the instance? Do you need these braces in your CoffeeScript code or are they optional?

Don't look this up in the documention! Don't open a shell, in which you replicate the code you already wrote! Stay in Sublime and just evaluate/transpile your code. With EvalPrinter.

Unlike a REPL, EvalPrinter does not only work with simple expressions but with entire blocks of code. Because you don't have to switch to another program, context switches are reduced und Sublime's usual text editing capabilities can be used, as well.

Additionally, the live session mode provides true immediate feedback which is completely missing in a REPL. The same applies for showing the results of transpilation processes.

Features

You can trigger the eval_print command to transpile/evaluate the current selection (or the current line if nothing is selected). The default keybinding is Shift + Alt + Enter. By default, the output will yield the result of the last expression. Additional output can be achieved via the standard logging methods of the current programming language (e.g. console.log in JavaScript and print in Python).

Another possibility is to enter a “live session”, in which the code will be transpiled/evaluated after each keystroke. The immediate feedback makes it especially useful for tweaking code until it's perfect. The command is called eval_print_enter_live_session and the default keybinding is Ctrl/Cmd + Shift + Alt + Enter. Invoke it again to exit the mode.

For languages which will be transpiled (e.g. CoffeeScript), the output will also include the result of the transpilation process:

Supported languages

Currently, the following languages are supported:

  • JavaScript
  • CoffeeScript
  • Python

Feel free to open issues or submit pull requests to add support for other languages.

Installation

Either use Package Control and search for EvalPrinter or clone this repository into Sublime Text “Packages” directory.

License

MIT © Philipp Otto 2014