From 4e6de820d048f182c87bb288ee6d1882c3e7a2ff Mon Sep 17 00:00:00 2001 From: rm41339 Date: Thu, 24 Jul 2025 18:20:40 +0200 Subject: [PATCH 1/7] recognize cabal.project files --- Makefile | 4 +- package.json | 21 +++++- scope-lists/cabalProject.yaml | 10 +++ syntaxes/cabalProject.YAML-tmLanguage | 104 ++++++++++++++++++++++++++ syntaxes/cabalProject.json | 54 +++++++++++++ 5 files changed, 189 insertions(+), 4 deletions(-) create mode 100644 scope-lists/cabalProject.yaml create mode 100644 syntaxes/cabalProject.YAML-tmLanguage create mode 100644 syntaxes/cabalProject.json diff --git a/Makefile b/Makefile index 002c73c..40d8ca9 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ CONVERT=npx js-yaml VSCE=npx vsce -SYNTAXES=haskell cabal literateHaskell alex happy +SYNTAXES=haskell cabal cabalProject literateHaskell alex happy JSON_TARGETS=$(addsuffix .json,$(addprefix syntaxes/,$(SYNTAXES))) SCOPE_LISTS=$(addsuffix .md,$(addprefix scope-lists/,$(SYNTAXES))) @@ -31,4 +31,4 @@ package: all $(VSCE) package clean: - rm $(JSON_TARGETS) \ No newline at end of file + rm $(JSON_TARGETS) diff --git a/package.json b/package.json index ab5a73c..91f231f 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "Haskell Syntax Highlighting", "description": "Syntax support for the Haskell programming language.", "version": "3.6.0", - "publisher": "justusadam", + "publisher": "justusadamtest", "engines": { "vscode": "^1.0.0" }, @@ -88,6 +88,18 @@ ], "configuration": "./cabal-configuration.json" }, + { + "id": "cabal-project", + "aliases": [ + "CabalProject", + "cabal-project" + ], + "extensions": [ + "cabal.project", + "cabal.project.local" + ], + "configuration": "./cabal-configuration.json" + }, { "id": "C2Hs", "aliases": [ @@ -168,6 +180,11 @@ "scopeName": "source.cabal", "path": "./syntaxes/cabal.json" }, + { + "language": "cabal-project", + "scopeName": "cabal.source.project", + "path": "./syntaxes/cabalProject.json" + }, { "language": "C2Hs", "scopeName": "source.c2hs", @@ -242,4 +259,4 @@ "webpack": "^5.75.0", "webpack-cli": "^5.0.1" } -} \ No newline at end of file +} diff --git a/scope-lists/cabalProject.yaml b/scope-lists/cabalProject.yaml new file mode 100644 index 0000000..d8ac58c --- /dev/null +++ b/scope-lists/cabalProject.yaml @@ -0,0 +1,10 @@ +- scope: CabalProject + hide: true +- scope: comment.line.double-dash +- scope: constant.numeric.cabal +- scope: entity.name.function.cabal +- scope: entity.name.section.cabal +- scope: keyword.control.cabal +- scope: keyword.operator.cabal +- scope: keyword.other.cabal +- scope: markup.underline.link.cabal diff --git a/syntaxes/cabalProject.YAML-tmLanguage b/syntaxes/cabalProject.YAML-tmLanguage new file mode 100644 index 0000000..9f4e414 --- /dev/null +++ b/syntaxes/cabalProject.YAML-tmLanguage @@ -0,0 +1,104 @@ +fileTypes: + - project + - project.local +name: CabalProject +patterns: + - name: keyword.other.cabal + match: | + (?ix)(\n|^) + ( name + | version + | cabal-version + | build-type + | license(-file)? + | copyright + | author + | maintainer + | stability + | homepage + | bug-reports + | package-url + | synopsis + | data-(files|dir) + | description + | category + | extra-(source|doc|tmp)-files + | tested-with + | tests + | import + ): + - name: keyword.other.cabal + match: | + (?ix)^[ \t]+ + ( (build(-tool)?|pkgconfig|setup)-depends + | (hs-source|include|extra-(lib|frameworks))-dirs + | ((other|default)-)?extensions + | build-tools + | buildable + | ((install|autogen)-)?includes + | (c(xx)?|js)-sources + | extra- + ( ((ghci|bundled)-)?libraries + | (dynamic-)?library-flavours + ) + | (cmm|cxx|cc|cpp|ld|ghc(-(prof|shared))?)-options + | (asm|cmm)-(sources|options) + | other-languages + | default-language + | frameworks + | default + | manual + | location + | branch + | tag + | subdir + | exposed(-modules)? + | (other|virtual|autogen|reexported)-modules + | visibility + | main-is + | type + | test-module + | description + | mixins + | import + | signatures + | scope + | lib-version-(version|linux) + | mod-def-file + | options + | x-\w[1-9\w_-]* + ): + - name: keyword.operator.cabal + match: '(==|>=|<=|<|>|^>=|\|\||&&|!)' + - name: constant.numeric.cabal + match: '(?<=[^\w])\d+(\.\d+)*(\.\*)?' + - name: markup.underline.link.cabal + match: '\w+:/(/[\w._\-\d%])+(\?[\w.+_\-\d%]+)(&[\w._+\-\d%]+)*' + - name: entity.name.section.cabal + match: | + ^(?ix: + ( library + | custom-setup + ) + )$ + - match: | + ^(?ix: + ( executable + | flag + | test-suite + | benchmark + | common + | source-repository + | library + | foreign-library + ) + )( |\t)+([\w\-_]+)$ + captures: + '1': {name: entity.name.section.cabal} + '3': {name: entity.name.function.cabal} + - name: keyword.control.cabal + match: '^[ \t]*(if|elif|else)' + - name: comment.line.double-dash + match: '^\s*--.*$' +scopeName: cabal.source.project +uuid: 5eb56f02-df11-40b2-b6d5-fa444522416c diff --git a/syntaxes/cabalProject.json b/syntaxes/cabalProject.json new file mode 100644 index 0000000..a46f1cc --- /dev/null +++ b/syntaxes/cabalProject.json @@ -0,0 +1,54 @@ +{ + "fileTypes": [ + "project", + "project.local" + ], + "name": "CabalProject", + "patterns": [ + { + "name": "keyword.other.cabal", + "match": "(?ix)(\\n|^)\n ( name\n | version\n | cabal-version\n | build-type\n | license(-file)?\n | copyright\n | author\n | maintainer\n | stability\n | homepage\n | bug-reports\n | package-url\n | synopsis\n | data-(files|dir)\n | description\n | category\n | extra-(source|doc|tmp)-files\n | tested-with\n | tests\n | import\n ):\n" + }, + { + "name": "keyword.other.cabal", + "match": "(?ix)^[ \\t]+\n ( (build(-tool)?|pkgconfig|setup)-depends\n | (hs-source|include|extra-(lib|frameworks))-dirs\n | ((other|default)-)?extensions\n | build-tools\n | buildable\n | ((install|autogen)-)?includes\n | (c(xx)?|js)-sources\n | extra-\n ( ((ghci|bundled)-)?libraries\n | (dynamic-)?library-flavours\n )\n | (cmm|cxx|cc|cpp|ld|ghc(-(prof|shared))?)-options\n | (asm|cmm)-(sources|options)\n | other-languages\n | default-language\n | frameworks\n | default\n | manual\n | location\n | branch\n | tag\n | subdir\n | exposed(-modules)?\n | (other|virtual|autogen|reexported)-modules\n | visibility\n | main-is\n | type\n | test-module\n | description\n | mixins\n | import\n | signatures\n | scope\n | lib-version-(version|linux)\n | mod-def-file\n | options\n | x-\\w[1-9\\w_-]*\n ):\n" + }, + { + "name": "keyword.operator.cabal", + "match": "(==|>=|<=|<|>|^>=|\\|\\||&&|!)" + }, + { + "name": "constant.numeric.cabal", + "match": "(?<=[^\\w])\\d+(\\.\\d+)*(\\.\\*)?" + }, + { + "name": "markup.underline.link.cabal", + "match": "\\w+:/(/[\\w._\\-\\d%])+(\\?[\\w.+_\\-\\d%]+)(&[\\w._+\\-\\d%]+)*" + }, + { + "name": "entity.name.section.cabal", + "match": "^(?ix:\n ( library\n | custom-setup\n )\n)$\n" + }, + { + "match": "^(?ix:\n ( executable\n | flag\n | test-suite\n | benchmark\n | common\n | source-repository\n | library\n | foreign-library\n )\n)( |\\t)+([\\w\\-_]+)$\n", + "captures": { + "1": { + "name": "entity.name.section.cabal" + }, + "3": { + "name": "entity.name.function.cabal" + } + } + }, + { + "name": "keyword.control.cabal", + "match": "^[ \\t]*(if|elif|else)" + }, + { + "name": "comment.line.double-dash", + "match": "^\\s*--.*$" + } + ], + "scopeName": "cabal.source.project", + "uuid": "5eb56f02-df11-40b2-b6d5-fa444522416c" +} From 59adb6cc4fdc8d2a9f8ef4e48a86edd172540e70 Mon Sep 17 00:00:00 2001 From: rm41339 Date: Wed, 30 Jul 2025 14:34:46 +0200 Subject: [PATCH 2/7] add cabal.project field coverage --- package.json | 11 ++- syntaxes/cabalProject.YAML-tmLanguage | 135 ++++++++++++++------------ syntaxes/cabalProject.json | 8 +- 3 files changed, 81 insertions(+), 73 deletions(-) diff --git a/package.json b/package.json index 91f231f..ff965e3 100644 --- a/package.json +++ b/package.json @@ -89,14 +89,15 @@ "configuration": "./cabal-configuration.json" }, { - "id": "cabal-project", + "id": "cabal project", "aliases": [ "CabalProject", - "cabal-project" + "cabal-project", + "cabal project" ], "extensions": [ - "cabal.project", - "cabal.project.local" + ".project", + ".project.local" ], "configuration": "./cabal-configuration.json" }, @@ -181,7 +182,7 @@ "path": "./syntaxes/cabal.json" }, { - "language": "cabal-project", + "language": "cabal project", "scopeName": "cabal.source.project", "path": "./syntaxes/cabalProject.json" }, diff --git a/syntaxes/cabalProject.YAML-tmLanguage b/syntaxes/cabalProject.YAML-tmLanguage index 9f4e414..782f8f3 100644 --- a/syntaxes/cabalProject.YAML-tmLanguage +++ b/syntaxes/cabalProject.YAML-tmLanguage @@ -6,66 +6,81 @@ patterns: - name: keyword.other.cabal match: | (?ix)(\n|^) - ( name - | version - | cabal-version - | build-type - | license(-file)? - | copyright - | author - | maintainer - | stability - | homepage - | bug-reports - | package-url - | synopsis - | data-(files|dir) - | description - | category - | extra-(source|doc|tmp)-files - | tested-with - | tests + ( tests | import + | (optional-|extra-)?packages + | benchmarks + | verbose + | build-(summary|log) + | remote-build-reporting + | report-planning-failure + | symlink-bindir + | jobs + | semaphore + | keep-going + | offline + | haddock-keep-temp-files + | http-transport + | ignore-expiry + | remote-repo-cache + | (logs-|project-|build|store-)dir + | project-file + | ignore-project + | (with-)?compiler + | with-hc-pkg + | doc-index-file + | package-dbs + | active-repositories + | index-state + | constraints + | preferences + | cabal-lib-version + | solver + | allow-(older|newer|boot-library-installs) + | write-ghc-environment-files + | max-backjumps + | reorder-goals + | (count|fine-grained)-conflicts + | minimize-conflict-set + | strong-flags + | reject-unconstrained-dependencies + | per-component + | independent-goals + | prefer-oldest + | extra-prog-path-shared-only + | multi-repl ): - name: keyword.other.cabal match: | (?ix)^[ \t]+ - ( (build(-tool)?|pkgconfig|setup)-depends - | (hs-source|include|extra-(lib|frameworks))-dirs - | ((other|default)-)?extensions - | build-tools - | buildable - | ((install|autogen)-)?includes - | (c(xx)?|js)-sources - | extra- - ( ((ghci|bundled)-)?libraries - | (dynamic-)?library-flavours - ) - | (cmm|cxx|cc|cpp|ld|ghc(-(prof|shared))?)-options - | (asm|cmm)-(sources|options) - | other-languages - | default-language - | frameworks - | default - | manual - | location - | branch - | tag + ( haddock-(all|hoogle|html|foreign-libraries|executables + |tests|benchmarks|internal|(hscolour-)?css|hyperlink-source + |quickjump|(contents|index|html)-location|base-url + |(resources|output)-dir|use-unicode|for-hackage) + | extra-prog-path + | flags + | library-(vanilla|for-ghci|stripping) + | shared + | static + | executable-(dynamic|static|stripping) + | ((library|executable)-)?profiling(-(shared|detail))? + | optimization + | program-(prefix|suffix) + | extra-(lib|framework|include)-dirs(-static)? + | split-(sections|objs) + | (run-)?tests + | benchmarks + | relocatable + | (debug|build)-info + | documentation + | test-((machine-)?log|show-details|keep-tix-files + |wrapper|fail-when-no-test-suites) + | coverage + | (benchmark|ghc|test|configure)-options + | type + | location + | tag | subdir - | exposed(-modules)? - | (other|virtual|autogen|reexported)-modules - | visibility - | main-is - | type - | test-module - | description - | mixins - | import - | signatures - | scope - | lib-version-(version|linux) - | mod-def-file - | options | x-\w[1-9\w_-]* ): - name: keyword.operator.cabal @@ -77,20 +92,12 @@ patterns: - name: entity.name.section.cabal match: | ^(?ix: - ( library - | custom-setup - ) + ( program-options ) )$ - match: | ^(?ix: - ( executable - | flag - | test-suite - | benchmark - | common + ( package | source-repository - | library - | foreign-library ) )( |\t)+([\w\-_]+)$ captures: diff --git a/syntaxes/cabalProject.json b/syntaxes/cabalProject.json index a46f1cc..3ee1fcd 100644 --- a/syntaxes/cabalProject.json +++ b/syntaxes/cabalProject.json @@ -7,11 +7,11 @@ "patterns": [ { "name": "keyword.other.cabal", - "match": "(?ix)(\\n|^)\n ( name\n | version\n | cabal-version\n | build-type\n | license(-file)?\n | copyright\n | author\n | maintainer\n | stability\n | homepage\n | bug-reports\n | package-url\n | synopsis\n | data-(files|dir)\n | description\n | category\n | extra-(source|doc|tmp)-files\n | tested-with\n | tests\n | import\n ):\n" + "match": "(?ix)(\\n|^)\n ( tests\n | import\n | (optional-|extra-)?packages\n | benchmarks\n | verbose\n | build-(summary|log)\n | remote-build-reporting\n | report-planning-failure\n | symlink-bindir\n | jobs\n | semaphore\n | keep-going\n | offline\n | haddock-keep-temp-files \n | http-transport\n | ignore-expiry\n | remote-repo-cache\n | (logs-|project-|build|store-)dir \n | project-file \n | ignore-project \n | (with-)?compiler\n | with-hc-pkg \n | doc-index-file \n | package-dbs\n | active-repositories \n | index-state\n | constraints\n | preferences\n | cabal-lib-version\n | solver \n | allow-(older|newer|boot-library-installs)\n | write-ghc-environment-files \n | max-backjumps\n | reorder-goals \n | (count|fine-grained)-conflicts\n | minimize-conflict-set \n | strong-flags\n | reject-unconstrained-dependencies\n | per-component\n | independent-goals \n | prefer-oldest\n | extra-prog-path-shared-only\n | multi-repl \n ):\n" }, { "name": "keyword.other.cabal", - "match": "(?ix)^[ \\t]+\n ( (build(-tool)?|pkgconfig|setup)-depends\n | (hs-source|include|extra-(lib|frameworks))-dirs\n | ((other|default)-)?extensions\n | build-tools\n | buildable\n | ((install|autogen)-)?includes\n | (c(xx)?|js)-sources\n | extra-\n ( ((ghci|bundled)-)?libraries\n | (dynamic-)?library-flavours\n )\n | (cmm|cxx|cc|cpp|ld|ghc(-(prof|shared))?)-options\n | (asm|cmm)-(sources|options)\n | other-languages\n | default-language\n | frameworks\n | default\n | manual\n | location\n | branch\n | tag\n | subdir\n | exposed(-modules)?\n | (other|virtual|autogen|reexported)-modules\n | visibility\n | main-is\n | type\n | test-module\n | description\n | mixins\n | import\n | signatures\n | scope\n | lib-version-(version|linux)\n | mod-def-file\n | options\n | x-\\w[1-9\\w_-]*\n ):\n" + "match": "(?ix)^[ \\t]+\n ( haddock-(all|hoogle|html|foreign-libraries|executables\n |tests|benchmarks|internal|(hscolour-)?css|hyperlink-source\n |quickjump|(contents|index|html)-location|base-url\n |(resources|output)-dir|use-unicode|for-hackage)\n | extra-prog-path \n | flags \n | library-(vanilla|for-ghci|stripping)\n | shared \n | static \n | executable-(dynamic|static|stripping)\n | ((library|executable)-)?profiling(-(shared|detail))?\n | optimization \n | program-(prefix|suffix)\n | extra-(lib|framework|include)-dirs(-static)?\n | split-(sections|objs)\n | (run-)?tests \n | benchmarks \n | relocatable\n | (debug|build)-info\n | documentation\n | test-((machine-)?log|show-details|keep-tix-files\n |wrapper|fail-when-no-test-suites)\n | coverage \n | (benchmark|ghs|test|configure)-options\n | type \n | location \n | tag \n | subdir\n | x-\\w[1-9\\w_-]*\n ):\n" }, { "name": "keyword.operator.cabal", @@ -27,10 +27,10 @@ }, { "name": "entity.name.section.cabal", - "match": "^(?ix:\n ( library\n | custom-setup\n )\n)$\n" + "match": "^(?ix:\n ( program-options )\n)$\n" }, { - "match": "^(?ix:\n ( executable\n | flag\n | test-suite\n | benchmark\n | common\n | source-repository\n | library\n | foreign-library\n )\n)( |\\t)+([\\w\\-_]+)$\n", + "match": "^(?ix:\n ( package\n | source-repository\n )\n)( |\\t)+([\\w\\-_]+)$\n", "captures": { "1": { "name": "entity.name.section.cabal" From c75ed582404b8298baf726c7b2285ef5cc252b82 Mon Sep 17 00:00:00 2001 From: rm41339 Date: Tue, 5 Aug 2025 21:37:07 +0200 Subject: [PATCH 3/7] add cabal.project syntax example --- scope-lists/cabalProject.md | 10 ++++++++++ syntax-examples/cabal.project | 15 +++++++++++++++ syntaxes/cabalProject.json | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 scope-lists/cabalProject.md create mode 100644 syntax-examples/cabal.project diff --git a/scope-lists/cabalProject.md b/scope-lists/cabalProject.md new file mode 100644 index 0000000..e9ad412 --- /dev/null +++ b/scope-lists/cabalProject.md @@ -0,0 +1,10 @@ +| Scope Name | Description | Example | +|-|-|-| +| comment.line.double-dash | | | +| constant.numeric.cabal | | | +| entity.name.function.cabal | | | +| entity.name.section.cabal | | | +| keyword.control.cabal | | | +| keyword.operator.cabal | | | +| keyword.other.cabal | | | +| markup.underline.link.cabal | | | diff --git a/syntax-examples/cabal.project b/syntax-examples/cabal.project new file mode 100644 index 0000000..52374e2 --- /dev/null +++ b/syntax-examples/cabal.project @@ -0,0 +1,15 @@ +-- A comment + +packages: test-name +import: file + +package example + flags: +flags + +source-repository repo + tests: false + benchmarks: false + configure-options: + +program-options + ghc-options: -option diff --git a/syntaxes/cabalProject.json b/syntaxes/cabalProject.json index 3ee1fcd..e7c6263 100644 --- a/syntaxes/cabalProject.json +++ b/syntaxes/cabalProject.json @@ -11,7 +11,7 @@ }, { "name": "keyword.other.cabal", - "match": "(?ix)^[ \\t]+\n ( haddock-(all|hoogle|html|foreign-libraries|executables\n |tests|benchmarks|internal|(hscolour-)?css|hyperlink-source\n |quickjump|(contents|index|html)-location|base-url\n |(resources|output)-dir|use-unicode|for-hackage)\n | extra-prog-path \n | flags \n | library-(vanilla|for-ghci|stripping)\n | shared \n | static \n | executable-(dynamic|static|stripping)\n | ((library|executable)-)?profiling(-(shared|detail))?\n | optimization \n | program-(prefix|suffix)\n | extra-(lib|framework|include)-dirs(-static)?\n | split-(sections|objs)\n | (run-)?tests \n | benchmarks \n | relocatable\n | (debug|build)-info\n | documentation\n | test-((machine-)?log|show-details|keep-tix-files\n |wrapper|fail-when-no-test-suites)\n | coverage \n | (benchmark|ghs|test|configure)-options\n | type \n | location \n | tag \n | subdir\n | x-\\w[1-9\\w_-]*\n ):\n" + "match": "(?ix)^[ \\t]+\n ( haddock-(all|hoogle|html|foreign-libraries|executables\n |tests|benchmarks|internal|(hscolour-)?css|hyperlink-source\n |quickjump|(contents|index|html)-location|base-url\n |(resources|output)-dir|use-unicode|for-hackage)\n | extra-prog-path \n | flags \n | library-(vanilla|for-ghci|stripping)\n | shared \n | static \n | executable-(dynamic|static|stripping)\n | ((library|executable)-)?profiling(-(shared|detail))?\n | optimization \n | program-(prefix|suffix)\n | extra-(lib|framework|include)-dirs(-static)?\n | split-(sections|objs)\n | (run-)?tests \n | benchmarks \n | relocatable\n | (debug|build)-info\n | documentation\n | test-((machine-)?log|show-details|keep-tix-files\n |wrapper|fail-when-no-test-suites)\n | coverage \n | (benchmark|ghc|test|configure)-options\n | type \n | location \n | tag \n | subdir\n | x-\\w[1-9\\w_-]*\n ):\n" }, { "name": "keyword.operator.cabal", From 57be7c991b05adfba1a5f3949542f9b2c9875cf1 Mon Sep 17 00:00:00 2001 From: rm41339 Date: Wed, 6 Aug 2025 13:34:50 +0200 Subject: [PATCH 4/7] update cabal.project example --- syntax-examples/cabal.project | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/syntax-examples/cabal.project b/syntax-examples/cabal.project index 52374e2..29dc0b0 100644 --- a/syntax-examples/cabal.project +++ b/syntax-examples/cabal.project @@ -2,14 +2,24 @@ packages: test-name import: file +verbose: 0 +allow-older: False +haddock-keep-temp-files: False package example flags: +flags + tests: False + benchmarks: False + extra-lib-dirs: test source-repository repo - tests: false - benchmarks: false - configure-options: - + type: git + location: test + tag: test + subdir: test + program-options - ghc-options: -option + shared: False + ghc-options: -test + + From f21ed47f48350c3224c8ec92ec6d267b82f94131 Mon Sep 17 00:00:00 2001 From: rm41339 Date: Sat, 9 Aug 2025 16:07:36 +0100 Subject: [PATCH 5/7] add missing fields, edit index-state syntax highlighting --- CHANGELOG.md | 1 + syntaxes/cabalProject.YAML-tmLanguage | 56 ++++++++++++++++++++++----- syntaxes/cabalProject.json | 6 +-- 3 files changed, 51 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e14e7bc..60c3e5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Fix bare unit type applications ([#225](https://github.com/JustusAdam/language-haskell/issue/225)), thanks to [@mixphix](https://github.com/mixphix) - Fix qualified type operators in export lists ([#191](https://github.com/JustusAdam/language-haskell/issue/191)), thanks to [@mixphix] - Add support for `elif` in Cabal files (`cabal-version` >= 2.2) ([#236](https://github.com/JustusAdam/language-haskell/pull/236)) +- Add support for cabal.project files ([] ()), thanks to [@rm41339] ## 3.6.0 - 15.03.2022 diff --git a/syntaxes/cabalProject.YAML-tmLanguage b/syntaxes/cabalProject.YAML-tmLanguage index 782f8f3..d6a7ae6 100644 --- a/syntaxes/cabalProject.YAML-tmLanguage +++ b/syntaxes/cabalProject.YAML-tmLanguage @@ -21,14 +21,12 @@ patterns: | offline | haddock-keep-temp-files | http-transport - | ignore-expiry + | ignore-(expiry|project) | remote-repo-cache | (logs-|project-|build|store-)dir - | project-file - | ignore-project + | (doc-index|project)-file | (with-)?compiler | with-hc-pkg - | doc-index-file | package-dbs | active-repositories | index-state @@ -42,13 +40,15 @@ patterns: | reorder-goals | (count|fine-grained)-conflicts | minimize-conflict-set - | strong-flags + | (strong-)?flags | reject-unconstrained-dependencies | per-component | independent-goals | prefer-oldest | extra-prog-path-shared-only | multi-repl + | test-((machine-)?log|show-details|keep-tix-files + |wrapper|fail-when-no-test-suites|options) ): - name: keyword.other.cabal match: | @@ -56,9 +56,10 @@ patterns: ( haddock-(all|hoogle|html|foreign-libraries|executables |tests|benchmarks|internal|(hscolour-)?css|hyperlink-source |quickjump|(contents|index|html)-location|base-url - |(resources|output)-dir|use-unicode|for-hackage) + |(resources|output)-dir|use-unicode|for-hackage + |keep-temp-files) | extra-prog-path - | flags + | (strong-)?flags | library-(vanilla|for-ghci|stripping) | shared | static @@ -74,19 +75,56 @@ patterns: | (debug|build)-info | documentation | test-((machine-)?log|show-details|keep-tix-files - |wrapper|fail-when-no-test-suites) + |wrapper|fail-when-no-test-suites|options) | coverage | (benchmark|ghc|test|configure)-options | type | location | tag | subdir + | import + | (optional-|extra-)?packages + | verbose + | build-(summary|log) + | remote-build-reporting + | report-planning-failure + | symlink-bindir + | jobs + | semaphore + | keep-going + | offline + | http-transport + | ignore-(expiry|project) + | remote-repo-cache + | (logs-|project-|build|store-)dir + | (with-)?compiler + | with-hc-pkg + | (doc-index|project)-file + | package-dbs + | active-repositories + | index-state + | constraints + | preferences + | cabal-lib-version + | solver + | allow-(older|newer|boot-library-installs) + | write-ghc-environment-files + | max-backjumps + | reorder-goals + | (count|fine-grained)-conflicts + | minimize-conflict-set + | reject-unconstrained-dependencies + | per-component + | independent-goals + | prefer-oldest + | extra-prog-path-shared-only + | multi-repl | x-\w[1-9\w_-]* ): - name: keyword.operator.cabal match: '(==|>=|<=|<|>|^>=|\|\||&&|!)' - name: constant.numeric.cabal - match: '(?<=[^\w])\d+(\.\d+)*(\.\*)?' + match: '(?<=[^\w])\d+(.\d+)*(.*)?|[0-9]{4}-[0-9]{2}-[0-9]{2}(T[0-9]{2}(:[0-9]{2}){2}Z)?' - name: markup.underline.link.cabal match: '\w+:/(/[\w._\-\d%])+(\?[\w.+_\-\d%]+)(&[\w._+\-\d%]+)*' - name: entity.name.section.cabal diff --git a/syntaxes/cabalProject.json b/syntaxes/cabalProject.json index e7c6263..d06875a 100644 --- a/syntaxes/cabalProject.json +++ b/syntaxes/cabalProject.json @@ -7,11 +7,11 @@ "patterns": [ { "name": "keyword.other.cabal", - "match": "(?ix)(\\n|^)\n ( tests\n | import\n | (optional-|extra-)?packages\n | benchmarks\n | verbose\n | build-(summary|log)\n | remote-build-reporting\n | report-planning-failure\n | symlink-bindir\n | jobs\n | semaphore\n | keep-going\n | offline\n | haddock-keep-temp-files \n | http-transport\n | ignore-expiry\n | remote-repo-cache\n | (logs-|project-|build|store-)dir \n | project-file \n | ignore-project \n | (with-)?compiler\n | with-hc-pkg \n | doc-index-file \n | package-dbs\n | active-repositories \n | index-state\n | constraints\n | preferences\n | cabal-lib-version\n | solver \n | allow-(older|newer|boot-library-installs)\n | write-ghc-environment-files \n | max-backjumps\n | reorder-goals \n | (count|fine-grained)-conflicts\n | minimize-conflict-set \n | strong-flags\n | reject-unconstrained-dependencies\n | per-component\n | independent-goals \n | prefer-oldest\n | extra-prog-path-shared-only\n | multi-repl \n ):\n" + "match": "(?ix)(\\n|^)\n ( tests\n | import\n | (optional-|extra-)?packages\n | benchmarks\n | verbose\n | build-(summary|log)\n | remote-build-reporting\n | report-planning-failure\n | symlink-bindir\n | jobs\n | semaphore\n | keep-going\n | offline\n | haddock-keep-temp-files \n | http-transport\n | ignore-(expiry|project)\n | remote-repo-cache\n | (logs-|project-|build|store-)dir \n | (doc-index|project)-file \n | (with-)?compiler\n | with-hc-pkg \n | package-dbs\n | active-repositories \n | index-state\n | constraints\n | preferences\n | cabal-lib-version\n | solver \n | allow-(older|newer|boot-library-installs)\n | write-ghc-environment-files \n | max-backjumps\n | reorder-goals \n | (count|fine-grained)-conflicts\n | minimize-conflict-set \n | (strong-)?flags\n | reject-unconstrained-dependencies\n | per-component\n | independent-goals \n | prefer-oldest\n | extra-prog-path-shared-only\n | multi-repl \n | test-((machine-)?log|show-details|keep-tix-files\n |wrapper|fail-when-no-test-suites|options)\n ):\n" }, { "name": "keyword.other.cabal", - "match": "(?ix)^[ \\t]+\n ( haddock-(all|hoogle|html|foreign-libraries|executables\n |tests|benchmarks|internal|(hscolour-)?css|hyperlink-source\n |quickjump|(contents|index|html)-location|base-url\n |(resources|output)-dir|use-unicode|for-hackage)\n | extra-prog-path \n | flags \n | library-(vanilla|for-ghci|stripping)\n | shared \n | static \n | executable-(dynamic|static|stripping)\n | ((library|executable)-)?profiling(-(shared|detail))?\n | optimization \n | program-(prefix|suffix)\n | extra-(lib|framework|include)-dirs(-static)?\n | split-(sections|objs)\n | (run-)?tests \n | benchmarks \n | relocatable\n | (debug|build)-info\n | documentation\n | test-((machine-)?log|show-details|keep-tix-files\n |wrapper|fail-when-no-test-suites)\n | coverage \n | (benchmark|ghc|test|configure)-options\n | type \n | location \n | tag \n | subdir\n | x-\\w[1-9\\w_-]*\n ):\n" + "match": "(?ix)^[ \\t]+\n ( haddock-(all|hoogle|html|foreign-libraries|executables\n |tests|benchmarks|internal|(hscolour-)?css|hyperlink-source\n |quickjump|(contents|index|html)-location|base-url\n |(resources|output)-dir|use-unicode|for-hackage\n |keep-temp-files)\n | extra-prog-path \n | (strong-)?flags \n | library-(vanilla|for-ghci|stripping)\n | shared \n | static \n | executable-(dynamic|static|stripping)\n | ((library|executable)-)?profiling(-(shared|detail))?\n | optimization \n | program-(prefix|suffix)\n | extra-(lib|framework|include)-dirs(-static)?\n | split-(sections|objs)\n | (run-)?tests \n | benchmarks \n | relocatable\n | (debug|build)-info\n | documentation\n | test-((machine-)?log|show-details|keep-tix-files\n |wrapper|fail-when-no-test-suites|options)\n | coverage \n | (benchmark|ghc|test|configure)-options\n | type \n | location \n | tag \n | subdir\n | tests\n | import\n | (optional-|extra-)?packages\n | benchmarks\n | verbose\n | build-(summary|log)\n | remote-build-reporting\n | report-planning-failure\n | symlink-bindir\n | jobs\n | semaphore\n | keep-going\n | offline \n | http-transport\n | ignore-(expiry|project)\n | remote-repo-cache\n | (logs-|project-|build|store-)dir \n | (with-)?compiler\n | with-hc-pkg \n | (doc-index|project)-file \n | package-dbs\n | active-repositories \n | index-state\n | constraints\n | preferences\n | cabal-lib-version\n | solver \n | allow-(older|newer|boot-library-installs)\n | write-ghc-environment-files \n | max-backjumps\n | reorder-goals \n | (count|fine-grained)-conflicts\n | minimize-conflict-set \n | reject-unconstrained-dependencies\n | per-component\n | independent-goals \n | prefer-oldest\n | extra-prog-path-shared-only\n | multi-repl \n | x-\\w[1-9\\w_-]*\n ):\n" }, { "name": "keyword.operator.cabal", @@ -19,7 +19,7 @@ }, { "name": "constant.numeric.cabal", - "match": "(?<=[^\\w])\\d+(\\.\\d+)*(\\.\\*)?" + "match": "(?<=[^\\w])\\d+(.\\d+)*(.*)?|[0-9]{4}-[0-9]{2}-[0-9]{2}(T[0-9]{2}(:[0-9]{2}){2}Z)?" }, { "name": "markup.underline.link.cabal", From a81b2b59809689b962322636d19090aafae230a7 Mon Sep 17 00:00:00 2001 From: rm41339 Date: Wed, 13 Aug 2025 11:33:11 +0100 Subject: [PATCH 6/7] minor formatting edits --- package.json | 2 +- syntaxes/cabalProject.YAML-tmLanguage | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index ff965e3..c35304b 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "Haskell Syntax Highlighting", "description": "Syntax support for the Haskell programming language.", "version": "3.6.0", - "publisher": "justusadamtest", + "publisher": "justusadam", "engines": { "vscode": "^1.0.0" }, diff --git a/syntaxes/cabalProject.YAML-tmLanguage b/syntaxes/cabalProject.YAML-tmLanguage index d6a7ae6..3d309da 100644 --- a/syntaxes/cabalProject.YAML-tmLanguage +++ b/syntaxes/cabalProject.YAML-tmLanguage @@ -54,9 +54,9 @@ patterns: match: | (?ix)^[ \t]+ ( haddock-(all|hoogle|html|foreign-libraries|executables - |tests|benchmarks|internal|(hscolour-)?css|hyperlink-source - |quickjump|(contents|index|html)-location|base-url - |(resources|output)-dir|use-unicode|for-hackage + |tests|benchmarks|internal|(hscolour-)?css + |hyperlink-source|quickjump|(contents|index|html)-location + |base-url|(resources|output)-dir|use-unicode|for-hackage |keep-temp-files) | extra-prog-path | (strong-)?flags From fd0e41f628e9ea159e163eb47ef92bdf3829a323 Mon Sep 17 00:00:00 2001 From: rm41339 Date: Wed, 13 Aug 2025 11:38:27 +0100 Subject: [PATCH 7/7] add issue # and link to changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60c3e5d..ccbacde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ - Fix bare unit type applications ([#225](https://github.com/JustusAdam/language-haskell/issue/225)), thanks to [@mixphix](https://github.com/mixphix) - Fix qualified type operators in export lists ([#191](https://github.com/JustusAdam/language-haskell/issue/191)), thanks to [@mixphix] - Add support for `elif` in Cabal files (`cabal-version` >= 2.2) ([#236](https://github.com/JustusAdam/language-haskell/pull/236)) -- Add support for cabal.project files ([] ()), thanks to [@rm41339] +- Add support for cabal.project files ([#237] (https://github.com/JustusAdam/language-haskell/issues/237)), thanks to [@rm41339] ## 3.6.0 - 15.03.2022