From 6537b388a94b41533c982cafb15bbccc0507ed64 Mon Sep 17 00:00:00 2001 From: gnikit Date: Wed, 6 Oct 2021 03:44:32 +0100 Subject: [PATCH] Fixes preprocessor syntax highlighting The line continuation operator is a bit too aggressive so instead of adding lookaheads for every case where we don't need to apply it we have excluded the preprocessor directives from the lint cont. The original .cson highlighting does the same, see: https://github.com/dparkins/language-fortran/blob/master/grammars/fortran%20-%20free%20form.cson for injections see: https://gist.github.com/Aerijo/b8c82d647db783187804e86fa0a604a1 Fixes Preprocessor statements in line continuations break syntax highlighting #248 Fixes Erroneous syntax highlighting for preprocessor conditionals in derived types #249 --- syntaxes/fortran_free-form.tmLanguage.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/syntaxes/fortran_free-form.tmLanguage.json b/syntaxes/fortran_free-form.tmLanguage.json index 86bb26e2..4fec12dc 100644 --- a/syntaxes/fortran_free-form.tmLanguage.json +++ b/syntaxes/fortran_free-form.tmLanguage.json @@ -17,10 +17,13 @@ ], "firstLineMatch": "(?i)-[*]- mode: fortran free -[*]-", "injections": { - "source.fortran.free - ( string | comment )": { + "source.fortran.free - ( string | comment | source.preprocessor )": { "patterns": [ { "include": "#line-continuation-operator" + }, + { + "include": "#preprocessor" } ] }, @@ -121,6 +124,7 @@ ], "repository": { "preprocessor": { + "name": "source.preprocessor", "begin": "^\\s*(#)", "beginCaptures": { "1": {