Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: correct cell separator detection for magic commands
This commit corrects the cell separator detection that was broken in the previous commit. The previous commit allowed lines starting with "# %%" followed by additional comments to be treated as cell separators. However, this broke the functionality for magic commands like "# %%timeit", which should not be treated as cell separators. The fix involves checking whether there is a space after "# %%" before treating it as a cell separator. This is done by changing the line separator check in Lua files to `vim.fn.trim(string.sub(line, 1, 5)) == "# %%"`. Additionally, it was discovered that `line.startswith("# %%")` in Python files also misidentified magic commands as cell separators when syncing to Jupyter. Therefore, this has been corrected to `line[:5].strip() == "# %%"`. This change ensures that magic commands are correctly recognized and not treated as cell separators.
- Loading branch information