File tree 1 file changed +0
-28
lines changed
packages/cursorless-engine/src/util 1 file changed +0
-28
lines changed Original file line number Diff line number Diff line change 1
1
import { Position , Range , TextEditor } from "@cursorless/common" ;
2
- import { getLeadingWhitespace , getTrailingWhitespace } from "./regex" ;
3
2
4
3
export function isAtEndOfLine ( editor : TextEditor , position : Position ) {
5
4
const endLine = editor . document . lineAt ( position ) ;
@@ -54,30 +53,3 @@ export function strictlyContains(
54
53
: [ rangeOrPosition . start , rangeOrPosition . end ] ;
55
54
return range1 . start . isBefore ( start ) && range1 . end . isAfter ( end ) ;
56
55
}
57
-
58
- /**
59
- * Trim the given range of whitespaces
60
- * @param editor The editor to get the text from
61
- * @param range The range to trim
62
- */
63
- export function trimRange ( editor : TextEditor , range : Range ) : Range {
64
- const text = editor . document . getText ( range ) ;
65
- const leadingWhitespace = getLeadingWhitespace ( text ) ;
66
- const trailingWhitespace = getTrailingWhitespace ( text ) ;
67
-
68
- if ( leadingWhitespace === "" && trailingWhitespace === "" ) {
69
- return range ;
70
- }
71
-
72
- const startOffset =
73
- editor . document . offsetAt ( range . start ) + leadingWhitespace . length ;
74
- return new Range (
75
- editor . document . positionAt ( startOffset ) ,
76
- editor . document . positionAt (
77
- startOffset +
78
- text . length -
79
- leadingWhitespace . length -
80
- trailingWhitespace . length ,
81
- ) ,
82
- ) ;
83
- }
You can’t perform that action at this time.
0 commit comments