Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create LocalizationHoverProvider #35

Merged
merged 34 commits into from Jan 2, 2024
Merged

Create LocalizationHoverProvider #35

merged 34 commits into from Jan 2, 2024

Conversation

Shresht7
Copy link
Owner

Register a hover provider for localization handles in localization (XML) files that show the content associated with the handle.

Fixes #28

@Shresht7 Shresht7 self-assigned this Dec 31, 2023
@Shresht7 Shresht7 added the enhancement New feature or request label Dec 31, 2023
@Shresht7 Shresht7 added this to the v0.1.0 milestone Dec 31, 2023
@Shresht7 Shresht7 marked this pull request as draft December 31, 2023 13:40
@Shresht7
Copy link
Owner Author

Right now, the localization references are built once (when the extension activates). To keep the references up to date, a file-system watcher can be used to update, rebuild and remove localization handler references as needed.

here's a quick draft sketch of what it would look like:

const localizationXMLFileWatcher = vscode.workspace.createFileSystemWatcher("**/Localization/**/*.xml");

localizationXMLFileWatcher.onDidCreate(e => {
	vscode.window.showInformationMessage(`CREATE: ${e.fsPath.split("\\").at(-1)}`);
	buildLocalizationReference();
});

localizationXMLFileWatcher.onDidChange(e => {
	vscode.window.showInformationMessage(`CHANGE: ${e.fsPath.split("\\").at(-1)}`);
	buildLocalizationReference();
});

localizationXMLFileWatcher.onDidDelete(e => {
	vscode.window.showInformationMessage(`DELETE: ${e.fsPath.split("\\").at(-1)}`);
	removeLocalizationReference();
});

@Shresht7
Copy link
Owner Author

It's starting to take shape.

Considering each localization xml contributes its own handles and content, it may be prudent to register separate hover providers for each file (and dispose them off if they're deleted). This will isolate the reference map objects.

That said, how often do I expect the localization files to be removed? for this to even be a issue. Even then a simple reload the editor will "fix" the problem.

@Shresht7
Copy link
Owner Author

Shresht7 commented Jan 1, 2024

Because of 9dca9ac, bumpVersionNumber command now fails as it cannot find the lsx version regex. I can point it to the VersionHoverProvider but this will need a proper solution eventually.

* Start Consolidating `meta.lsx` logic

* Consolidate metadata into `metaLsx` class

* Move find back into the class

* Remove unnecessary constructor overload

* Refactor MetaLsx class to parse dependencies and module information from meta.lsx file

* Refactor version number handling in bumpVersionNumber function

* Refactor `MetaLsx` class to `update` and `save` module information

* Refactor version number bumping logic

* Update comments

* Add error handling to `bumpVersionNumber`

* Refactor `convertVersionNumber`

* Add error handling to `copyModUUID`

* Add comments

* Update default options

* Remove `versionRegex` as it is no longer needed here

* Add `cSpell` workspace settings

* Refactor `MetaLsx` class
@Shresht7 Shresht7 marked this pull request as ready for review January 2, 2024 13:20
@Shresht7 Shresht7 merged commit a1675a7 into main Jan 2, 2024
@Shresht7 Shresht7 deleted the hover branch January 2, 2024 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Register hover provider for localization text and handles
1 participant