thiagoralves / OpenPLC_Editor

OpenPLC Editor - IDE capable of creating programs for the OpenPLC Runtime
GNU General Public License v2.0
389 stars 192 forks source link

Addition to handle auto-complete for variables that are instances of structs #4

Closed psychogenic closed 4 years ago

psychogenic commented 4 years ago

This branch includes a small mod that:

  1. makes auto-complete a bit safer (was dying a lot, when no keywords found); and
  2. allows for auto-complete for variables that are instances of structures (including arbitrary nesting), as shown in attached image.

autocompletestruct

psychogenic commented 4 years ago

Also added auto-complete support for indexed array elements, as a second commit on this branch, and shown here. autocomplete_arrays

thiagoralves commented 4 years ago

Thanks for the contribution psychogenic!

psychogenic commented 4 years ago

Hello Thiago, You're very welcome--it's a pleasure to be able to contribute, this project is really awesome. FYI, didn't know you'd be so quick on the merge, just added another commit to allow for auto-complete on array elements indexed by non-numeric values (myarray[idx] rather than just myarray[22]). Let me know if you want me to create a new pull for that.

thiagoralves commented 4 years ago

Please do, and I'll merge it to the main repository. I'm creating an auto updater for the Windows installer that will grab the latest release directly from GitHub, so that Windows users will also benefit more quickly from these updates.

Also, if you have time and is willing to, can you help me solve this little bug on the editor please: https://openplc.discussion.community/post/editor-crashes-when-declaring-data-types-10268556?highlight=bug&pid=1309527104

Let me know... thanks!

On Fri, Sep 20, 2019 at 8:03 AM Pat Deegan notifications@github.com wrote:

Hello Thiago, You're very welcome--it's a pleasure to be able to contribute, this project is really awesome. FYI, didn't know you'd be so quick on the merge, just added another commit to allow for auto-complete on array elements indexed by non-numeric values (myarray[idx] rather than just myarray[22]). Let me know if you want me to create a new pull for that.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/thiagoralves/OpenPLC_Editor/pull/4?email_source=notifications&email_token=AB63XPCIIW2H2QB3P463VNLQKSUYJA5CNFSM4IYU63CKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7GLIQQ#issuecomment-533509186, or mute the thread https://github.com/notifications/unsubscribe-auth/AB63XPF25P7CFRKWTU2APMDQKSUYJANCNFSM4IYU63CA .

psychogenic commented 4 years ago

Ok, will do.

I'll also try and replicate the error and see if I can figure it out.

On one hand, I've declared tons of data types (structs and enums) without issue. On the other, I got very tired of all this clicking, very rapidly... I wished there was a way just to import ST but, seeing as plc.xml is canonical, I created some quick shell scripts to allow me to inject useful data into the XML file (like global vars, function blocks with standard custom attributes, etc) so haven't been using the UI so much.

Anyhow, will try it out (note I'm under Linux, this may change the situation).

thiagoralves commented 4 years ago

The crash happens on Linux as well, even on Beremiz. I created a bug report on the Beremiz bitbucket about it as well. Here you can find the exact steps to reproduce it: https://bitbucket.org/automforge/beremiz/issues/86/crash-when-declared-a-data-types

Having a function to import an ST-code of a function block is something in my roadmap. There are many users contributing with new function blocks ( https://openplc.discussion.community/?forum=751065) and I wanted an easier way to just import everything without having to copy/paste things from one project to another.

On Fri, Sep 20, 2019 at 8:22 AM Pat Deegan notifications@github.com wrote:

Ok, will do.

I'll also try and replicate the error and see if I can figure it out.

On one hand, I've declared tons of data types (structs and enums) without issue. On the other, I got very tired of all this clicking, very rapidly... I wished there was a way just to import ST but, seeing as plc.xml is canonical, I created some quick shell scripts to allow me to inject useful data into the XML file (like global vars, function blocks with standard custom attributes, etc) so haven't been using the UI so much.

Anyhow, will try it out (note I'm under Linux, this may change the situation).

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/thiagoralves/OpenPLC_Editor/pull/4?email_source=notifications&email_token=AB63XPER6HHCIAEI4IE6F23QKSW7BA5CNFSM4IYU63CKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7GMPAI#issuecomment-533514113, or mute the thread https://github.com/notifications/unsubscribe-auth/AB63XPGV3TCZA2ID55ZXN3LQKSW7BANCNFSM4IYU63CA .