Page 1 of 1

fh_Lua syntax highlighting in Notepad++

Posted: 01 Jul 2014 10:30
by DavidNewton
This is for people who use, or might use, Notepad++ as a text editor for Lua (or GEDCOM or any other of the big list of supported languages.)
Lua is one of the supported languages for syntax highlighting, folding, automatic indentation etc. But standard Lua does not include FH keywords and so there is no syntax highlighting for FH specific keywords.

It should be possible to write a Notepad++ language file for fh_Lua but I'm not capable of that. I am, however, capable of adding the FH keywords into the Notepad++ style configurator.

To do that in Notepad++ goto Settings>Style Configurator and in the dialog select Language>Lua. This then produces a list in the second column, under Style, of the elements which can be configured with font including colours, etc. There are 4 entries which can have user defined keyword additions: INSTRUCTION WORD, FUNC1, FUNC2, FUNC3. I choose to put all the object methods in FUNC2 and the API functions in FUNC3 but free choice! You do however need the lists of keywords. Note that to be used they must be in a single string with single space separators.

The API function list

Code: Select all

fhNewDate fhNewDatePt fhNewItemPtr fhPromptUserForDate fhPromptUserForRecordSel fhMessageBox fhUpdateDisplay fhOutputResultSetColumn fhOutputResultSetTitles fhCallBuiltInFunction fhGetCurrentRecordSel fhGetAppVersion fhGetContextInfo fhGetDataClass fhGetDisplayText fhGetFactTag fhGetFlagTag fhGetGedcomInfo fhGetItemPtr fhGetItemText fhGetLabelledText fhGetPluginDataFileName fhGetRecordId fhGetRecordTypeCount fhGetRecordTypeTag fhGetTag fhGetValueAsBlob fhGetValueAsDate fhGetValueAsInteger fhGetValueAsLink fhGetValueAsText fhGetValueType fhCreateItem fhDeleteItem fhMoveItemAfter fhMoveItemBefore fhSetLabelledText fhSetValue_Copy fhSetValueAsDate fhSetValueAsInteger fhSetValueAsLink fhSetValueAsText fhSetValueAsBlob fhHasChildItem fhHasNextSibItem fhHasParentItem fhHasPrevSibItem fhIsAttribute fhIsEvent fhIsFact fhIsHidden fhIsUdf fhIsValidDataRef fhInitialise fhOverridePreference fhSleep fhShellExecute
The object methods list

Code: Select all

Clone Compare Copy GetDatePt1 GetDatePt2 GetDisplayText GetPhrase GetSubtype GetType GetValueAsText IsNull SetDatePhrase SetNull SetPeriod SetRange SetSimpleDate SetValueAsText GetBC GetCalendar GetDay GetMonth GetYear GetYearDD SetValue IsNotNull IsSame MoveNext MoveNextSpecial MovePrev MoveTo MoveToFirstChildItem MoveToFirstRecord MoveToParentItem MoveToRecordById MoveToRecordItem
Note that Notepad++ is not a development environment for fh_Lua but when examining code it is useful to be able to collapse sections of code and see your keywords in colour giving a quick check for spelling or case errors.

David