Skip to content

Commit d92ceef

Browse files
committed
Add logging to hopefully elucidate more information from Windows CI
1 parent 6cea1ed commit d92ceef

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

src/client/providers/importSortProvider.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

src/test/format/extension.sort.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ suite('Sorting', () => {
107107
const textDocument = await workspace.openTextDocument(fileToFormatWithConfig);
108108
await window.showTextDocument(textDocument);
109109
const edit = (await sorter.provideDocumentSortImportsEdits(textDocument.uri))!;
110+
expect(edit).not.to.eq(undefined, 'No edit returned');
110111
expect(edit.entries()).to.be.lengthOf(1);
111112
const edits = edit.entries()[0][1];
112113
const newValue = `from third_party import lib2${EOL}from third_party import lib3${EOL}from third_party import lib4${EOL}from third_party import lib5${EOL}from third_party import lib6${EOL}from third_party import lib7${EOL}from third_party import lib8${EOL}from third_party import lib9${EOL}`;

0 commit comments

Comments
 (0)