-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(launch): Moare launcher improvements:
- Merge Alt+L L and Ctrl+Alt S - contextual editor run/debug as works as [Ctrl+Alt S when no active REPL found] - Make debugger work - print stacktrace if loading a file fails, and do not stop the process of starting the REPL
- Loading branch information
1 parent
005127f
commit 80e2e4f
Showing
12 changed files
with
198 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
eclipse.preferences.version=1 | ||
encoding//src/java/ccw/launching/ClojureLaunchShortcut.java=UTF-8 |
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
(ns ccw.editors.clojure.debug-hyperlink | ||
"Detect and create hyperlinks in Consoles when a pattern describing a JVM | ||
listening to some debug port is found. | ||
The first time the pattern is encountered for the currently attached console, | ||
will automatically start a remote process for connecting to this port" | ||
(:require [ccw.string :as s] | ||
[ccw.launch :as launch] | ||
[ccw.eclipse :as e]) | ||
(:use [clojure.test]) | ||
(:import [org.eclipse.ui.console PatternMatchEvent TextConsole])) | ||
|
||
(def ^:private debug-port-pattern #"\d+") | ||
|
||
(defn remote-connect | ||
"Launch a remote java debugging connection on port for project." | ||
[project port] | ||
(launch/launch :debug | ||
{:type-id :remote-java | ||
:private true | ||
:name (str (and project (e/project-name project)) " VM") | ||
:launch-in-background false | ||
:java/project-name (and project (e/project-name project)) | ||
:java/vm-connector (launch/vm-connector :socket-attach-vm-connector) | ||
:java/connect-map {"port" port | ||
"hostname" "localhost"}})) | ||
|
||
(defn match-found | ||
"state contains the console instance, and a set of seen (if many) debug port patterns. | ||
This allows to e.g. only process opening remote connections once, even if | ||
match-found is called several times on the same text." | ||
[^PatternMatchEvent event ^TextConsole {:keys [console debug-ports] :as state}] | ||
(let [offset (.getOffset event) | ||
length (.getLength event) | ||
document (.getDocument console) | ||
s (.get document offset length) | ||
[debug-port] (re-seq debug-port-pattern s) | ||
remote-connect #(remote-connect | ||
(some-> console .getProcess .getLaunch e/project) | ||
debug-port) | ||
hyperlink (reify org.eclipse.ui.console.IHyperlink | ||
(linkActivated [this] (remote-connect)) | ||
(linkExited [this]) | ||
(linkEntered [this]))] | ||
(.addHyperlink console hyperlink offset length) | ||
(when-not (debug-ports debug-port) | ||
(e/ui (remote-connect))) | ||
(update-in state [:debug-ports] conj debug-port))) | ||
|
||
(defn make [] | ||
(let [state (atom nil)] | ||
(reify org.eclipse.ui.console.IPatternMatchListenerDelegate | ||
(connect [this console] (reset! state {:console console | ||
:debug-ports #{}})) | ||
(disconnect [this] (reset! state nil)) | ||
(matchFound [this event] | ||
(swap! state (partial match-found event)) | ||
nil)))) | ||
|
||
(defn factory "plugin.xml hook" [ _ ] (make)) |
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
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
Oops, something went wrong.