Skip to content

Commit

Permalink
fix latex-to-pretext to use line at curser if no selection
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarlevin committed Dec 16, 2023
1 parent 8f99557 commit 24f0dbf
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,6 @@ export function activate(context: vscode.ExtensionContext) {
} else {
runPretext(ptxExec, "build", qpSelection.label);
}
// Move selected target to front of list for next command.
// targetSelection = targetSelection.filter(
// (item) => item !== qpSelection
// );
// targetSelection.unshift(qpSelection);
lastTarget = qpSelection.label;
pretextCommandList[0].label = "Build " + lastTarget;
});
Expand Down Expand Up @@ -515,19 +510,11 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(
vscode.commands.registerCommand("pretext-tools.latexToPretext", () => {
const editor = vscode.window.activeTextEditor;
// const { document } = activeTextEditor;
// const firstLine = document.lineAt(0);

// if (firstLine.text !== '42') {
// const edit = new vscode.WorkspaceEdit();
// edit.insert(document.uri, firstLine.range.start, '42\n');

// return vscode.workspace.applyEdit(edit);
// }

if (editor) {
const selection = editor.selection;
const selectionRange = new vscode.Range(selection.start, selection.end);
const selectionRange = selection.isEmpty
? editor.document.lineAt(selection.start.line).range
: new vscode.Range(selection.start, selection.end);

var initialText = editor.document.getText(selectionRange);

Expand Down

0 comments on commit 24f0dbf

Please sign in to comment.