Rick Brewster

CodeLab v6.0 (for advanced users) Released June 25, 2020

Recommended Posts

Suggested Names will perform a bit differently for Types that implement IEnumerable<T>.

The suggestions will be based on T, and will be plural.  This is how Visual Studio does it.

 

IEnumerable1.png

 

 

IEnumerable2.png

 

 

IEnumerable3.png

Share this post


Link to post
Share on other sites

CodeLab 5.4 Released

This is only for Paint.NET 4.2.11+!

 

Small (but important) update today...

 

Changes:
▪ Improved suggested variable names (toe_head2001)

▪ Improvemens in Autocomplete and Intellisense (toe_head2001)

▪ Generate Type Definitions on F12. You can now see definitions inside of libraries. (toe_head2001)

▪ Remember scroll positions (and other things) when switching tabs (toe_head2001)

▪ Rewrite File New Template for up to 2 Scratch Surfaces, also bug fixes and better code (BoltBait)

 


Grab the CodeLab DLL here:

 

https://www.boltbait.com/pdn/CodeLab/

 

 

File New Template Improvements:

 

When I completely rewrote the File New Templates in CodeLab 5.0, I was under the assumption that it was OK to use the DST surface as a scratch surface during the calculation of your final results.  This is OK under some very narrow circumstances, but generally this should be avoided.  (This could cause your effects to have different results when previewing your effect and when clicking OK to finalize your image.)  In this release, I have removed this capability and replaced it with a second scratch surface called AUX.  So, now you have access to the source surface (SRC) which is your layer before any changes are made, a working surface (WRK) to use as a scratch surface if necessary, a second working surface (AUX) to use if necessary, and of course the destination surface (DST) where you store your final calculated pixels.

 

NewComplexUI.png

 

In previous versions, the blend modes had the top and bottom layers swapped--that's fixed in this build.  The code generated should also be easier to understand.

 

(This is the last update before toe_head2001 rewrites the entire compiler section.)

  • Like 1
  • Upvote 3

Share this post


Link to post
Share on other sites

CodeLab 5.4 in Russian

 

You can find the new version of CodeLab in Russian here.

Вы можете найти новую версию CodeLab на русском языке здесь.

  • Upvote 1

Share this post


Link to post
Share on other sites

Here's a screenshot showing Type Definitions:

 

CodeLab-Surface-Def.png

 

 

You can still look up Definitions on docs.microsoft.com, but you'll have to open the context menu:

 

CodeLab-Look-Up-Def.png

  • Upvote 1

Share this post


Link to post
Share on other sites

Is there any way to make autocomplete less aggressive? It's driving me crazy. I try to type "x = ", and it changes "x" to "BinaryPixelOp" (?) when I press the space bar (even though "x" is a defined, in-scope variable at the time). The only way I can find to prevent it is to left click the mouse after every variable I type. I'd far rather have no autocomplete at all than too much.

Share this post


Link to post
Share on other sites
21 minutes ago, MJW said:

... I try to type "x = ", and it changes "x" to ...

 

There does appear to be a bug here. I'll investigate.

 

22 minutes ago, MJW said:

The only way I can find to prevent it is to left click the mouse after every variable I type.

 

You can also press the Esc key.

Share this post


Link to post
Share on other sites
24 minutes ago, MJW said:

Is there any way to make autocomplete less aggressive? It's driving me crazy. I try to type "x = ", and it changes "x" to "BinaryPixelOp" (?) when I press the space bar (even though "x" is a defined, in-scope variable at the time). The only way I can find to prevent it is to left click the mouse after every variable I type. I'd far rather have no autocomplete at all than too much.

 

I can not get this to fail as you describe. Can you show me the script you're editing and where your cursor is when you type "x ="?

Share this post


Link to post
Share on other sites

I wish it worked the other way around: press Esc or something very specific like that to do the autocomplete, otherwise, skip it. Most of the time, I'd rather just type stuff in myself. (And I'm not even a good typist.)

Share this post


Link to post
Share on other sites
void XYCoords(int ix, int iy, out double x, out double y)
{
    x = (double)ix; y = (double)iy;
    x = zoomScale * (x - centerX);
    y = zoomScale * (y - centerY);
}

 When I got to the point of typing "x =".

 

But that's just one of many times autocomplete inserted something I didn't want.

Share this post


Link to post
Share on other sites

That reproduces for me.  Looks like the parameters of the function are not being parsed properly.

Share this post


Link to post
Share on other sites

Yeah, the auto complete box just needs to prioritize exact matches. Should be easy to fix.

 

5 minutes ago, MJW said:

I wish it worked the other way around

 

We are doing the "standard" way. I don't know of any editor that does it the inverse way.

Share this post


Link to post
Share on other sites
1 minute ago, toe_head2001 said:

Yeah, the auto complete box just needs to prioritize exact matches. Should be easy to fix.

 

It may be more complicated than that.  When I entered his example, the autocomplete box didn't list "x" in it.

Share this post


Link to post
Share on other sites
1 minute ago, BoltBait said:

When I entered his example, the autocomplete box didn't list "x" in it.

 

Did you resolve the build errors before trying?

Method parameters are "parsed" through Reflection of the built effect. So, if there are build errors, those parameters won't get parsed.

Share this post


Link to post
Share on other sites

There was a build error.  It was that the out parameter "x" must be set before returning.

 

Paradox.

Share this post


Link to post
Share on other sites

I think prioritizing the exact match would greatly improve it. However, as BoltBait just mentioned, currently the list doesn't always include the actual thing. Another example of this is that I have a class-level variable called c2. When I type it, the only autocomplete selection is some "Func2" thing.

Share this post


Link to post
Share on other sites
3 minutes ago, MJW said:

When I type it, the only autocomplete selection is some "Funct2" thing.

 

Were you typing in the class-level or within a Method body? That does make an intentional difference.

Share this post


Link to post
Share on other sites

Outside any method, to make it "global." A variable set in PreRender() to be used in Render().

Share this post


Link to post
Share on other sites

I may have misinterpreted your question. c2 is defined outside any method, but the faulty autocompletion occurred when I typed it within PreRender().

Share this post


Link to post
Share on other sites

image.png

 

This can happen if the code hasn't compiled yet.  Just press the compile button (F6) after defining the variable.

Share this post


Link to post
Share on other sites

User-Defined types and type members are also parsed via Reflection.

Make sure the code was successfully compiled at least once before you try to get an AutoComplete for a field.

 

(The build can fail afterwards, since a build failure won't clear out the previously set AutoComplete items.)

Share this post


Link to post
Share on other sites
6 minutes ago, BoltBait said:

This can happen if the code hasn't compiled yet

 

How can I compile code that's incomplete and therefore has a number of syntax errors?

Share this post


Link to post
Share on other sites

I wish there were a switch to disable autocomplete. Unless it really behaves itself, it's far more of a hindrance than a help for me.

Share this post


Link to post
Share on other sites
6 minutes ago, MJW said:

 

How can I compile code that's incomplete and therefore has a number of syntax errors?

 

Well, in the second example, of adding "int c2;" you can build.

 

In the case of adding a function:

 

void XYCoords(int ix, int iy, out double x, out double y)
{
    x = (double)ix; y = (double)iy;
    x = zoomScale * (x - centerX);
    y = zoomScale * (y - centerY);
}

 

There's not much that you can do about it except don't type "out" both times, compile, then put them in.

 

Type it in like this:

 

void XYCoords(int ix, int iy, double x, double y)
{
    
}

Build, then type "out" before both out variables.  It works then.

 

Pain in the butt, I know.

 

As I said in a previous post, this situation is a paradox for CodeLab and I'm not sure we could correct something like that.

Share this post


Link to post
Share on other sites

XYCoords() is just one function among many that might not compile. If autocomplete doesn't work properly until the code is complied, perhaps it should be disabled until then.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.