diff --git a/news/3 Code Health/8485.md b/news/3 Code Health/8485.md new file mode 100644 index 00000000000..b7e871e935f --- /dev/null +++ b/news/3 Code Health/8485.md @@ -0,0 +1 @@ +Remove `jupyter.runMagicCommands` (which has been deprecared for over a year) in favor of `runStartupCommands`. diff --git a/src/client/common/configSettings.ts b/src/client/common/configSettings.ts index b0c75f532df..4b89348d226 100644 --- a/src/client/common/configSettings.ts +++ b/src/client/common/configSettings.ts @@ -79,7 +79,6 @@ export class JupyterSettings implements IWatchableJupyterSettings { public remoteDebuggerPort: number = 0; public colorizeInputBox: boolean = false; public addGotoCodeLenses: boolean = false; - public runMagicCommands: string = ''; public runStartupCommands: string | string[] = []; public debugJustMyCode: boolean = false; public defaultCellMarker: string = ''; diff --git a/src/client/common/types.ts b/src/client/common/types.ts index d9527e40167..f81d6d6c81e 100644 --- a/src/client/common/types.ts +++ b/src/client/common/types.ts @@ -162,7 +162,6 @@ export interface IJupyterSettings { readonly remoteDebuggerPort: number; readonly colorizeInputBox: boolean; readonly addGotoCodeLenses: boolean; - readonly runMagicCommands: string; readonly runStartupCommands: string | string[]; readonly debugJustMyCode: boolean; readonly defaultCellMarker: string; diff --git a/src/client/datascience/jupyter/kernels/kernel.ts b/src/client/datascience/jupyter/kernels/kernel.ts index 71b9d5f630a..18a1bf27b2b 100644 --- a/src/client/datascience/jupyter/kernels/kernel.ts +++ b/src/client/datascience/jupyter/kernels/kernel.ts @@ -771,7 +771,7 @@ export class Kernel implements IKernel { private async runStartupCommands() { const settings = this.configService.getSettings(this.resourceUri); // Run any startup commands that we specified. Support the old form too - let setting = settings.runStartupCommands || settings.runMagicCommands; + let setting = settings.runStartupCommands; // Convert to string in case we get an array of startup commands. if (Array.isArray(setting)) { diff --git a/src/client/datascience/notebook/intellisense/intellisenseProvider.ts b/src/client/datascience/notebook/intellisense/intellisenseProvider.ts index c73cf62f790..add9476f7e1 100644 --- a/src/client/datascience/notebook/intellisense/intellisenseProvider.ts +++ b/src/client/datascience/notebook/intellisense/intellisenseProvider.ts @@ -176,7 +176,7 @@ export class IntellisenseProvider implements INotebookLanguageClientProvider, IE private getNotebookHeader(uri: Uri) { const settings = this.configService.getSettings(uri); // Run any startup commands that we specified. Support the old form too - let setting = settings.runStartupCommands || settings.runMagicCommands; + let setting = settings.runStartupCommands; // Convert to string in case we get an array of startup commands. if (Array.isArray(setting)) { diff --git a/src/test/activation/migrateDataScienceSettingsService.unit.test.ts b/src/test/activation/migrateDataScienceSettingsService.unit.test.ts index f915e94eaf2..56f94e060a4 100644 --- a/src/test/activation/migrateDataScienceSettingsService.unit.test.ts +++ b/src/test/activation/migrateDataScienceSettingsService.unit.test.ts @@ -61,7 +61,6 @@ suite('Migrate data science settings', () => { "python.dataScience.remoteDebuggerPort": 0, "python.dataScience.colorizeInputBox": true, "python.dataScience.addGotoCodeLenses": true, - "python.dataScience.runMagicCommands": "foo", "python.dataScience.runStartupCommands": ["foo", "bar"], "python.dataScience.debugJustMyCode": true, "python.dataScience.defaultCellMarker": "foo", @@ -125,7 +124,6 @@ suite('Migrate data science settings', () => { "jupyter.remoteDebuggerPort": 0, "jupyter.colorizeInputBox": true, "jupyter.addGotoCodeLenses": true, - "jupyter.runMagicCommands": "foo", "jupyter.runStartupCommands": [ "foo", "bar" diff --git a/src/test/datascience/interactiveWindow.vscode.test.ts b/src/test/datascience/interactiveWindow.vscode.test.ts index bb74c8e266b..d7e0b489ae6 100644 --- a/src/test/datascience/interactiveWindow.vscode.test.ts +++ b/src/test/datascience/interactiveWindow.vscode.test.ts @@ -22,7 +22,6 @@ import { waitForLastCellToComplete } from './helpers'; import { - assertNotHasTextOutputInVSCode, clickOKForRestartPrompt, closeNotebooksAndCleanUpAfterTests, defaultNotebookTestTimeout, @@ -369,32 +368,6 @@ ${actualCode} assert.equal(actualCellText, actualCode); }); - async function runMagicCommandsTest(settingValue: boolean) { - const settings = vscode.workspace.getConfiguration('jupyter', null); - await settings.update('magicCommandsAsComments', settingValue); - const code = `# %% -#!%%time -print('hi')`; - const { activeInteractiveWindow } = await submitFromPythonFile(interactiveWindowProvider, code, disposables); - const lastCell = await waitForLastCellToComplete(activeInteractiveWindow); - await waitForTextOutput(lastCell, 'hi', undefined, false); - return lastCell; - } - - test('jupyter.magicCommandsAsComments: `true`', async () => { - const lastCell = await runMagicCommandsTest(true); - await waitForTextOutput(lastCell, 'Wall time:', undefined, false); - }); - - test('jupyter.magicCommandsAsComments: `false`', async () => { - const lastCell = await runMagicCommandsTest(false); - - // Magic should have remained commented - for (let outputIndex = 0; outputIndex < lastCell.outputs.length; outputIndex++) { - assertNotHasTextOutputInVSCode(lastCell, 'Wall time:', outputIndex, false); - } - }); - // todo@joyceerhl // test('Verify CWD', () => { }); // test('Multiple executes go to last active window', async () => { });