File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -1959,6 +1959,7 @@ module ts {
1959
1959
}
1960
1960
}
1961
1961
1962
+ /** Get the token whose text contains the position, or the containing node. */
1962
1963
function getNodeAtPosition ( sourceFile : SourceFile , position : number ) {
1963
1964
var current : Node = sourceFile ;
1964
1965
outer: while ( true ) {
@@ -1969,14 +1970,14 @@ module ts {
1969
1970
current = child ;
1970
1971
continue outer;
1971
1972
}
1972
- if ( child . end > position ) {
1973
- break ;
1974
- }
1975
1973
}
1976
1974
return current ;
1977
1975
}
1978
1976
}
1979
1977
1978
+ /** Get a token that contains the position. This is guaranteed to return a token, the position can be in the
1979
+ * leading trivia or within the token text.
1980
+ */
1980
1981
function getTokenAtPosition ( sourceFile : SourceFile , position : number ) {
1981
1982
var current : Node = sourceFile ;
1982
1983
outer: while ( true ) {
@@ -1986,10 +1987,7 @@ module ts {
1986
1987
if ( child . getFullStart ( ) <= position && position < child . getEnd ( ) ) {
1987
1988
current = child ;
1988
1989
continue outer;
1989
- }
1990
- if ( child . end > position ) {
1991
- break ;
1992
- }
1990
+ }
1993
1991
}
1994
1992
return current ;
1995
1993
}
@@ -3577,7 +3575,8 @@ module ts {
3577
3575
var token = getTokenAtPosition ( sourceFile , matchPosition ) ;
3578
3576
3579
3577
if ( token . getStart ( ) <= matchPosition && matchPosition < token . getEnd ( ) ) {
3580
- // match was within the token itself. Not in the comment. Keep searching // descriptor.
3578
+ // match was within the token itself. Not in the comment. Keep searching
3579
+ // descriptor.
3581
3580
continue ;
3582
3581
}
3583
3582
You can’t perform that action at this time.
0 commit comments