@@ -40,18 +40,23 @@ export class SortImportsEditingProvider implements ISortImportsEditingProvider {
4040 ) : Promise < WorkspaceEdit | undefined > {
4141 const document = await this . documentManager . openTextDocument ( uri ) ;
4242 if ( ! document ) {
43+ console . log ( 'No document' ) ;
4344 return ;
4445 }
4546 if ( document . lineCount <= 1 ) {
47+ console . log ( 'No lines in document' ) ;
4648 return ;
4749 }
4850
4951 const execIsort = await this . getExecIsort ( document , uri , token ) ;
5052 if ( token && token . isCancellationRequested ) {
53+ console . log ( 'Cancellation requested' ) ;
5154 return ;
5255 }
5356 const diffPatch = await execIsort ( document . getText ( ) ) ;
5457
58+ console . log ( 'diffPath:' , diffPatch ) ;
59+
5560 return diffPatch
5661 ? this . editorUtils . getWorkspaceEditsFromPatch ( document . getText ( ) , diffPatch , document . uri )
5762 : undefined ;
@@ -125,18 +130,25 @@ export class SortImportsEditingProvider implements ISortImportsEditingProvider {
125130 cwd : path . dirname ( uri . fsPath )
126131 } ;
127132
133+ console . log ( 'uri:' , uri ) ;
134+ console . log ( 'uri.fsPath:' , uri . fsPath ) ;
135+ console . log ( 'spawnOptions:' , spawnOptions ) ;
136+ console . log ( 'spawnOptions.cwd:' , spawnOptions . cwd ) ;
137+
128138 if ( isort ) {
129139 const procService = await this . processServiceFactory . create ( document . uri ) ;
130140 // Use isort directly instead of the internal script.
131141 return async ( documentText : string ) => {
132142 const args = getIsortArgs ( filename , isortArgs ) ;
143+ console . log ( 'args:' , args ) ;
133144 const result = procService . execObservable ( isort , args , spawnOptions ) ;
134145 return this . communicateWithIsortProcess ( result , documentText ) ;
135146 } ;
136147 } else {
137148 const procService = await this . pythonExecutionFactory . create ( { resource : document . uri } ) ;
138149 return async ( documentText : string ) => {
139150 const [ args , parse ] = internalScripts . sortImports ( filename , isortArgs ) ;
151+ console . log ( 'args:' , args ) ;
140152 const result = procService . execObservable ( args , spawnOptions ) ;
141153 return parse ( await this . communicateWithIsortProcess ( result , documentText ) ) ;
142154 } ;
@@ -168,6 +180,8 @@ export class SortImportsEditingProvider implements ISortImportsEditingProvider {
168180 // .. and finally wait for isort to do its thing
169181 await isortOutput . promise ;
170182
183+ console . log ( 'Output buffer:' , outputBuffer ) ;
184+
171185 return outputBuffer ;
172186 }
173187}
0 commit comments