File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -91,8 +91,27 @@ const watch_it = (path) => {
91
91
92
92
const data = fs . readFileSync ( path , 'utf8' ) ;
93
93
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
+
94
112
const tt = run_in_terminal ( `uvx --with llm-ollama llm -m 'hf.co/unsloth/DeepSeek-R1-Distill-Llama-8B-GGUF:Q8_0' <<'EOF' > ${ f }
95
113
${ data }
114
+ ${ textToReturn }
96
115
EOF
97
116
date > ${ done_file }
98
117
exit` ) ;
You can’t perform that action at this time.
0 commit comments