-
-
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 configurable user scripts location via env var * Add smoke test for user-activate * Add JS example script to default user scripts content Fixes #136 TODO: * [ ] Add more smoke tests * [ ] Handle new my-lib location somehow * Make user JS scripts reload when run * Create user example script exports work * Add tests for running user scripts * Consolidate test files some * Add test for reloading js scripts * Add check for minimum passed assertions Fixes #138 * Only create getting started user content if activate is missing Fixes #139 * Add test run launch config * Open extension host in workspace 1 folder by default
- Loading branch information
Showing
12 changed files
with
248 additions
and
87 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
26 changes: 26 additions & 0 deletions
26
assets/getting-started-content/user/hello_joyride_user_script.js
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const vscode = require("vscode"); | ||
|
||
// You can write your Joyride scripts in JavaScript, if you want. | ||
|
||
const hello = () => { | ||
return "Hello World!"; | ||
}; | ||
|
||
const showHelloMessage = async () => { | ||
const button = await vscode.window.showInformationMessage("Hello World!", "Cancel", "OK"); | ||
if (button === "OK") { | ||
vscode.window.showInformationMessage("You clicked OK! Try clicking Cancel too?."); | ||
} else { | ||
const name = await vscode.window.showInputBox({ | ||
title: "CIA wants to know", | ||
prompt: "What is your name?", | ||
}); | ||
vscode.window.showInformationMessage(`Hello ${name}!`); | ||
} | ||
}; | ||
|
||
hello(); | ||
showHelloMessage(); | ||
|
||
exports.hello = hello; | ||
exports.showHelloMessage = showHelloMessage; |
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
(ns problem-hover | ||
(:require ["vscode" :as vscode])) | ||
|
||
;; Adding diagnostics info to the top of the hover to get it above the fold | ||
|
||
(defonce !problems (atom {})) | ||
|
||
(defn on-changed-diagnostics [event] | ||
(doseq [uri (.-uris event)] | ||
(swap! !problems assoc (.-fsPath uri) (vscode/languages.getDiagnostics uri)))) | ||
|
||
(defn- provide-hover [document position] | ||
(let [hover (vscode/MarkdownString.) | ||
problems (->> (get @!problems (-> document .-uri .-fsPath)) | ||
(keep (fn [problem] | ||
(let [range (.-range problem)] | ||
(when (.contains range position) | ||
problem)))))] | ||
(doseq [problem problems] | ||
(.appendCodeblock hover (str (.-message problem) | ||
"; " (.-source problem) | ||
(when (.-code problem) | ||
(str "(" (.-code problem) ")"))) | ||
; highlight hover as 'ini', because works | ||
"ini")) | ||
(new vscode/Hover #js [hover]))) | ||
|
||
(defn register-diagnostics-handler! [] | ||
(vscode/languages.onDidChangeDiagnostics on-changed-diagnostics)) | ||
|
||
(defn register-provider! [] | ||
; Use "*" instead of "clojure" to add this to all file types | ||
(vscode/languages.registerHoverProvider "clojure" #js {:provideHover provide-hover})) | ||
|
||
(comment | ||
foo | ||
(remove 1 2 3) | ||
:rcf) | ||
|
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
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
18 changes: 14 additions & 4 deletions
18
...gration_test/workspace_activate_test.cljs → ...e/src/integration_test/activate_test.cljs
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
Oops, something went wrong.