File tree 2 files changed +17
-17
lines changed
2 files changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -2357,6 +2357,23 @@ namespace ts {
2357
2357
2358
2358
}
2359
2359
2360
+ /** Returns a token if position is in [start-of-leading-trivia, end), includes JSDoc only in JS files */
2361
+ function getNodeAtPosition ( sourceFile : SourceFile , position : number ) : Node {
2362
+ let current : Node = sourceFile ;
2363
+ const getContainingChild = ( child : Node ) => {
2364
+ if ( child . pos <= position && ( position < child . end || ( position === child . end && ( child . kind === SyntaxKind . EndOfFileToken ) ) ) ) {
2365
+ return child ;
2366
+ }
2367
+ } ;
2368
+ while ( true ) {
2369
+ const child = isSourceFileJS ( sourceFile ) && hasJSDocNodes ( current ) && forEach ( current . jsDoc , getContainingChild ) || forEachChild ( current , getContainingChild ) ;
2370
+ if ( ! child ) {
2371
+ return current ;
2372
+ }
2373
+ current = child ;
2374
+ }
2375
+ }
2376
+
2360
2377
function getLibFileFromReference ( ref : FileReference ) {
2361
2378
const libName = toFileNameLowerCase ( ref . fileName ) ;
2362
2379
const libFileName = libMap . get ( libName ) ;
Original file line number Diff line number Diff line change @@ -7119,23 +7119,6 @@ namespace ts {
7119
7119
}
7120
7120
}
7121
7121
7122
- /** Returns a token if position is in [start-of-leading-trivia, end), includes JSDoc only in JS files */
7123
- export function getNodeAtPosition ( sourceFile : SourceFile , position : number ) : Node {
7124
- let current : Node = sourceFile ;
7125
- const getContainingChild = ( child : Node ) => {
7126
- if ( child . pos <= position && ( position < child . end || ( position === child . end && ( child . kind === SyntaxKind . EndOfFileToken ) ) ) ) {
7127
- return child ;
7128
- }
7129
- } ;
7130
- while ( true ) {
7131
- const child = isSourceFileJS ( sourceFile ) && hasJSDocNodes ( current ) && forEach ( current . jsDoc , getContainingChild ) || forEachChild ( current , getContainingChild ) ;
7132
- if ( ! child ) {
7133
- return current ;
7134
- }
7135
- current = child ;
7136
- }
7137
- }
7138
-
7139
7122
export function nodeIsFirstNodeAtOrAfterPosition ( sourceFile : SourceFile , node : Node , position : number ) : boolean {
7140
7123
if ( node . pos === position ) return true ;
7141
7124
if ( node . pos < position ) return false ;
You can’t perform that action at this time.
0 commit comments