From 9dca9acd5eea17d8ec71a30a76caede22a151ca6 Mon Sep 17 00:00:00 2001
From: Shresht Srivastav <59516096+Shresht7@users.noreply.github.com>
Date: Mon, 1 Jan 2024 12:46:12 +0530
Subject: [PATCH] Move the version regex to `VersionHoverProvider`
as it makes more sense to exist there
---
src/library/bg3/Version.ts | 3 ---
src/providers/hover/version.ts | 7 +++++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/library/bg3/Version.ts b/src/library/bg3/Version.ts
index b9ca588..0883739 100644
--- a/src/library/bg3/Version.ts
+++ b/src/library/bg3/Version.ts
@@ -18,9 +18,6 @@ export class Version {
/** Build Number */
private build: number = 0;
- /** Regular expression to match the version line in `meta.lsx` */
- public static readonly lsxRegex = //;
-
/** Parse the Version number */
constructor(x: bigint);
constructor(x: string);
diff --git a/src/providers/hover/version.ts b/src/providers/hover/version.ts
index 1cc66df..f327c47 100644
--- a/src/providers/hover/version.ts
+++ b/src/providers/hover/version.ts
@@ -13,6 +13,9 @@ import { HoverProvider } from './_base';
*/
export class VersionHoverProvider extends HoverProvider {
+ /** Regular expression to match the version line in `meta.lsx` */
+ public static readonly versionRegex = //;
+
/** A selector that defines the documents this provider is applicable to */
private static readonly documentSelector = ['xml'];
@@ -26,10 +29,10 @@ export class VersionHoverProvider extends HoverProvider {
// Get the line that is currently being hovered over
const line = document.lineAt(position.line);
// Check if the line matches the version number regex
- if (!bg3.Version.lsxRegex.test(line.text)) { return; };
+ if (!VersionHoverProvider.versionRegex.test(line.text)) { return; };
// Capture the int64 version number from the line and parse as BigInt
- const capture = bg3.Version.lsxRegex.exec(line.text)?.at(1) || '0';
+ const capture = VersionHoverProvider.versionRegex.exec(line.text)?.at(1) || '0';
const bigIntVersion = BigInt(capture);
// Get the word that is being currently hovered over