GithubHelp home page GithubHelp logo

maxrothman / joyride Goto Github PK

View Code? Open in Web Editor NEW

This project forked from betterthantomorrow/joyride

0.0 2.0 0.0 3.48 MB

Joyride VS Code with Clojure

Home Page: https://marketplace.visualstudio.com/items?itemName=betterthantomorrow.joyride

License: Other

JavaScript 0.63% Clojure 99.37%

joyride's Introduction

Joyride VS Code with Clojure!

Modify your editor by executing ClojureScript code in your REPL and/or run scripts via keyboard shortcuts you choose. The Visual Studio Code API is at your command!

A.Joyride.Example.-.Ignore.Form.Command.mp4

The video in much better quality on Youtube (CalvaTV)

Joyride is Powered by SCI (Small Clojure Interpreter).

WIP

You are entering a construction yard. Things are going to change and break your configs while we are searching for good APIs and UI/Ux.

Your feedback is highly welcome!

Quickest Start 1 - Run a User Script

Install Joyride. It will run a sample activate.cljs User script. You can use this script as a base for init/activation stuff of your VS Code environment.

Joyride installs a "regular” User script as well. You can run either of these with the command: Joyride: Run User Script.

Quickest Start 2 - Run some Code

  1. Bring up the VS Code Command Palette (cmd/ctrl+shift+p)
  2. Execute Joyride: Run Clojure Code
  3. Type in some code into the prompt, e.g.
    (require '["vscode" :as vscode]) (vscode/window.showInformationMessage "Hello World!")`
  4. Submit

Quick Start - Start the REPL

While developing Joyride scripts you should of course do it leveraging Interactive Programming (see this video demonstrating it). With Calva it is very quick to start a Joyride REPL and connect Calva to it. This video demonstrates starting from scratch, including installing Joyride.

Calva.Start.a.Joyride.REPL.and.Connect.-.Jack-in.mp4

The demo ”project” used here is only a directory with this file hello_joyride.cljs. Here's the code, if you want to try it out yourself:

(ns hello-joyride
  (:require ["vscode" :as vscode]
            [promesa.core :as p]))

(comment
  (+ 1 2 3 4 5 6 7 8 6)
  (-> (vscode/window.showInformationMessage
       "Come on, Join the Joyride!"
       "Be a Joyrider")
      (p/then
       (fn [choice]
         (println "You choose to:" choice)))))

"Hello World"

Quick Start - Start your Scripts Library

Joyride lets you bind keyboard shortcuts to its User and Workspace scripts.

  • User Scripts: <user home>/.config/joyride/scripts
  • Workspace scripts: <workspace root>.joyride/scripts

Let's go with a Workspace script:

Create a script in your workspace, e.g .joyride/scripts/example.cljs:

(ns example
  (:require ["fs" :as fs]
            ["path" :as path]
            ["vscode" :as vscode]
            [clojure.string :as str]))

(defn info [& xs]
  (vscode/window.showInformationMessage (str/join " " xs)))

(info "The root path of this workspace:" vscode/workspace.rootPath)

(fs/writeFileSync (path/resolve vscode/workspace.rootPath "test.txt") "written!")

This script gives one information message and writes to a file test.txt in your workspace.

Then in your keyboard shortcuts, add:

 {
        "key": "cmd+1",
        "command": "joyride.runWorkspaceScript",
        "args": "example.cljs"
 }

Now you can run the example.cljs script by just hitting Cmd+1!

See doc/configuration.md for full configuration options.

Examples

See the examples for examples including:

  • Creating an interactive Webview
  • Terminal creation and control
  • Fontsize manipulation
  • Calva Structural Editing enhancements
  • Opening and showing project files
  • Workspace activation script
  • The Joyride Extension API
  • The joyride.core namespace

Support and feedback

You'll find us in the #joyride channel on the Clojurians Slack

News

Twitter

Follow the #vsjoyride hashtag on Twitter!

joyride's People

Contributors

borkdude avatar corasaurus-hex avatar dijonkitchen avatar erickisos avatar maxrothman avatar pez avatar scorphus avatar svdo avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.