This repository was archived by the owner on Dec 15, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-11
lines changed
Expand file tree Collapse file tree 2 files changed +15
-11
lines changed Original file line number Diff line number Diff line change 22
33## 1.50.0 (Unreleased)
44
5+ - Run only selected text for non-empty editor selections
56- Filter crossref completions by prefix match
67
78## 1.49.0 (Release on 19 October 2022)
Original file line number Diff line number Diff line change @@ -165,19 +165,22 @@ class RunSelectionCommand extends RunCommand implements Command {
165165 _line : number ,
166166 block : Token
167167 ) {
168- // determine the selected lines
169- const selection = editor . document . getText (
170- new Range (
171- new Position ( editor . selection . start . line , 0 ) ,
172- new Position (
173- editor . selection . end . line ,
174- editor . document . lineAt ( editor . selection . end ) . text . length
168+ // if the selection is empty take the whole line, otherwise
169+ // take the selected text exactly
170+ const selection = editor . selection . isEmpty
171+ ? editor . document . getText (
172+ new Range (
173+ new Position ( editor . selection . start . line , 0 ) ,
174+ new Position (
175+ editor . selection . end . line ,
176+ editor . document . lineAt ( editor . selection . end ) . text . length
177+ )
178+ )
175179 )
176- )
177- ) ;
180+ : editor . document . getText ( editor . selection ) ;
178181
179- // for single-line selections we advance to the next line
180- if ( editor . selection . isSingleLine ) {
182+ // for empty selections we advance to the next line
183+ if ( editor . selection . isEmpty ) {
181184 const selPos = new Position ( editor . selection . start . line + 1 , 0 ) ;
182185 editor . selection = new Selection ( selPos , selPos ) ;
183186 }
You can’t perform that action at this time.
0 commit comments