Variable Name Auto Completion

For a couple of years we do various things in FileMaker Script Workspace like syntax coloring. We got a copy command once we started to read all lines in a script. Later we added checks to find usage of undeclared variables, so you easier spot typos in your variable names. Now we go one step further: We scan for variables and present you a list of names we know.

When you have a script open in the Script Workspace and you open a calculation dialog, you can now auto complete. Just go into a calculation dialog for a Set Variable or Set Field or any of the other script steps taking a calculation. Then type something. We have a switch there, so only when you type a $ symbol, our plugin activates. Otherwise it lets the request pass to FileMaker to auto complete field and function names.

To find the variable names, we scan the script from the current selected line for currently up to 500 lines upwards. The limit can be adjusted with SyntaxColoring.CheckVariableDeclaration.SetLimits function if needed. We hope that is for now enough to find the common variable names you like to use. If you keep working in one script workspace, we retain global variable names, we see, so you may see them in auto complete for multiple scripts.

Like with the variable check, we support declaring variables in comment lines. That is a kind of workaround for the plugin not seeing into global variables list from FileMaker or parsing Let statements. You can define comments with a prefix @variable, @parameter or @constant or actually shorter with @var, @param and @const if you prefer. The plugin will notice them and use them for variable name checking as well as auto complete. If you use common global variables in the script, you may just declare them on the top as a comment:

# This script uses the following global variables, initialized in our start script:
# @variable $$UserName
# @variable $$WebServiceAuth

This feature was developed on the weekend of 27th/28th November 2021 and a bit tuned in the following week. We also got a command for the context menu to copy the list of variables defined in a script. Please try it soon with MBS FileMaker Plugin, version 11.6pr2 Let us know if you see issues, problems or it just works for you.

8 Likes

Anything that makes the FileMaker dialog-based script UI more IDE like is welcomed! :slight_smile:

3 Likes

@MonkeybreadSoftware, I really do appreciate all you do to make our lives easier, so I almost feel guilty asking if you are planning on adding Let function declarations as acceptable variable definitions to this feature?

As of today we have no parser for the Let statements and the plugin may not see the full line.
So please use the chance with the comments to tell the plugin about variables.

Thanks, Christian. I'll try that.