[MERGED] PR #8228 - Completion fixes until 3062 is merged

Post here if you have re-based and finalised code to integrate into master, which was discussed, agreed to and tested in other forums. You can also submit your PR directly on github.
Post Reply
acpopescu
Posts: 15
Joined: Thu Jan 19, 2023 11:49 pm
Contact:

[MERGED] PR #8228 - Completion fixes until 3062 is merged

Post by acpopescu »

Hi!

I've done a couple of fixes for the ExpressionCompleter, adding support for paths in the property. - https://forum.freecadweb.org/viewtopic.php?f=10&t=75407.

Video: https://youtu.be/y-3bDFy8Pgc
Pull request is here: https://github.com/FreeCAD/FreeCAD/pull/8228/

When PR #3062 (https://github.com/FreeCAD/FreeCAD/pull/3062) comes in, it can overwrite these changes as it is better and has more functionality.

PR #8228 is not perfect, as it cannot complete sub-path components, and has other limitations.
  • "Sketch.Placement." will propose "Base.x", "Base.y",... "Rotation.Angle", "Rotation.Axis.x"
  • "Sketch.Placement.Rotation.A" will fail to complete as the path split "Sketch/Placement/Rotation/A" is not in the completion tree, only
    Sketch/Placement/Rotation.Axis.x is
  • I don't believe arrays will work, if there isn't a named structure in place the completer will not have that int he completion tree: "Object.Prop[10].Something" will not work, as "Prop[10]" is not in the tree.

Tested:
  • Constraints formula line edit
  • Spreadsheet
  • x64 Windows Debug & Release builds
Last edited by acpopescu on Tue Jan 24, 2023 10:11 pm, edited 1 time in total.
acpopescu
Posts: 15
Joined: Thu Jan 19, 2023 11:49 pm
Contact:

Re: PR #8228 - Completion fixes until 3062 is merged

Post by acpopescu »

This was just merged in.

There is still an issue with contextual completions:

If you're in a sketch and try to complete "Constraints.", but there is already a Document or an Object called "Constraints", the completer will think you're referring to that one. Adding the full sketch name will not work, as the path will be collapsed upon completion to the contextual one.

Assembly 4 Model has a "Constraints" object :(
adrianinsaval
Veteran
Posts: 4377
Joined: Thu Apr 05, 2018 5:15 pm

Re: [MERGED] PR #8228 - Completion fixes until 3062 is merged

Post by adrianinsaval »

interesting problem... if you manually finish writing the expression what happens? How do you choose which one to actually reference?
acpopescu
Posts: 15
Joined: Thu Jan 19, 2023 11:49 pm
Contact:

Re: [MERGED] PR #8228 - Completion fixes until 3062 is merged

Post by acpopescu »

You need to ignore the completion suggestion, and it will work.

The pending pr https://github.com/FreeCAD/FreeCAD/pull/3062 has a fix for this, the main thing - adding a LOCAL access syntax, with a leading '.'
to unambiguously specify a property.
adrianinsaval
Veteran
Posts: 4377
Joined: Thu Apr 05, 2018 5:15 pm

Re: [MERGED] PR #8228 - Completion fixes until 3062 is merged

Post by adrianinsaval »

and if you want to reference the object named Constraints rather than the local propery?
Post Reply