Skip to content

Commit dce869c

Browse files
committed
fix: mergeArraysBy generic return type.
- Fixed `mergeArraysBy` util function call in `Configuration::setLanguageConfiguration` method to pass its generic return type as vscode's `AutoClosingPair` or `OnEnterRule`. The function is declared with a passable generic `T` type, but it wasn't being used, so we might as well use it and pass the return types.
1 parent c224f7b commit dce869c

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

src/configuration.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -714,10 +714,18 @@ export class Configuration {
714714
let langConfig = {...internalLangConfig};
715715

716716
if (multiLine) {
717-
langConfig.autoClosingPairs = utils.mergeArraysBy(defaultMultiLineConfig.autoClosingPairs, internalLangConfig?.autoClosingPairs, "open");
717+
langConfig.autoClosingPairs = utils.mergeArraysBy<vscode.AutoClosingPair>(
718+
defaultMultiLineConfig.autoClosingPairs,
719+
internalLangConfig?.autoClosingPairs,
720+
"open"
721+
);
718722

719723
// Add the multi-line onEnter rules to the langConfig.
720-
langConfig.onEnterRules = utils.mergeArraysBy(Rules.multilineEnterRules, internalLangConfig?.onEnterRules, "beforeText");
724+
langConfig.onEnterRules = utils.mergeArraysBy<vscode.OnEnterRule>(
725+
Rules.multilineEnterRules,
726+
internalLangConfig?.onEnterRules,
727+
"beforeText"
728+
);
721729

722730
// Only assign the default config comments if it doesn't already exist.
723731
// (nullish assignment operator ??=)
@@ -750,15 +758,15 @@ export class Configuration {
750758
if (isOnEnter && singleLineStyle) {
751759
// //-style comments
752760
if (singleLineStyle === "//") {
753-
langConfig.onEnterRules = utils.mergeArraysBy(Rules.slashEnterRules, langConfig?.onEnterRules, "beforeText");
761+
langConfig.onEnterRules = utils.mergeArraysBy<vscode.OnEnterRule>(Rules.slashEnterRules, langConfig?.onEnterRules, "beforeText");
754762
}
755763
// #-style comments
756764
else if (singleLineStyle === "#") {
757-
langConfig.onEnterRules = utils.mergeArraysBy(Rules.hashEnterRules, langConfig?.onEnterRules, "beforeText");
765+
langConfig.onEnterRules = utils.mergeArraysBy<vscode.OnEnterRule>(Rules.hashEnterRules, langConfig?.onEnterRules, "beforeText");
758766
}
759767
// ;-style comments
760768
else if (singleLineStyle === ";") {
761-
langConfig.onEnterRules = utils.mergeArraysBy(Rules.semicolonEnterRules, langConfig?.onEnterRules, "beforeText");
769+
langConfig.onEnterRules = utils.mergeArraysBy<vscode.OnEnterRule>(Rules.semicolonEnterRules, langConfig?.onEnterRules, "beforeText");
762770
}
763771
}
764772
// If isOnEnter is false AND singleLineStyle isn't false, i.e. a string.

0 commit comments

Comments
 (0)