Page 1 of 1

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

Posted: Sun Jan 22, 2023 1:48 pm
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

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

Posted: Tue Jan 24, 2023 10:11 pm
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 :(

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

Posted: Wed Jan 25, 2023 11:50 am
by adrianinsaval
interesting problem... if you manually finish writing the expression what happens? How do you choose which one to actually reference?

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

Posted: Sun Jan 29, 2023 2:38 am
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.

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

Posted: Mon Jan 30, 2023 1:50 pm
by adrianinsaval
and if you want to reference the object named Constraints rather than the local propery?