From 0deb72d4b9e04612abbb00587c008d8492b39626 Mon Sep 17 00:00:00 2001 From: James Tirta Halim Date: Fri, 8 Mar 2024 12:05:26 +0700 Subject: replace regex replace with string replace --- server/src/completion.ts | 2 +- server/src/pod.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/completion.ts b/server/src/completion.ts index dded519..2ec8c67 100644 --- a/server/src/completion.ts +++ b/server/src/completion.ts @@ -151,7 +151,7 @@ function getMatches(perlDoc: PerlDocument, symbol: string, replace: Range, strip if (goodMatch(perlDoc, elemName, qualifiedSymbol, symbol, bKnownObj)) { // Hooray, it's a match! // You may have asked for FOO::BAR->BAZ or $qux->BAZ and I found FOO::BAR::BAZ. Let's put back the arrow or variable before sending - const quotedSymbol = qualifiedSymbol.replace(/([\$])/g, "\\$1"); // quotemeta for $self->FOO + const quotedSymbol = qualifiedSymbol.replaceAll("$", "\\$"); // quotemeta for $self->FOO let aligned = elemName.replace(new RegExp(`^${quotedSymbol}`, "gi"), symbol); if (symbol.endsWith("-")) aligned = aligned.replaceAll('-:', "->"); // Half-arrows count too diff --git a/server/src/pod.ts b/server/src/pod.ts index f4a9596..e9be6ab 100644 --- a/server/src/pod.ts +++ b/server/src/pod.ts @@ -470,7 +470,7 @@ const escapeHTML = (str: string): string => { if (backtickCount % 2 !== 0 || segments.length % 2 === 0) { // Handle the unbalanced backticks here - str = str.replace(/`/g, ""); + str = str.replaceAll("`", ""); } // Escape special characters and create a regex pattern -- cgit v1.2.3