Skip to content

Commit

Permalink
RECEIVE_SNIPPET_XML_MSG almost implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
yaad96 committed Feb 26, 2024
1 parent 0443944 commit 72792c8
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/FollowAndAuthorRulesProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,20 @@ export class FollowAndAuthorRulesProcessor {
try {
const positionString = await findLineNumber(tempXmlFilePath);
// Calculate the position based on the XML length

const positionIndex = positionString.length;

// Find the position in the document to highlight
const startPosition = document.positionAt(positionIndex);
const endPosition = new vscode.Position(startPosition.line + 1, 0);
// Find the position in the document
const charPosition = document.positionAt(positionIndex);

// Move the cursor and highlight the code
editor.selection = new vscode.Selection(startPosition,endPosition);
// Get the entire line where the character is located
const line = document.lineAt(charPosition.line);

// Use the start and end of the line for startPosition and endPosition
const startPosition = line.range.start;
const endPosition = line.range.end;

// Move the cursor and highlight the whole line
editor.selection = new vscode.Selection(startPosition, endPosition);
editor.revealRange(new vscode.Range(startPosition, endPosition), vscode.TextEditorRevealType.InCenter);
} catch (error) {
console.error("An error occurred:");
Expand Down

0 comments on commit 72792c8

Please sign in to comment.