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

Chrome​REPL

by acarabott ST3

A Sublime Text plugin to execute JavaScript in Google Chrome

Details

Installs

  • Total 3K
  • Win 2K
  • Mac 530
  • Linux 275
Jul 27 Jul 26 Jul 25 Jul 24 Jul 23 Jul 22 Jul 21 Jul 20 Jul 19 Jul 18 Jul 17 Jul 16 Jul 15 Jul 14 Jul 13 Jul 12 Jul 11 Jul 10 Jul 9 Jul 8 Jul 7 Jul 6 Jul 5 Jul 4 Jul 3 Jul 2 Jul 1 Jun 30 Jun 29 Jun 28 Jun 27 Jun 26 Jun 25 Jun 24 Jun 23 Jun 22 Jun 21 Jun 20 Jun 19 Jun 18 Jun 17 Jun 16 Jun 15 Jun 14 Jun 13 Jun 12
Windows 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 1 0 1 1 1 0 1 1 0 1 0 1 1
Mac 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 0 0 0 0
Linux 0 0 0 0 0 0 0 0 1 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 1 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

ChromeREPL

A SublimeText 3 Plugin to use Chrome as your REPL.

Execute JavaScript in your browser. Interact with your running webapps. Live code your brains out!

Why?

Because Chrome ain't no text editor. Anything longer than a line is a pain, and so is recalling what you typed earlier.

Screencast

Installation

Via Package Control (recommended! 👍👍👍)

Alternatively, clone this repo into your Packages directory. e.g. ~/Library/Application Support/Sublime Text 3/Packages/ on macOS. If you do this you will need to open the Command Palette and run Package Control: Satisfy Dependencies.

Starting Chrome

Chrome needs to be started with a special flag 🏳️ (--remote-debugging-port).

Don't worry, commands are provided to do this for you 😅.

Run them by opening the Command Pallete (macOS: cmd shift P, win/lin: ctrl shift P).

  1. If you haven't opened Chrome, use the Chrome REPL: Start Chrome command.
  2. If Chrome is already running, use Chrome REPL: Restart Chrome with remote debugging*

*this will quit and re-open Chrome, if you want to preserve your tabs, make sure you have set this behaviour in Chrome's settings: On start-up: Continue where you left off.

🚨 Security Warning: New User Profile 🚨

When Chrome restarts, it will use a new Chrome user profile. This is because the Chrome DevTools protocol (that is used for communication) opens a port for communication, but also exposes your cookies. To prevent people on your network from sniffing your important cookies (e.g. website logins), a temporary Chrome user profile is used.

Usage

  1. Start/Restart Chrome as above
  2. Run the Chrome REPL: Connect to Tab command
  3. Select the tab you want to connect to
  4. You should see "Sublime Text connected" in the Chrome Developer Tools console
  5. Use Shift Enter in Sublime Text to execute JavaScript code:
    • If you have nothing selected it will execute the current line
    • With code selected it will execute just the selection

Note: Each Sublime tab can be connected to one Chrome tab. The connected tab is displayed in Sublime in the status bar at the bottom of tab.

Additional commands

  • Clear Console Cmd/Ctrl Shift C
  • Reload Page Cmd/Ctrl Shift R
  • Reload Page (Ignore Cache) Cmd/Ctrl Shift Alt R

Settings

  • 📁 Path to Chrome (can be Chrome, Canary, or Chromium)
  • 👀 Automatically focus on connected Chrome tab (requires wmctrl on Linux)
  • 🔧 Automatically opening the Developer Tools for every new window
  • 🏳️ Additional chrome flags
  • ⌨️ Enabling the Command Line API
  • 🏠 Custom hostname and port

Thanks

The project was inspired by SublimeWebInspector, but is far less ambitious, not as opinionated, and thus easier to maintain.

This uses a ever so slightly modified version of PyChromeDevTools, and a stripped down version of Sublime Goto Window.

Known Issues

This plugin relies on psutil. The latest version of psutil requires Python 3.4. This means we are stuck with 5.4.1 which has a known issue on macOS to do with zombie processes. If the only option in the command palette is Restart Chrome then you may need to reboot your machine to clear the issue.

Author

Arthur Carabott - arthurcarabott.com

Buy Me A Coffee