Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

GMEdit

A high-end code editor for all things GameMaker · By YellowAfterlife

[Request] Outline View - static method variables

A topic by eL-Falso created Dec 07, 2020 Views: 223 Replies: 9
Viewing posts 1 to 4

First of all I want to thank you for this great editor \o/

But something I miss in the Outline View is that currently only the overall constructor is shown in this view, without a list of the static method variables.

So what do you think about implementing this into the outline view? I think it would be a nice way to quickly jump to these ones especially when you have large constructors with many static method variables.

Developer

Added that, along with some other tweaks and options - will be live in the next update but you can also grab the JS file for outline-view from

https://github.com/GameMakerDiscord/GMEdit/blob/master/bin/resources/app/plugins/outline-view/outline-view.js

and replace yours (at /resources/app/plugins/outline-view/outline-view.js) with a new one.

(2 edits)

Thank you so much <3 It works great :-)

But still, I don't know what this underlining is about, it has always a weird behavior. Normally the method variable above the selected one is underlined, but sometimes like in this example: I selected "mirror(_normal)" but "negate(_vector)" is underlined.

So what is it about? Is it maybe just a minor bug?


Developer (1 edit)

Underline and a highlight indicate where your text cursor is, going upwards to the nearest declaration.

If that is not the case, I’ll need a screenshot of full window and a script that reproduces the behaviour.

I could reproduce the bug, just wrote a sample script. It's because of how JSDoc comments are handled.

This works, bug not present: cursor is before foo1 of static foo1 = function() {

This doesn't work, bug present: cursor is before foo1 of /// @func foo1()

Conclusion: When you use the real name of the static method variable in the JSDoc comment func the bug is present.

Developer

I think it’s kind of a stretch to say that it is a bug that outline view considers you to not be in the function when you are clearly not in the function, but sure, whatever - updated the file again.

(2 edits)

I'm sorry, I think we had talked past each other. I think you where talking about placing the text cursor somewhere in the code by yourself. But I where talking about how the outline view places the cursor in your code after selecting the function.

So you mean the outline view has two different functions where to place the cursor?

  • Case 1: JSDoc present: cursor is placed in the JSDoc comment func
  • Case 2: JSDoc not present: cursor is placed at the static method variable definition

Then all this makes sense now! Also this underline works now. In the second picture which I posted, foo1() is now underlined instead to foo().

Thank you for the work!

Developer

Okay, so that’s a different thing - when navigating to a sub-region, GMEdit searches for the first mention of that name after the parent (in this case, function Test), and adding /// @func name also does make for a mention of the name, so it goes there instead. I’ll need to implement a slightly more complex solution for this.

On a side note, neither GMEdit nor GMS2.3 currently give any meaning to /// @func inside constructors. GMEdit will automatically pick up named arguments from functions static foo = function(a, b) for contextual completion, so sticking to that may suffice.

Thank you for the clarification and also for the one with /// @func inside constructors with GMS2.3, I didn't know that. But still, I need it for the automatic generation of the documentation for the project I'm working on.

Developer

Upon some testing I regret to inform that in GMS2.3 IDE /// @func has no “context”, meaning that redefining the same function in different constructors will have them fight over what which version will be shown in auto-completion. @param may be more conventional for purposes of documentation generator.