Skip to content

Commit 96d02b1

Browse files
committed
Setting focus on cursor
1 parent f4fe3b9 commit 96d02b1

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

extension.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,10 @@ try {
164164
data: { focusEditor },
165165
} = data;
166166

167-
handleFocusEditor({ uri: focusEditor });
167+
handleFocusEditor({
168+
uri: focusEditor.documentPath,
169+
userPosition: focusEditor.selections,
170+
});
168171
},
169172
error: (error) =>
170173
console.log(`received error in focusEditorSubscriber ${error}`),

utils/handleFocusEditor.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,12 @@ const handleFocusEditor = async ({ uri, userPosition }) => {
66

77
const editor = await vscode.window.showTextDocument(editorPath);
88

9-
const teastPos = {
10-
startLine: 100,
11-
endLine: 102,
12-
startCharacter: 2,
13-
endCharacter: 5,
14-
};
15-
169
const range = new vscode.Range(
17-
new vscode.Position(userPosition.startLine, userPosition.startCharacter),
18-
new vscode.Position(userPosition.endLine, userPosition.endCharacter)
10+
new vscode.Position(
11+
userPosition.start.line,
12+
userPosition.start.character
13+
),
14+
new vscode.Position(userPosition.end.line, userPosition.end.character)
1915
);
2016

2117
editor.revealRange(range, 1);

0 commit comments

Comments
 (0)