Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to the Databricks Notebook Studio extension will be document
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.4.5] - 2026-04-02

### Fixed
- **%run and %fs magic commands no longer stripped from notebook cells**: The notebook rendering was incorrectly removing `%run` and `%fs` prefixes from cell content when the notebook change handler fired, treating them as removable magic commands instead of preserving them like `%pip`

## [0.4.4] - 2026-03-03

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "databricks-notebook-studio",
"displayName": "Databricks Notebook Studio",
"description": "Visualize Databricks .py notebooks with rich DataFrame display, interactive tables, column sorting/resizing, and multi-profile authentication",
"version": "0.4.4",
"version": "0.4.5",
"license": "MIT",
"type": "commonjs",
"publisher": "databricks-notebook-studio",
Expand Down
15 changes: 11 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,10 +534,17 @@ async function handleMagicInPythonCell(
magic: string,
languageId: string
): Promise<void> {
// %pip cells should stay as Python cells (like Jupyter) - don't convert or remove
if (magic === '%pip') {
// %pip, %run, and %fs cells should stay as Python cells - don't convert or remove the magic command.
// These are special Databricks commands that must remain visible in the cell content.
const magicTypeMap: Record<string, string> = {
'%pip': 'pip',
'%run': 'run',
'%fs': 'fs',
};
const preservedType = magicTypeMap[magic];
if (preservedType) {
// Only update metadata if not already set to avoid repeated cell replacements
if (cell.metadata?.databricksType !== 'pip') {
if (cell.metadata?.databricksType !== preservedType) {
const cellKey = cell.document.uri.toString();
// Skip if already processed
if (autoDetectedCells.has(cellKey)) {
Expand All @@ -549,7 +556,7 @@ async function handleMagicInPythonCell(
languageId: 'python',
metadata: {
...c.metadata,
databricksType: 'pip',
databricksType: preservedType,
},
}), {
enterEditMode: true,
Expand Down
Loading