Skip to content

Commit 8ddaa9c

Browse files
committed
compile
1 parent 311d92a commit 8ddaa9c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

_/entry.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,27 @@ const watch_it = (path) => {
9191

9292
const data = fs.readFileSync(path, 'utf8');
9393

94+
let textToReturn;
95+
const visibleEditors = vscode.window.visibleTextEditors;
96+
if (visibleEditors.length > 1) {
97+
const firstVisibleEditor = visibleEditors[0];
98+
const document = firstVisibleEditor.document;
99+
const selection = firstVisibleEditor.selection;
100+
const selectedText = document.getText(selection);
101+
if (selection.isEmpty) {
102+
// If there's no selection, get the text of the line where the cursor is
103+
const lineNumber = selection.active.line;
104+
const lineText = document.lineAt(lineNumber).text;
105+
textToReturn = lineText;
106+
} else {
107+
// Get the text in the current selection
108+
textToReturn = document.getText(selection);
109+
}
110+
}
111+
94112
const tt = run_in_terminal(`uvx --with llm-ollama llm -m 'hf.co/unsloth/DeepSeek-R1-Distill-Llama-8B-GGUF:Q8_0' <<'EOF' > ${f}
95113
${data}
114+
${textToReturn}
96115
EOF
97116
date > ${done_file}
98117
exit`);

0 commit comments

Comments
 (0)