Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f806674
Use correct python executable when running code using Python executio…
Oct 4, 2021
31042a4
pin to debugpy verion 1.4.3
karthiknadig Oct 4, 2021
b16f7fe
Pin debugpy (#17619)
karthiknadig Oct 4, 2021
ebdb4d0
Ensure database storage extension uses to track all storages does not…
Oct 4, 2021
422f3c3
Fix handling of empty directories in debugpy wheels when combining th…
Oct 4, 2021
aaa3d63
Update news items for cherry picked. (#17624)
karthiknadig Oct 5, 2021
39d250a
Pin wrapt to 1.12.1 (#17630) (#17631)
karthiknadig Oct 5, 2021
d3abb97
Use conda-forge when installing into conda envs (#17629) (#17632)
DonJayamanne Oct 5, 2021
6258ca2
Ensure keys whose default value type is an array are not duplicated (…
Oct 5, 2021
100f87e
Update version and changelog for release (#17647)
karthiknadig Oct 6, 2021
eb2e2b9
Update release date in change log
karthiknadig Oct 7, 2021
6ba6949
Add thanks to change log.
karthiknadig Oct 7, 2021
1997e8a
Fix for formatting notebook cells. (#17650)
karthiknadig Oct 8, 2021
86fffbc
Hide walkthrough if on the web (#17638)
luabud Oct 8, 2021
d83f19c
Log commands run by the discovery component in the output channel (#1…
Oct 11, 2021
ab0a72a
Ensure commands run are not logged twice in Python output channel (#1…
Oct 11, 2021
18f9dbb
Hide UI elements that are not applicable when using `github.dev` (#17…
Oct 11, 2021
2153e7d
Localize strings on `github.dev` using VSCode FS API (#17711)
Oct 13, 2021
f09c985
Provide IntelliSense status information when using `github.dev` (#17658)
Oct 13, 2021
9128f87
Localize 'learn more' text (#17714)
Oct 13, 2021
ca2b5a4
Update version and change log for point release (#17717)
karthiknadig Oct 13, 2021
ab53e12
Merge release-2021.10 into main
karthiknadig Oct 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix for formatting notebook cells. (#17650)
* Fix for formatting notebook cells.

* Ensure we check language id.
  • Loading branch information
karthiknadig committed Oct 13, 2021
commit 1997e8aacfb835f402a40e83f36e34280075c3a0
1 change: 1 addition & 0 deletions news/2 Fixes/16980.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ensure we use fragment when formatting notebook cells.
6 changes: 4 additions & 2 deletions src/client/common/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,13 @@ export async function getTempFileWithDocumentContents(document: TextDocument, fs
// because the language server is watching the file system for Python
// file add/delete/change and we don't want this temp file to trigger it.

let fileName = `${document.uri.fsPath}.${md5(document.uri.fsPath)}.tmp`;
let fileName = `${document.uri.fsPath}.${md5(document.uri.fsPath + document.uri.fragment)}.tmp`;
try {
// When dealing with untitled notebooks, there's no original physical file, hence create a temp file.
if (isNotebookCell(document.uri) && !(await fs.fileExists(document.uri.fsPath))) {
fileName = (await fs.createTemporaryFile(`${path.basename(document.uri.fsPath)}.tmp`)).filePath;
fileName = (
await fs.createTemporaryFile(`${path.basename(document.uri.fsPath)}-${document.uri.fragment}.tmp`)
).filePath;
}
await fs.writeFile(fileName, document.getText());
} catch (ex) {
Expand Down
3 changes: 2 additions & 1 deletion src/client/providers/formatProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

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

if (this.saving) {
if (this.saving || document.languageId !== PYTHON_LANGUAGE) {
// We are saving after formatting (see onSaveDocument below)
// so we do not want to format again.
return [];
Expand Down