Skip to content

Commit

Permalink
Use new RegExp instead of RegExp.
Browse files Browse the repository at this point in the history
  • Loading branch information
tamuratak committed Sep 9, 2023
1 parent 3335c7b commit 92491cf
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/compilerloglib/biblogparser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class BibLogParser {
const configuration = vscode.workspace.getConfiguration('latex-toybox')
let excludeRegexp: RegExp[]
try {
excludeRegexp = (configuration.get('message.bibtexlog.exclude') as string[]).map(regexp => RegExp(regexp))
excludeRegexp = (configuration.get('message.bibtexlog.exclude') as string[]).map(regexp => new RegExp(regexp))
} catch (e) {
if (e instanceof Error) {
this.extension.logger.info(`latex-toybox.message.bibtexlog.exclude is invalid: ${e.message}`)
Expand Down
2 changes: 1 addition & 1 deletion src/components/compilerloglib/latexlogparser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class LatexLogParser {
const configuration = vscode.workspace.getConfiguration('latex-toybox')
let excludeRegexp: RegExp[]
try {
excludeRegexp = (configuration.get('message.latexlog.exclude') as string[]).map(regexp => RegExp(regexp))
excludeRegexp = (configuration.get('message.latexlog.exclude') as string[]).map(regexp => new RegExp(regexp))
} catch (e) {
if (e instanceof Error) {
this.extension.logger.info(`latex-toybox.message.latexlog.exclude is invalid: ${e.message}`)
Expand Down
2 changes: 1 addition & 1 deletion src/providers/folding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class FoldingProvider implements vscode.FoldingRangeProvider {

private createSectionRegex() {
const sections = vscode.workspace.getConfiguration('latex-toybox').get<string[]>('view.outline.sections', [])
return sections.map(section => RegExp(`\\\\(?:${section})(?:\\*)?(?:\\[[^\\[\\]\\{\\}]*\\])?{(.*)}`, 'm'))
return sections.map(section => new RegExp(`\\\\(?:${section})(?:\\*)?(?:\\[[^\\[\\]\\{\\}]*\\])?{(.*)}`, 'm'))
}

public provideFoldingRanges(document: vscode.TextDocument): vscode.FoldingRange[] {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function stripComments(text: string): string {
export function stripEnvironments(text: string, envs: string[]): string {
const envsAlt = envs.join('|')
const pattern = `\\\\begin{(${envsAlt})}.*?\\\\end{\\1}`
const reg = RegExp(pattern, 'gms')
const reg = new RegExp(pattern, 'gms')
return text.replace(reg, (match, ..._args) => {
const len = Math.max(match.split('\n').length, 1)
return '\n'.repeat(len - 1)
Expand Down

0 comments on commit 92491cf

Please sign in to comment.