Skip to content

Commit

Permalink
Add word boundary to lookup for variables
Browse files Browse the repository at this point in the history
  • Loading branch information
loganch committed Sep 26, 2023
1 parent 967e115 commit 7d7820a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ai_definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ const AutoItDefinitionProvider = {
determineRegex(lookup) {
const variableRegex = /(?<![;].*)(?<!(?:#cs|#comments-start).*)((?:Local|Global|Const)\s*)?@(?:\[[\w\d\\$]+\])?\s*=?.*(?![^#]*(#ce|#comments-end))/;

if (lookup.charAt(0) === '$') {
return new RegExp(variableRegex.source.replace('@', `\\${lookup}`), 'i');
if (lookup.startsWith('$')) {
return new RegExp(variableRegex.source.replace('@', `\\${lookup}\\b`), 'i');
}
return new RegExp(
`(?<![;].*)(?<!(?:#cs|#comments-start).*)(Func\\s+)${lookup}\\s*\\((?![^#]*(#ce|#comments-end))`,
Expand Down

0 comments on commit 7d7820a

Please sign in to comment.