-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
joyride.core/get-invoked-script
(#39)
Fixes #4
- Loading branch information
Showing
9 changed files
with
68 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
(ns fontsize | ||
(:require ["vscode" :as vscode])) | ||
(:require ["vscode" :as vscode] | ||
[joyride.core :as joyride])) | ||
|
||
(defn set-global-fontsize [pts] | ||
(-> (vscode/workspace.getConfiguration) | ||
(.update "editor.fontSize" pts true)) | ||
nil) | ||
|
||
(comment | ||
(set-global-fontsize 12) | ||
) | ||
(when (= (joyride/get-invoked-script) joyride/*file*) | ||
(set-global-fontsize 12)) | ||
|
||
;; live demo here: https://twitter.com/borkdude/status/1519709769157775360 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
(ns terminal | ||
(:require ["os" :as os] | ||
["path" :as path] | ||
["vscode" :as vscode])) | ||
(:require ["vscode" :as vscode] | ||
[joyride.core :as joyride])) | ||
|
||
;; start a terminal called nbb in $HOME/dev/nbb | ||
(def terminal | ||
(vscode/window.createTerminal | ||
#js {:name "nbb" | ||
:cwd (path/join (os/homedir) "dev" "nbb")})) | ||
(defn main [] | ||
;; start a terminal called nbb in $HOME/dev/nbb | ||
(let [terminal (vscode/window.createTerminal | ||
#js {:name "nbb"})] | ||
|
||
;; make it visible | ||
(.show terminal true) | ||
|
||
;; make it visible | ||
(terminal.show true) | ||
;; send an initial command to it | ||
(.sendText terminal "npx nbb"))) | ||
|
||
;; send an initial command to it | ||
(terminal.sendText "bb dev") | ||
(when (= (joyride/get-invoked-script) joyride/*file*) | ||
(main)) | ||
|
||
;; see live demo here: | ||
;; https://twitter.com/borkdude/status/1519304323703971841 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
(ns webview.example | ||
(:require ["fs" :as fs] | ||
["path" :as path] | ||
["vscode" :as vscode])) | ||
(:require ["path" :as path] | ||
["vscode" :as vscode] | ||
[joyride.core :as joyride] | ||
[promesa.core :as p])) | ||
|
||
(def panel | ||
(vscode/window.createWebviewPanel | ||
"My webview!" "Scittle" | ||
vscode/ViewColumn.One | ||
#js {:enableScripts true})) | ||
(defn main [] | ||
(p/let [panel (vscode/window.createWebviewPanel | ||
"My webview!" "Scittle" | ||
vscode/ViewColumn.One | ||
#js {:enableScripts true}) | ||
uri (vscode/Uri.file (path/join vscode/workspace.rootPath | ||
".joyride" "scripts" "webview" | ||
"page.html")) | ||
data (vscode/workspace.fs.readFile uri) | ||
html (.decode (js/TextDecoder. "utf-8") data)] | ||
(set! (.. panel -webview -html) (str html)))) | ||
|
||
(def html (fs/readFileSync (path/join vscode/workspace.rootPath | ||
".joyride" "scripts" "webview" | ||
"page.html"))) | ||
|
||
(set! (.. panel -webview -html) (str html)) | ||
(when (= (joyride/get-invoked-script) joyride/*file*) | ||
(main)) | ||
|
||
;; live demo here: https://twitter.com/borkdude/status/1519607386218053632 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters