« Display Value List ID… | Home | Adding a Scintilla ba… »

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 either pr1 or better pr2 tomorrow. Let us know if you see issues, problems or it just works for you.

More details here
06 12 21 - 15:09