plugins/todo-comments: fix missing mkRaw for pattern options (#242)

This commit is contained in:
Gaétan Lepage 2023-03-12 17:55:09 +01:00 committed by GitHub
parent 933c87c282
commit 8fed61902a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 8 deletions

View file

@ -114,8 +114,14 @@ in {
"fg" or "bg" or empty.
'';
pattern = helpers.mkNullOrOption (with types; either str (listOf str)) ''
pattern =
helpers.defaultNullOpts.mkNullable
(with types; either str (listOf str))
".*<(KEYWORDS)\\s*:"
''
Pattern or list of patterns, used for highlighting (vim regex)
Note: the provided pattern will be embedded as such: `[[PATTERN]]`.
'';
commentsOnly = helpers.defaultNullOpts.mkBool true ''
@ -168,9 +174,11 @@ in {
```
'';
pattern = helpers.defaultNullOpts.mkStr "[[\b(KEYWORDS):]]" ''
pattern = helpers.defaultNullOpts.mkStr "\\b(KEYWORDS):" ''
Regex that will be used to match keywords.
Don't replace the (KEYWORDS) placeholder.
Note: the provided pattern will be embedded as such: `[[PATTERN]]`.
'';
};
@ -226,16 +234,27 @@ in {
before
keyword
after
pattern
exclude
;
pattern =
helpers.ifNonNull' cfg.highlight.pattern
(helpers.mkRaw "[[${cfg.highlight.pattern}]]");
multiline_pattern = cfg.highlight.multilinePattern;
multiline_context = cfg.highlight.multilineContext;
comments_only = cfg.highlight.commentsOnly;
max_line_len = cfg.highlight.maxLineLen;
};
colors = cfg.colors;
search = cfg.search;
search = helpers.ifNonNull' cfg.search {
inherit (cfg.search) command args;
pattern =
helpers.ifNonNull' cfg.search.pattern
(
if isList cfg.search.pattern
then (map (p: helpers.mkRaw p) cfg.search.pattern)
else helpers.mkRaw "[[${cfg.search.pattern}]]"
);
};
}
// cfg.extraOptions;
in

View file

@ -62,7 +62,7 @@
before = "";
keyword = "wide";
after = "fg";
pattern = "[[.*<(KEYWORDS)\s*:]]";
pattern = ''.*<(KEYWORDS)\s*:'';
commentsOnly = true;
maxLineLen = 400;
exclude = [];
@ -86,7 +86,7 @@
"--line-number"
"--column"
];
pattern = "[[\b(KEYWORDS):]]";
pattern = ''\b(KEYWORDS):'';
};
keymapsSilent = true;