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

Show line content #46

Merged
merged 8 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions hovers/uuidsHandlesCollector.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,22 @@ function setupUuidsHandlesHoverProvider() {

const hoverText = instances.map(instance => {
const [relativePath, lineNum, lineContent] = instance.split('#');

// Extract the handle content inside the <content> tags, if any
const contentMatch = lineContent.match(/<content[^>]*>(.*?)<\/content>/);
let highlightedLineContent = contentMatch ? contentMatch[1] : '';

const openFileCommandUri = vscode.Uri.parse(`command:extension.openFileAtLine?${encodeURIComponent(JSON.stringify({ relativePath, lineNum }))}`);

let currentLine = `Content: ***${highlightedLineContent}*** \nFile: [${relativePath}](${openFileCommandUri}) \n--- \n`;
let currentLine;
const normalizedPath = relativePath.replace(/\\/g, '/').toLowerCase();
console.log(relativePath)
console.log(normalizedPath)
// Check if the file is within the Localization folder
if (normalizedPath.includes('localization/')) {
// Process as a localization-related file
const contentMatch = lineContent.match(/<content[^>]*>(.*?)<\/content>/);
let highlightedLineContent = contentMatch ? contentMatch[1] : '';
currentLine = `Loca Content: ***${highlightedLineContent}*** \nFile: [${relativePath}](${openFileCommandUri}) \n--- \n`;
} else {
let modifiedLineContent = lineContent.replace(/^<\/?|\/?>$/g, '');
let highlightedLineContent = modifiedLineContent.replace(/(id="[^"]*")/g, '**$1**');
currentLine = `Line: ${highlightedLineContent} \nFile: [**${relativePath}**](${openFileCommandUri}) \n--- \n`;
}
return currentLine;
}).join('\n');

Expand Down
2 changes: 1 addition & 1 deletion node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "bg3_mod_helper",
"publisher": "ghostboats",
"description": "This extension is designed to help you make mods in Baldur's Gate 3 by creating UUIDs and handles for you, as well as updating your .loca.xml files as well should they exist. And more to come in the future.",
"version": "2.1.32",
"version": "2.1.34",
"icon": "media/marketplace_icon.png",
"engines": {
"vscode": "^1.86.0"
Expand Down
Loading