Skip to content

Commit 5220469

Browse files
committed
Revert "Fix for formatting notebook cells. (microsoft#17650)"
This reverts commit 1311770.
1 parent 8be8d37 commit 5220469

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

news/2 Fixes/16980.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/client/common/editor.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,11 @@ export async function getTempFileWithDocumentContents(document: TextDocument, fs
248248
// because the language server is watching the file system for Python
249249
// file add/delete/change and we don't want this temp file to trigger it.
250250

251-
let fileName = `${document.uri.fsPath}.${md5(document.uri.fsPath + document.uri.fragment)}.tmp`;
251+
let fileName = `${document.uri.fsPath}.${md5(document.uri.fsPath)}.tmp`;
252252
try {
253253
// When dealing with untitled notebooks, there's no original physical file, hence create a temp file.
254254
if (isNotebookCell(document.uri) && !(await fs.fileExists(document.uri.fsPath))) {
255-
fileName = (
256-
await fs.createTemporaryFile(`${path.basename(document.uri.fsPath)}-${document.uri.fragment}.tmp`)
257-
).filePath;
255+
fileName = (await fs.createTemporaryFile(`${path.basename(document.uri.fsPath)}.tmp`)).filePath;
258256
}
259257
await fs.writeFile(fileName, document.getText());
260258
} catch (ex) {

src/client/providers/formatProvider.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import * as vscode from 'vscode';
55
import { ICommandManager, IDocumentManager, IWorkspaceService } from '../common/application/types';
6-
import { PYTHON_LANGUAGE } from '../common/constants';
76
import { IConfigurationService } from '../common/types';
87
import { IInterpreterService } from '../interpreter/contracts';
98
import { IServiceContainer } from '../ioc/types';
@@ -77,7 +76,7 @@ export class PythonFormattingEditProvider
7776
// Workaround is to resolve promise to nothing here, then execute format document and force new save.
7877
// However, we need to know if this is 'format document' or formatting on save.
7978

80-
if (this.saving || document.languageId !== PYTHON_LANGUAGE) {
79+
if (this.saving) {
8180
// We are saving after formatting (see onSaveDocument below)
8281
// so we do not want to format again.
8382
return [];

0 commit comments

Comments
 (0)