Add syntax highlighting for the 4D language

What does this MR do and why?

This MR adds syntax highlighting for the 4D language, which is used in .4dm files. It also overrides the highlighting languages used for certain 4D project files, according to the extensions in the following table:

Extension Format
.4DCatalog XML
.4DForm JSON
.4DPreferences XML
.4DProject JSON
.4DSettings XML

References

4D Docs on filetypes

Gitlab contributing docs on adding highlighting for a new language

Screenshots or screen recordings

Before After
Screenshot from 2026-09-24 01-49-25.png Screenshot from 2026-09-24 02-19-49.png
Screenshot from 2026-09-24 01-49-38.png Screenshot from 2026-09-24 02-19-15.png
Screenshot from 2026-09-24 23-40-19.png Screenshot from 2026-09-24 23-57-11.png
Screenshot from 2026-09-24 23-40-30.png
Screenshot from 2026-09-24 23-40-51.png
Screenshot from 2026-09-24 23-41-03.png

The .4DCatalog, .4DPreferences, and .4DSettings appeared to be automatically detected and highlighted as XML without these changes, but I added the override just in case and verified they still highlight correctly with the changes.

How to set up and validate locally

Manually upload the following files, and you should see syntax highlighting on each of them.

Test.4dm

//%attributes = {}
#DECLARE()->$result : Object

// Clicked nonexistent row
If (FORM Event.row=Null)
	return Null
End if

var $idx : Integer
$idx:=FORM Event.row-1
$result:=Form.currentSelection.at($idx)

return $result

Test.4DForm

{
	"$4d": {
		"version": "1",
		"kind": "form"
	},
	"windowSizingX": "variable",
	"windowSizingY": "variable",
	"windowMinWidth": 0,
	"windowMinHeight": 0,
	"windowMaxWidth": 32767,
	"windowMaxHeight": 32767,

	"rightMargin": 20,
	"bottomMargin": 20,

	"events": ["onLoad","onPageChange","onValidate","onClick","onDoubleClick","onOutsideCall","onBeginDragOver","onDragOver","onDrop","onAfterKeystroke","onMenuSelect","onPluginArea","onAfterEdit","onTimer","onBoundVariableChange"],

	"windowTitle": "window title",
	"destination": "detailScreen",
	"pages" : [
	{
		"objects":{}
	},
	{
		"objects":{}
	}
	]
}

Test.4DCatalog

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE base SYSTEM "http://www.4d.com/dtd/2007/base.dtd" >
<base name="Hello World" uuid="6B58A062A971440F8169FA0DFB07F0CF" collation_locale="en">
	<schema name="DEFAULT_SCHEMA"/>
	<base_extra>
		<journal_file journal_file_enabled="true"/>
	</base_extra>
</base>

Test.4DPreferences

<?xml version="1.0" encoding="UTF-8"?><preferences stamp="4">
	<com.4d>
		<database>
			<data_storage data_path="Data/data.4DD"/>
		</database>
		<general last_opening_mode="0"/>
	</com.4d>
	<internal_prefs_4d>
		<explorer default_page="4"/>
		<windows>
			<window name="main" left="40" top="156" width="600" height="450"/>
		</windows>
	</internal_prefs_4d>
</preferences>

Test.4DProject

{
	"$comment": "The project file serves as an anchor to locate other project files",
	"compatibilityVersion": 2008
}

Test.4DSettings

<?xml version="1.0" encoding="UTF-8"?><preferences stamp="2">
	<com.4d>
		<general startup_environnement="1"/>
	</com.4d>
</preferences>

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading
Loading