summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Tirta Halim <tirtajames45@gmail.com>2024-03-08 12:05:26 +0700
committerJames Tirta Halim <tirtajames45@gmail.com>2024-03-08 12:05:26 +0700
commit0deb72d4b9e04612abbb00587c008d8492b39626 (patch)
tree73ac340647328a51e262094a76c73542adcaef0b
parent1f3e38e74277f1f95b6a4a10012a71eb9826b109 (diff)
downloadPerlNavigator-0deb72d4b9e04612abbb00587c008d8492b39626.zip
replace regex replace with string replace
-rw-r--r--server/src/completion.ts2
-rw-r--r--server/src/pod.ts2
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