File tree 2 files changed +13
-6
lines changed
2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 20
20
(defn- source-location? [value]
21
21
(s/valid? ::source-location value))
22
22
23
+ (defn ->source-location [value]
24
+ (when (source-location? value)
25
+ (with-meta
26
+ (select-keys value [:ns :column :line :file :label ])
27
+ (assoc (meta value)
28
+ :portal.viewer/default :portal.viewer/source-location ))))
29
+
23
30
(defn inspect-source [value]
24
31
(let [theme (theme/use-theme )]
25
32
[d/div
Original file line number Diff line number Diff line change 6
6
[portal.ui.inspector :as ins]
7
7
[portal.ui.select :as select]
8
8
[portal.ui.styled :as d]
9
- [portal.ui.theme :as theme]))
9
+ [portal.ui.theme :as theme]
10
+ [portal.ui.viewer.source-location :as src]))
10
11
11
12
; ;; :spec
12
13
(s/def :test-run/type #{:end-run-tests })
147
148
:border-bottom-right-radius (when-not expanded? (:border-radius theme))}}
148
149
[ins/toggle-expand {:padding-left (:padding theme)}]
149
150
[label value]
150
- (when-let [file ( :file value)]
151
+ (when-let [location ( src/->source-location value)]
151
152
[d/div
152
- {:style {:color (::c/uri theme)}}
153
- file
154
- (when-let [line (:line value)]
155
- [:<> " :" line])])]]
153
+ [select/with-position
154
+ {:row -1 :column 1 }
155
+ [ins/with-key :loc [ins/inspector location]]]])]]
156
156
157
157
(when (:expanded? options)
158
158
[ins/inspect-map-k-v (dissoc value :type :message :file :line :ns :var )])]))
You can’t perform that action at this time.
0 commit comments