Skip to content

Commit

Permalink
Fix match regex expression
Browse files Browse the repository at this point in the history
  • Loading branch information
edwinhuish committed Nov 20, 2023
1 parent 3a1250d commit 8a9a80b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ jobs:
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v3
with:
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change Log

## [3.0.8] (2023-11-20)

### Bug Fixes

* Fix match regex expression.

# Change Log

## [3.0.8] (2023-10-26)

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Better Comments (with embedded languages support)",
"icon": "icon.png",
"description": "Improve your code commenting by annotating with alert, informational, TODOs, and more!",
"version": "3.0.8",
"version": "3.0.9",
"publisher": "edwinhuish",
"author": {
"name": "Edwin Xu"
Expand Down
10 changes: 5 additions & 5 deletions src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ export class Parser {
this.singleLinePicker = new RegExp(`(^)+([ \\t]*[ \\t]*)(${characters.join('|')})+(.*)`, 'igm');
} else {
// start by finding the delimiter (//, --, #, ') with optional spaces or tabs
this.singleLinePicker = new RegExp(`(${this.delimiter})+( |\t)(${characters.join('|')})+(.*)`, 'gm');
this.singleLinePicker = new RegExp(`(${this.delimiter})+([ |\t]?)(${characters.join('|')})+(.*)`, 'gm');
}

// Block expression
this.blockPickers = this.blockComments.map(mark => new RegExp(`(^|[ \\t])(${mark[0]}[\\s])+([\\s\\S]*?)(${mark[1]})`, 'gm'));
this.blockLinePicker = new RegExp(`^([ \\t]*)(${characters.join('|')})([ ]*|[:])+([^*\/][^\\r\\n]*)`, 'igm');
this.blockPickers = this.blockComments.map(mark => new RegExp(`(^|[ \\t]*)(${mark[0]}[\\s])+([\\s\\S]*?)(${mark[1]})`, 'gm'));
this.blockLinePicker = new RegExp(`([ \\t]*)(${characters.join('|')})([ ]*|[:])+([^*\/][^\\r\\n]*)`, 'igm');

// Doc expression
this.docPicker = /(^|[ \t])(\/\*\*)+([\s\S]*?)(\*\/)/gm;
this.docLinePicker = new RegExp(`(^)+([ \\t]*\\*[ \\t]*)(${characters.join('|')})([ ]*|[:])+([^*/][^\\r\\n]*)`, 'igm');
this.docPicker = /(^|[ \t]*)(\/\*\*)+([\s\S]*?)(\*\/)/gm;
this.docLinePicker = new RegExp(`(^)+([ \\t]*\\*[ \\t]?)(${characters.join('|')})([ ]*|[:])+([^*/][^\\r\\n]*)`, 'igm');
}

/**
Expand Down

0 comments on commit 8a9a80b

Please sign in to comment.