From: Bogdan Barbu Date: Thu, 6 Aug 2026 20:16:23 +0000 (+0000) Subject: patch 9.2.0920: filetype: json-ld files are not recognized X-Git-Tag: v9.2.0920^0 X-Git-Url: http://git.ipfire.org/index.cgi?a=commitdiff_plain;p=thirdparty%2Fvim.git patch 9.2.0920: filetype: json-ld files are not recognized Problem: filetype: json-ld files are not recognized Solution: Detect *.jsonld files as jsonld filetype, include filetype, indent and syntax plugins (Bogdan Barbu). Reference: https://www.w3.org/TR/json-ld11/ closes: #20954 Signed-off-by: Bogdan Barbu Signed-off-by: Christian Brabandt --- diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim index 398e2ae26b..6a20675f0c 100644 --- a/runtime/autoload/dist/ft.vim +++ b/runtime/autoload/dist/ft.vim @@ -3,7 +3,7 @@ vim9script # Vim functions for file type detection # # Maintainer: The Vim Project -# Last Change: 2026 Jul 30 +# Last Change: 2026 Aug 06 # Former Maintainer: Bram Moolenaar # These functions are moved here from runtime/filetype.vim to make startup @@ -2326,6 +2326,8 @@ const ft_from_ext = { "webmanifest": "json", # JSON Lines "jsonl": "jsonl", + # JSON-LD + "jsonld": "jsonld", # Jsonnet "jsonnet": "jsonnet", "libsonnet": "jsonnet", diff --git a/runtime/ftplugin/jsonld.vim b/runtime/ftplugin/jsonld.vim new file mode 100644 index 0000000000..bb4dde21c2 --- /dev/null +++ b/runtime/ftplugin/jsonld.vim @@ -0,0 +1,10 @@ +" Vim filetype plugin +" Language: JSON-LD +" Maintainer: The Vim Project +" Last Change: 2026 Aug 06 + +if exists('b:did_ftplugin') + finish +endif + +runtime! ftplugin/json.vim diff --git a/runtime/indent/jsonld.vim b/runtime/indent/jsonld.vim new file mode 100644 index 0000000000..96b9b06146 --- /dev/null +++ b/runtime/indent/jsonld.vim @@ -0,0 +1,6 @@ +" Vim indent file +" Language: JSON-LD +" Maintainer: The Vim Project +" Last Change: 2026 Aug 06 + +runtime! indent/json.vim diff --git a/runtime/makemenu.vim b/runtime/makemenu.vim index 7ebf595063..98d88e6223 100644 --- a/runtime/makemenu.vim +++ b/runtime/makemenu.vim @@ -2,7 +2,7 @@ vim9script # Script to define the syntax menu in synmenu.vim # Maintainer: The Vim Project -# Last Change: 2026 Aug 03 +# Last Change: 2026 Aug 06 # Former Maintainer: Bram Moolenaar # This is used by "make menu" in the src directory. @@ -384,6 +384,7 @@ SynMenu HIJK.JJdescription:jjdescription SynMenu HIJK.Jovial:jovial SynMenu HIJK.JQ:jq SynMenu HIJK.JSON.JSON:json +SynMenu HIJK.JSON.JSON-LD:jsonld SynMenu HIJK.JSON.JSON5:json5 SynMenu HIJK.JSON.JSONC:jsonc SynMenu HIJK.Julia:julia diff --git a/runtime/synmenu.vim b/runtime/synmenu.vim index b744857ec3..b2259b930e 100644 --- a/runtime/synmenu.vim +++ b/runtime/synmenu.vim @@ -2,7 +2,7 @@ " This file is normally sourced from menu.vim. " " Maintainer: The Vim Project -" Last Change: 2025 Mar 09 +" Last Change: 2026 Aug 06 " Former Maintainer: Bram Moolenaar " Define the SetSyn function, used for the Syntax menu entries. @@ -365,20 +365,21 @@ an 50.50.780 &Syntax.HIJK.JJdescription :cal SetSyn("jjdescription") an 50.50.790 &Syntax.HIJK.Jovial :cal SetSyn("jovial") an 50.50.800 &Syntax.HIJK.JQ :cal SetSyn("jq") an 50.50.810 &Syntax.HIJK.JSON.JSON :cal SetSyn("json") -an 50.50.820 &Syntax.HIJK.JSON.JSON5 :cal SetSyn("json5") -an 50.50.830 &Syntax.HIJK.JSON.JSONC :cal SetSyn("jsonc") -an 50.50.840 &Syntax.HIJK.Julia :cal SetSyn("julia") -an 50.50.850 &Syntax.HIJK.Just :cal SetSyn("just") -an 50.50.870 &Syntax.HIJK.Karel :cal SetSyn("karel") -an 50.50.880 &Syntax.HIJK.Kconfig :cal SetSyn("kconfig") -an 50.50.890 &Syntax.HIJK.KDE\ script :cal SetSyn("kscript") -an 50.50.900 &Syntax.HIJK.Kdl :cal SetSyn("kdl") -an 50.50.910 &Syntax.HIJK.Kimwitu++ :cal SetSyn("kwt") -an 50.50.920 &Syntax.HIJK.Kitty :cal SetSyn("kitty") -an 50.50.930 &Syntax.HIJK.Kivy :cal SetSyn("kivy") -an 50.50.940 &Syntax.HIJK.KixTart :cal SetSyn("kix") -an 50.50.950 &Syntax.HIJK.Kotlin :cal SetSyn("kotlin") -an 50.50.960 &Syntax.HIJK.Krl :cal SetSyn("krl") +an 50.50.820 &Syntax.HIJK.JSON.JSON-LD :cal SetSyn("jsonld") +an 50.50.830 &Syntax.HIJK.JSON.JSON5 :cal SetSyn("json5") +an 50.50.840 &Syntax.HIJK.JSON.JSONC :cal SetSyn("jsonc") +an 50.50.850 &Syntax.HIJK.Julia :cal SetSyn("julia") +an 50.50.860 &Syntax.HIJK.Just :cal SetSyn("just") +an 50.50.880 &Syntax.HIJK.Karel :cal SetSyn("karel") +an 50.50.890 &Syntax.HIJK.Kconfig :cal SetSyn("kconfig") +an 50.50.900 &Syntax.HIJK.KDE\ script :cal SetSyn("kscript") +an 50.50.910 &Syntax.HIJK.Kdl :cal SetSyn("kdl") +an 50.50.920 &Syntax.HIJK.Kimwitu++ :cal SetSyn("kwt") +an 50.50.930 &Syntax.HIJK.Kitty :cal SetSyn("kitty") +an 50.50.940 &Syntax.HIJK.Kivy :cal SetSyn("kivy") +an 50.50.950 &Syntax.HIJK.KixTart :cal SetSyn("kix") +an 50.50.960 &Syntax.HIJK.Kotlin :cal SetSyn("kotlin") +an 50.50.970 &Syntax.HIJK.Krl :cal SetSyn("krl") an 50.60.100 &Syntax.L.Lace :cal SetSyn("lace") an 50.60.110 &Syntax.L.LambdaProlog :cal SetSyn("lprolog") an 50.60.120 &Syntax.L.Latte :cal SetSyn("latte") diff --git a/runtime/syntax/jsonld.vim b/runtime/syntax/jsonld.vim new file mode 100644 index 0000000000..3b933b0ec2 --- /dev/null +++ b/runtime/syntax/jsonld.vim @@ -0,0 +1,31 @@ +" Vim syntax file +" Language: JSON-LD +" Maintainer: The Vim Project +" Last Change: 2026 Aug 06 +" Reference: https://www.w3.org/TR/json-ld11/ + +if !exists('main_syntax') + if exists('b:current_syntax') + finish + endif + let main_syntax = 'jsonld' +endif + +runtime! syntax/json.vim +unlet! b:current_syntax + +" Match reserved keywords only when they occupy a complete JSON string. The +" negative lookbehind excludes an escaped quote inside a longer string. +syn match jsonldKeyword /\C\%(\\"\)\@{+0#e000e06#ffffff0| +0#0000000&@73 +@2|"|k+0#af5f00255&|e|y|w|o|r|d|s|A|s|K|e|y|s|"+0#0000000&|:| |{+0#e000e06&| +0#0000000&@53 +@4|"|@+0#e000e06&|b|a|s|e|"+0#0000000&|:| |n+0#00e0e07&|u|l@1|,+0#0000000&| |"|@+0#e000e06&|c|o|n|t|a|i|n|e|r|"+0#0000000&|:| |n+0#00e0e07&|u|l@1|,+0#0000000&| @36 +@4|"|@+0#e000e06&|c|o|n|t|e|x|t|"+0#0000000&|:| |n+0#00e0e07&|u|l@1|,+0#0000000&| |"|@+0#e000e06&|d|i|r|e|c|t|i|o|n|"+0#0000000&|:| |n+0#00e0e07&|u|l@1|,+0#0000000&| @33 +@4|"|@+0#e000e06&|g|r|a|p|h|"+0#0000000&|:| |n+0#00e0e07&|u|l@1|,+0#0000000&| |"|@+0#e000e06&|i|d|"+0#0000000&|:| |n+0#00e0e07&|u|l@1|,+0#0000000&| @42 +@4|"|@+0#e000e06&|i|m|p|o|r|t|"+0#0000000&|:| |n+0#00e0e07&|u|l@1|,+0#0000000&| |"|@+0#e000e06&|i|n|c|l|u|d|e|d|"+0#0000000&|:| |n+0#00e0e07&|u|l@1|,+0#0000000&| @35 +@4|"|@+0#e000e06&|i|n|d|e|x|"+0#0000000&|:| |n+0#00e0e07&|u|l@1|,+0#0000000&| |"|@+0#e000e06&|j|s|o|n|"+0#0000000&|:| |n+0#00e0e07&|u|l@1|,+0#0000000&| @40 +@4|"|@+0#e000e06&|l|a|n|g|u|a|g|e|"+0#0000000&|:| |n+0#00e0e07&|u|l@1|,+0#0000000&| |"|@+0#e000e06&|l|i|s|t|"+0#0000000&|:| |n+0#00e0e07&|u|l@1|,+0#0000000&| @37 +@4|"|@+0#e000e06&|n|e|s|t|"+0#0000000&|:| |n+0#00e0e07&|u|l@1|,+0#0000000&| |"|@+0#e000e06&|n|o|n|e|"+0#0000000&|:| |n+0#00e0e07&|u|l@1|,+0#0000000&| @41 +@4|"|@+0#e000e06&|p|r|e|f|i|x|"+0#0000000&|:| |n+0#00e0e07&|u|l@1|,+0#0000000&| |"|@+0#e000e06&|p|r|o|p|a|g|a|t|e|"+0#0000000&|:| |n+0#00e0e07&|u|l@1|,+0#0000000&| @34 +@4|"|@+0#e000e06&|p|r|o|t|e|c|t|e|d|"+0#0000000&|:| |n+0#00e0e07&|u|l@1|,+0#0000000&| |"|@+0#e000e06&|r|e|v|e|r|s|e|"+0#0000000&|:| |n+0#00e0e07&|u|l@1|,+0#0000000&| @33 +@4|"|@+0#e000e06&|s|e|t|"+0#0000000&|:| |n+0#00e0e07&|u|l@1|,+0#0000000&| |"|@+0#e000e06&|t|y|p|e|"+0#0000000&|:| |n+0#00e0e07&|u|l@1|,+0#0000000&| @42 +@4|"|@+0#e000e06&|v|a|l|u|e|"+0#0000000&|:| |n+0#00e0e07&|u|l@1|,+0#0000000&| |"|@+0#e000e06&|v|e|r|s|i|o|n|"+0#0000000&|:| |n+0#00e0e07&|u|l@1|,+0#0000000&| @37 +@4|"|@+0#e000e06&|v|o|c|a|b|"+0#0000000&|:| |n+0#00e0e07&|u|l@1| +0#0000000&@56 +@2|}+0#e000e06&|,+0#0000000&| @70 +@2|"|k+0#af5f00255&|e|y|w|o|r|d|s|A|s|V|a|l|u|e|s|"+0#0000000&|:| |[+0#e000e06&| +0#0000000&@51 +@4|"|@+0#e000e06&|b|a|s|e|"+0#0000000&|,| |"|@+0#e000e06&|c|o|n|t|a|i|n|e|r|"+0#0000000&|,| |"|@+0#e000e06&|c|o|n|t|e|x|t|"+0#0000000&|,| |"|@+0#e000e06&|d|i|r|e|c|t|i|o|n|"+0#0000000&|,| @22 +@4|"|@+0#e000e06&|g|r|a|p|h|"+0#0000000&|,| |"|@+0#e000e06&|i|d|"+0#0000000&|,| |"|@+0#e000e06&|i|m|p|o|r|t|"+0#0000000&|,| |"|@+0#e000e06&|i|n|c|l|u|d|e|d|"+0#0000000&|,| @30 +@4|"|@+0#e000e06&|i|n|d|e|x|"+0#0000000&|,| |"|@+0#e000e06&|j|s|o|n|"+0#0000000&|,| |"|@+0#e000e06&|l|a|n|g|u|a|g|e|"+0#0000000&|,| |"|@+0#e000e06&|l|i|s|t|"+0#0000000&|,| @30 +@57|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/jsonld_01.dump b/runtime/syntax/testdir/dumps/jsonld_01.dump new file mode 100644 index 0000000000..0115416e92 --- /dev/null +++ b/runtime/syntax/testdir/dumps/jsonld_01.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@3|"|@+0#e000e06&|v|o|c|a|b|"+0#0000000&|:| |n+0#00e0e07&|u|l@1| +0#0000000&@56 +@2|}+0#e000e06&|,+0#0000000&| @70 +@2|"|k+0#af5f00255&|e|y|w|o|r|d|s|A|s|V|a|l|u|e|s|"+0#0000000&|:| |[+0#e000e06&| +0#0000000&@51 +@4|"|@+0#e000e06&|b|a|s|e|"+0#0000000&|,| |"|@+0#e000e06&|c|o|n|t|a|i|n|e|r|"+0#0000000&|,| |"|@+0#e000e06&|c|o|n|t|e|x|t|"+0#0000000&|,| |"|@+0#e000e06&|d|i|r|e|c|t|i|o|n|"+0#0000000&|,| @22 +@4|"|@+0#e000e06&|g|r|a|p|h|"+0#0000000&|,| |"|@+0#e000e06&|i|d|"+0#0000000&|,| |"|@+0#e000e06&|i|m|p|o|r|t|"+0#0000000&|,| |"|@+0#e000e06&|i|n|c|l|u|d|e|d|"+0#0000000&|,| @30 +@4>"|@+0#e000e06&|i|n|d|e|x|"+0#0000000&|,| |"|@+0#e000e06&|j|s|o|n|"+0#0000000&|,| |"|@+0#e000e06&|l|a|n|g|u|a|g|e|"+0#0000000&|,| |"|@+0#e000e06&|l|i|s|t|"+0#0000000&|,| @30 +@4|"|@+0#e000e06&|n|e|s|t|"+0#0000000&|,| |"|@+0#e000e06&|n|o|n|e|"+0#0000000&|,| |"|@+0#e000e06&|p|r|e|f|i|x|"+0#0000000&|,| |"|@+0#e000e06&|p|r|o|p|a|g|a|t|e|"+0#0000000&|,| @28 +@4|"|@+0#e000e06&|p|r|o|t|e|c|t|e|d|"+0#0000000&|,| |"|@+0#e000e06&|r|e|v|e|r|s|e|"+0#0000000&|,| |"|@+0#e000e06&|s|e|t|"+0#0000000&|,| |"|@+0#e000e06&|t|y|p|e|"+0#0000000&|,| @28 +@4|"|@+0#e000e06&|v|a|l|u|e|"+0#0000000&|,| |"|@+0#e000e06&|v|e|r|s|i|o|n|"+0#0000000&|,| |"|@+0#e000e06&|v|o|c|a|b|"+0#0000000&| @40 +@2|]+0#e000e06&|,+0#0000000&| @70 +@2|"|n+0#af5f00255&|e|a|r|M|i|s@1|e|s|"+0#0000000&|:| |{+0#e000e06&| +0#0000000&@57 +@4|"|@+0#af5f00255&|i|d|e|n|t|i|f|i|e|r|"+0#0000000&|:| |"|@+0#e000002&|t|h|i|n|g|"+0#0000000&|,| @46 +@4|"|@+0#af5f00255&|I|D|"+0#0000000&|:| |"|p+0#e000002&|r|e|f|i|x|@|i|d|"+0#0000000&|,| @51 +@4|"|e+0#af5f00255&|s|c|a|p|e|d|Q|u|o|t|e|"+0#0000000&|:| |"|p+0#e000002&|r|e|f|i|x|\+0#e000e06&|"|@+0#e000002&|i|d|"+0#0000000&|,| @40 +@4|"|@+0#af5f00255&|\|u|0@1|6|9|d|"+0#0000000&|:| |"|@+0#e000002&|\+0#e000e06&|u|0@1|6|9|d+0#e000002&|"+0#0000000&|,| @47 +@4|"|i+0#af5f00255&|d|e|n|t|i|f|i|e|r|"+0#0000000&|:| |"|@+0#e000e06&|i|d|"+0#0000000&|,| @50 +@4|"|i+0#af5f00255&|r|i|"+0#0000000&|:| |"|h+0#e000002&|t@1|p|s|:|/@1|e|x|a|m|p|l|e|.|c|o|m|/|@|i|d|"+0#0000000&|,| @37 +@4|"|c+0#af5f00255&|o|m|p|a|c|t|I|r|i|"+0#0000000&|:| |"|s+0#e000002&|c|h|e|m|a|:|n|a|m|e|"+0#0000000&|,| @42 +@4|"|b+0#af5f00255&|l|a|n|k|N|o|d|e|"+0#0000000&|:| |"|_+0#e000002&|:|n|o|d|e|"+0#0000000&| @49 +@57|1|9|,|5| @9|5|9|%| diff --git a/runtime/syntax/testdir/dumps/jsonld_02.dump b/runtime/syntax/testdir/dumps/jsonld_02.dump new file mode 100644 index 0000000000..3c1f89d12e --- /dev/null +++ b/runtime/syntax/testdir/dumps/jsonld_02.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@3|"|b+0#af5f00255&|l|a|n|k|N|o|d|e|"+0#0000000&|:| |"|_+0#e000002&|:|n|o|d|e|"+0#0000000&| @49 +@2|}+0#e000e06&|,+0#0000000&| @70 +@2|"|o+0#af5f00255&|r|d|i|n|a|r|y|J|s|o|n|"+0#0000000&|:| |{+0#e000e06&| +0#0000000&@55 +@4|"|s+0#af5f00255&|t|r|i|n|g|"+0#0000000&|:| |"|t+0#e000002&|e|x|t|"+0#0000000&|,| @53 +@4|"|n+0#af5f00255&|u|m|b|e|r|"+0#0000000&|:| |-+0#e000002&|1|2|.|5|e|+|2|,+0#0000000&| @51 +@4>"|b+0#af5f00255&|o@1|l|e|a|n|"+0#0000000&|:| |t+0#e000002&|r|u|e|,+0#0000000&| @54 +@4|"|n+0#af5f00255&|o|t|h|i|n|g|"+0#0000000&|:| |n+0#00e0e07&|u|l@1|,+0#0000000&| @54 +@4|"|a+0#af5f00255&|r@1|a|y|"+0#0000000&|:| |[+0#e000e06&|f+0#e000002&|a|l|s|e|,+0#0000000&| |0+0#e000002&|,+0#0000000&| |"|v+0#e000002&|a|l|u|e|"+0#0000000&|]+0#e000e06&| +0#0000000&@42 +@2|}+0#e000e06&| +0#0000000&@71 +|}+0#e000e06&| +0#0000000&@73 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +| +0#0000000&@56|3|7|,|5| @9|B|o|t| diff --git a/runtime/syntax/testdir/input/jsonld.jsonld b/runtime/syntax/testdir/input/jsonld.jsonld new file mode 100644 index 0000000000..b0bf8f7b6d --- /dev/null +++ b/runtime/syntax/testdir/input/jsonld.jsonld @@ -0,0 +1,41 @@ +{ + "keywordsAsKeys": { + "@base": null, "@container": null, + "@context": null, "@direction": null, + "@graph": null, "@id": null, + "@import": null, "@included": null, + "@index": null, "@json": null, + "@language": null, "@list": null, + "@nest": null, "@none": null, + "@prefix": null, "@propagate": null, + "@protected": null, "@reverse": null, + "@set": null, "@type": null, + "@value": null, "@version": null, + "@vocab": null + }, + "keywordsAsValues": [ + "@base", "@container", "@context", "@direction", + "@graph", "@id", "@import", "@included", + "@index", "@json", "@language", "@list", + "@nest", "@none", "@prefix", "@propagate", + "@protected", "@reverse", "@set", "@type", + "@value", "@version", "@vocab" + ], + "nearMisses": { + "@identifier": "@thing", + "@ID": "prefix@id", + "escapedQuote": "prefix\"@id", + "@\u0069d": "@\u0069d", + "identifier": "@id", + "iri": "https://example.com/@id", + "compactIri": "schema:name", + "blankNode": "_:node" + }, + "ordinaryJson": { + "string": "text", + "number": -12.5e+2, + "boolean": true, + "nothing": null, + "array": [false, 0, "value"] + } +} diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index 59020deae2..428f7580bf 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -432,6 +432,7 @@ def s:GetFilenameChecks(): dict> json5: ['file.json5'], jsonc: ['file.jsonc', '.babelrc', '.eslintrc', '.jsfmtrc', '.jshintrc', '.jscsrc', '.vsconfig', '.hintrc', '.swrc', 'jsconfig.json', 'osquery.conf', 'tsconfig.json', 'tsconfig.test.json', 'tsconfig-test.json', '.luaurc', 'bun.lock', expand("$HOME/.config/VSCodium/User/settings.json"), '/home/user/.config/waybar/config' ], jsonl: ['file.jsonl'], + jsonld: ['file.jsonld'], jsonnet: ['file.jsonnet', 'file.libsonnet'], jsp: ['file.jsp'], julia: ['file.jl'], diff --git a/src/version.c b/src/version.c index a3bf4a35a3..674e2fbad5 100644 --- a/src/version.c +++ b/src/version.c @@ -763,6 +763,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 920, /**/ 919, /**/