Skip to content

Commit

Permalink
Merge pull request #175 from dethancosta/main
Browse files Browse the repository at this point in the history
Ignore instances of ${{ ... }} when creating a CodeLens suggestion
  • Loading branch information
jodyheavener authored May 21, 2024
2 parents 39c927b + de35691 commit 5ed6d6a
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/language-providers/code-lens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,19 @@ export const provideCodeLenses = (document: TextDocument): CodeLens[] => {
parser = new GenericParser(document);
}

return parser.getMatches().map(
({ range, fieldValue, suggestion }) =>
new CodeLens(range, {
title: "$(lock) Save in 1Password",
command: COMMANDS.SAVE_VALUE_TO_ITEM,
arguments: [[{ location: range, fieldValue, suggestion }]],
}),
);
return parser
.getMatches()
.filter(
// Ignore values within secret template variables
({ range, fieldValue, suggestion }) =>
!new RegExp(/\${{(.*?)}}/).test(fieldValue),
)
.map(
({ range, fieldValue, suggestion }) =>
new CodeLens(range, {
title: "$(lock) Save in 1Password",
command: COMMANDS.SAVE_VALUE_TO_ITEM,
arguments: [[{ location: range, fieldValue, suggestion }]],
}),
);
};

0 comments on commit 5ed6d6a

Please sign in to comment.