@@ -110,29 +110,31 @@ async function findLookupPath(): Promise<string | undefined> {
110110 ws = vscode . workspace . workspaceFolders [ 0 ] . uri . fsPath ;
111111 }
112112
113- if ( getConfiguration ( ) . useGitRoot && gitRoot === undefined ) {
114- gitRoot = await new Promise < string > ( ( resolve , reject ) =>
115- exec (
116- 'git rev-parse --show-toplevel' ,
117- { cwd : ws } ,
118- ( err , stdout , stderr ) => {
119- if ( err ) {
120- reject ( { err, stderr } ) ;
121- } else if ( stdout ) {
122- channel . appendLine ( `Found git root at: ${ stdout } ` ) ;
123- resolve ( stdout . trim ( ) ) ;
124- } else {
125- reject ( { err : 'Unable to find git root' } ) ;
113+ if ( getConfiguration ( ) . useGitRoot ) {
114+ if ( gitRoot === undefined ) {
115+ gitRoot = await new Promise < string > ( ( resolve , reject ) =>
116+ exec (
117+ 'git rev-parse --show-toplevel' ,
118+ { cwd : ws } ,
119+ ( err , stdout , stderr ) => {
120+ if ( err ) {
121+ reject ( { err, stderr } ) ;
122+ } else if ( stdout ) {
123+ channel . appendLine ( `Found git root at: ${ stdout } ` ) ;
124+ resolve ( stdout . trim ( ) ) ;
125+ } else {
126+ reject ( { err : 'Unable to find git root' } ) ;
127+ }
126128 }
129+ )
130+ ) . catch ( ( e ) => {
131+ channel . appendLine ( e . err . toString ( ) ) ;
132+ if ( e . stderr ) {
133+ channel . appendLine ( e . stderr . toString ( ) ) ;
127134 }
128- )
129- ) . catch ( ( e ) => {
130- channel . appendLine ( e . err . toString ( ) ) ;
131- if ( e . stderr ) {
132- channel . appendLine ( e . stderr . toString ( ) ) ;
133- }
134- return undefined ;
135- } ) ;
135+ return undefined ;
136+ } ) ;
137+ }
136138
137139 return gitRoot ;
138140 }
0 commit comments