Fork me on GitHub
#portal
<
2023-03-25
>
Stephan Renatus19:03:38

is there a way to have a line number with goto-definition? I found that it works nicely for files, but I couldn’t figure out line numbers were a thing there. From https://github.com/djblue/portal/blob/bf98fa0c4b11a5e27e0ece19480147c6da86b2ad/src/portal/runtime/jvm/editor.clj#L119-L130, I would not suspect such a thing, but I figured it wouldn’t hurt to ask 😄 (Also I might be looking at the wrong code)

2
djblue19:03:35

Goto should work with file, line and column

djblue19:03:05

There are a few ways to specify the info, but usually a map with that info is good enough

Stephan Renatus19:03:59

hmm when I press g d on

"/Users/stephan/Sources/foo/bar/factory_test.go"
I get to that tab in vscode, if I do the same on
"/Users/stephan/Sources/foo/bar/factory_test.go:31"
nothing happens

Stephan Renatus19:03:21

oh ok that’s not a map

👍 2
djblue19:03:44

Currently, the code doesn't try to parse strings for that info

Stephan Renatus19:03:52

so I need

{"file": ..., "line": 31, "column": 0 }
?

👍 2
Stephan Renatus19:03:28

oh my it just works

awesome 3
Stephan Renatus19:03:32

🥳 thanks a lot

Stephan Renatus19:03:13

don’t even need "column": 0 (since I don’t have that info anyways)

djblue19:03:27

If a value produces metadata that also looks like that (like vars) it will also work 👌

Stephan Renatus19:03:02

I’m currently pushing a JSON blob into /submit; how that would work with metadata is still beyond me

Stephan Renatus19:03:26

(I might have given it away already that I’m using this with Go 😅)

🎉 2
djblue19:03:37

Yeah, it would need to be edn for metadata

djblue19:03:03

That's pretty neat 👌

Stephan Renatus19:03:38

thanks again for your help!

💯 2
djblue19:03:20

Might also be cool to produce data for the log viewer :thinking_face:

Stephan Renatus19:03:46

(I had only looked at exception before and that was too specific)

Stephan Renatus19:03:17

how does symbol? look like in json?

djblue19:03:18

I'll see about accepting something more json friendly :thinking_face:

djblue19:03:12

Although, it might be equally nice to provide a hook in the submit handler to transform data

👍 2
Stephan Renatus20:03:11

I’m still getting into all this… so I won’t volunteer for a PR right away 😅 but I like it a lot, thanks for portal

👍 2