TheDuriel / MagicMacros

Godot Addon for enhanced autocomplete and code snippets
MIT License
53 stars 4 forks source link

Changes #9

Closed Taksharya333 closed 6 days ago

Taksharya333 commented 1 week ago

Fixed:

  1. Macros now working with floating window.
  2. Dictionary of input_Catcher is now removed and won't fill up with extra useless references
  3. The autocomplete now don't persist after pressing tab and loading macro.

Changes made:

  1. Removed the section which looks for windows after 5 second interval and implemented some of the other logics in the issues tab.
  2. input_catcher references individual windows which I didn't know the use of, so removed the windows syncing instead linked the script editor directly now it won't look for new windows anymore. Since the embedded window and floating window references the same script editor. Linked the macro with the scripteditor but if there was any need to link windows then this update won't be preferrable. However, since the macros should only exist while editing the scripts. I didn't find any need for such.
TheDuriel commented 1 week ago

Oh neat.

I had fixed multi window support yesterday, but this might be better.

One of the main reasons for the input catchers weird way of operating is because we need to intercept the input before it reaches the script editor. Otherwise the script editor will still insert the tab character and delete the macro contents, or wore.

I'll have a look at this in a bit!

Taksharya333 commented 6 days ago

By input_catcher I meant the dictionary I removed the use for the dictionary but I am still using the input_catcher class and its instance to catch the input before the editor and I think I also solved the problem where the plugin was not working sometimes by adding a delay in ready. All times I have opened my project now, it works without any problem. I've also implemented some of the changes recommended on the other pull and the issues.

TheDuriel commented 6 days ago

script_changed was meant to be editor_script_changed, thanks for catching that.

I'm a bit confused though as to the changes to the input catcher. Does this still work with the editor popped out? And without inserting stray tab characters?

Taksharya333 commented 6 days ago

Yes, it does work. The only difference I made was the input_catcher from being added as the child of window. Now its a child of the script editor and since there is only one instance of script editor itself. detecting window is not needed and the catcher moves with the script editor. I have tried it on both embedded editor and on floating window and it seems to work and as for stray tabs the input_catcher instance already handles that.

Taksharya333 commented 6 days ago

This is on floating window: the line Highlighting: image Macro Loading: image Stray tabs: image Same results are on the embedded window

TheDuriel commented 6 days ago

Stray tabs: Same results are on the embedded window

There are not currently any tab characters inserted by the plugin. Just double checking that that is what you mean. When the user presses tab to confirm the insertion of a macro, only the macro is inserted, and the cursor returns to the start of the line.

Taksharya333 commented 6 days ago

Ah that, I misunderstood. Yes when the user presses tab no extra tab is inserted and the cursor return to the start of that line.

TheDuriel commented 6 days ago

Awesome! I left some review comments, but apart from those I think this can ultimately be merged with some minor cleanup from my side. (Removing old comments, and I should probably document this :D)

Taksharya333 commented 6 days ago

I also faced another problem which I am thinking of solving, currently you're only accounting for 3 arguments which are identifier, type and value, but I am looking for a way to add more than three argument. Because I want to pass 4 argument in my tween macro. Relating to node, property, final_value, time. I wonder if its be good to commit it here as its a personal requirement and might not be needed by all the users. I will account for that by using array and keep the values as elements. So it can contain as many elements as can be put but only uses the ones it needs.

TheDuriel commented 6 days ago

I also faced another problem which I am thinking of solving...

Something like:

tw [all the args in order] may work?

However I think that's basically just as much effort as typing it out normally, and without any code completion.

A tween macro may actually just produce an output like this:

image

How about making an issue for a tween macro to discuss a course of action there?

Taksharya333 commented 6 days ago

Ah sorry, I didn't check the LineData properly, You're already filling the remaining letters in the remainder_args however weren't using it directly. I can use it directly to make do what I want. I'll quickly make the tween and show you what I want.

TheDuriel commented 6 days ago

Gonna merge this, then make a commit with some personal fixes right after!

TheDuriel commented 6 days ago

Thanks a bunch!