Jump to definition for dependencies doesn't work in Nova

Hi! I'm on Nova 8.4 with Playdate 1.7.0, and I can't Jump To Definition (command-click) code that's in another file.
This makes using the SDK super awkward! For example, I've been looking at the example code local one = i:blurredImage(10, 2, dither, false) but I don't have any way to see what the parameters are called! Being able to hover to see the parameter names would be super useful here too. Obviously I can search for blurredImage in the SDK but it's a little annoying to do it this way.

Have I missed something obvious, or is this just not supported?

1 Like

There seem to be two issues here:

  1. Cmd-clicking to Jump to Definition. This works for me, whether the function is defined in another file or not. The example you give doesn't include anything that could be jumped to; blurredImage is an SDK function, not something defined in your code.

  2. Seeing function parameters. These are shown when you accept the autocomplete of a function, for instance:

You can then Tab through the parameters. There's no way to see the parameters once you've already typed the whole line, except by jumping to the definition. Also, Nova won't show the parameters for an SDK function; I think this is because the function isn't defined anywhere inside your project, so it doesn't know anything above it beyond the name. I'll ask if this is something that could be added to the completions for Playdate projects in Nova.

I may be misunderstanding how you're using it—let me know and I can try to help further!

1 Like

I'm seeing the same issue when testing out the SDK examples -- it seems like Nova doesn't know about the Playdate / CoreLib files, even though it's able to run the game.

Maybe I'm opening the examples wrong? I'm just telling Nova to open the folder for each specific example directly. In that state, I'm able to build and run the example on the Simulator, but I don't see autocomplete and clicking Jump to Definition does nothing. (Interestingly, breakpoints also don't seem to get hit, but that might be a different issue entirely).

Here's what I think is happening in Nova.

The scope of the project is the folder you've opened—the files shown in the sidebar on the left. Since CoreLibs files aren't part of that, Nova doesn't know to autocomplete something like :blurredImage; it's not mentioned anywhere in this project.

There reason Nova can offer to complete something like Playdate.datastore, I think, is that all those SDK functions are defined in the Nova extension. The app doesn't know them from your project; the extension just has a hardcoded dictionary of all the functions.

Now, to show that Jump to Definition, by itself, works. In main.lua, start typing this:

Note that Nova sees this Class in player.lua—part of the project!—and can offer to complete it. You can then also Cmd-Click the Player class once you've typed it, and Nova will jump to it.

Going back to your original example of :blurredImage. For Nova to offer to complete this, it would have to know two things:

  1. What's an appropriate context to suggest this method. (You don't want it suggesting it on every variable you ever use.) I think this is quite an undertaking, but maybe it's possible.
  2. The parameters of the :blurredImage method. This might be possible.

I'll ask around and find out. In the meantime, I hope the above walk through of (my naive understanding of) Nova's completions helps!

Gotta admit I was also hoping Nova integration to be tighter - specifically in the sense that it’ll let me cmd+click to a function defined in the SDK (Ie, outside my project). The SDK is there, and the play date Nova extension can find it (since it is used to compile my project…) so there has to be a way to show me at least the declaration signature, ideally also with the documentation (what is shown in the “inside plydaye” docs).
The way it is now, besides really cool UI (the whole app is gorgoues), Nova doesn’t have any unique integration with playdate that VSCode/TextMate etc can’t do - which feels a bit like a missed opportunity?
For example - Nova can show a webpage as a side pane - while meant for web dev, it would be super cool if cmd-click a function from the sdk (CoreLibs etc) would show that function in the documentation in the “inside play date” page on the side pane…

3 Likes

Thanks everyone! Yes, the problem is specifically with CoreLibs.

It makes sense that they can’t be reached since they’re not actually in the project, but it’s also a bit annoying as a user since they’re the files I most often need information about (if I wrote player.lua I probably know what’s in it, but I don’t really know what’s in the PlayDate graphics api).

Go to definition might not be what I’m after then, but really just a more intelligent autocomplete and the ability to view function signatures without having to constantly refer to the docs.

Really hope this is possible, I’m enjoying messing around with the SDK a lot otherwise!

To echo @tomkail, being able to view function signatures for the SDK without having to constantly refer to the docs should, in my opinion, be a core functionality of the Playdate extension in Nova. Code completions also don't seem to work for me in the scenarios I would expect them to.

For instance, typing playdate.graphics., I would expect the completions menu to show me the available methods and properties within playdate.graphics. Even pressing ^Space in this instance does nothing. If I start typing something, then the completions menu shows (though it's just the name, no helpful signature). The current functionality seems broken to me.

Perhaps I'm doing something wrong though. I am a novice to Nova and only purchased it recently after implementing a hacky solution for completion and signatures in VS Code that I didn't enjoy and which was annoying to maintain with new SDK versions, and I assumed the Nova extension would have all this baked in.

4 Likes

And this is how it works in Xcode when developing something for Mac or iOS. It knows which SDK and language you're using and offers autocomplete for it along with cmd click to open the definition of things from said SDK.

1 Like