File tree 2 files changed +12
-5
lines changed
2 files changed +12
-5
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 2
2
(:require [clojure.spec.alpha :as s]
3
3
[portal.colors :as c]
4
4
[portal.ui.filter :as-alias f]
5
+ [portal.ui.viewer.source-location :as src]
5
6
[portal.ui.icons :as icons]
6
7
[portal.ui.inspector :as ins]
7
8
[portal.ui.select :as select]
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