简体   繁体   English

如何在 Visual Studio Code 中为每个 python 单元格边界显示一行?

[英]How to display a line for every python cell boundary in Visual Studio Code?

In VS Code, when working with python files, if we type #%% it creates a cell separation.在 VS Code 中,当使用 python 文件时,如果我们输入#%%它会创建一个单元格分隔。 When the cursor is within a cell, the editor displays a thick line for the top boundary and a thin line for the bottom boundary (of the current cell only).当 cursor 位于单元格内时,编辑器会为上边界显示一条粗线,为下边界显示一条细线(仅限当前单元格)。 How can I change the style so that a line is always displayed for every cell boundary (like in the Spyder editor)?如何更改样式以便始终为每个单元格边界显示一条线(例如在 Spyder 编辑器中)?

Edit: I found these settings but they only apply to the interactive window and not the editor:编辑:我找到了这些设置,但它们仅适用于交互式 window 而不是编辑器:

    "workbench.colorCustomizations": {
        "notebook.cellBorderColor": "#ff0000",
        "notebook.cellToolbarSeparator": "#00ff00"
    }

I am expecting to find a way of showing lines at the red arrows below:我期待找到一种在下面的红色箭头处显示线条的方法: 缺少 Python 单元格分隔线

I have seen screenshots showing such lines but I can't find how.我已经看到显示这些线条的屏幕截图,但我找不到如何。

Edit 2: Is there a way to customize the style/appearance of every inserted line showing the clickable commands Run Cell | Run Above | Debug Cell编辑 2:有没有办法自定义每个插入的行的样式/外观,显示可点击的命令Run Cell | Run Above | Debug Cell Run Cell | Run Above | Debug Cell Run Cell | Run Above | Debug Cell ? Run Cell | Run Above | Debug Cell

Jupyter is a good choice for you which has separate code cells. Jupyter对您来说是一个不错的选择,它具有单独的代码单元。

Create jupyter notebook from command palette then install required module ipykernal , you can run python code cell in it.从命令面板创建 jupyter notebook 然后安装所需的模块ipykernal ,您可以在其中运行 python 代码单元。 Reference: Jupyter Notebook in VS Code.参考: VS Code 中的 Jupyter Notebook。

take a look at this: extension-visualstudio看看这个: extension-visualstudio

maybe we need to checkout [vscode-python] ( https://github.com/microsoft/vscode-python ): package.nls.json stores a lot of dicts, but i can't find Run Cell |也许我们需要检查 [vscode-python] ( https://github.com/microsoft/vscode-python ): package.nls.json 存储了很多 dicts,但我找不到 Run Cell | Run Above |跑到上面| Debug Cell too..调试单元也是..

As a possible hack, you can extend the cell commands.作为一种可能的技巧,您可以扩展单元格命令。 The setting for that is called "Jupyter: Code Lenses".其设置称为“Jupyter:Code Lenses”。 I set mine to: "jupyter.runcell, jupyter.runallcellsabove, jupyter.debugcell, jupyter.runcell, jupyter.runcell, jupyter.runcell, jupyter.runcell, jupyter.runcell, jupyter.runcell, jupyter.runcell, jupyter.runcell, jupyter.runcell, jupyter.runcell, jupyter.runcell, jupyter.runcell, jupyter.runcell, jupyter.runcell, jupyter.runcell"我将我的设置为:“jupyter.runcell,jupyter.runallcellsabove,jupyter.debugcell,jupyter.runcell,jupyter.runcell,jupyter.runcell,jupyter.runcell,jupyter.runcell,jupyter.runcell,jupyter.runcell,jupyter.runcell, jupyter.runcell、jupyter.runcell、jupyter.runcell、jupyter.runcell、jupyter.runcell、jupyter.runcell、jupyter.runcell"

long cell command list to mimic a cell border模拟单元格边界的长单元格命令列表

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 每次都会下载Visual Studio代码python语言服务器吗? - Visual studio code python language server is downloaded every time? 在Visual Studio Code上调试Python时,如何更改当前行? - How do I change the current line when debugging Python on Visual Studio Code? 如何使用命令行在 Visual Studio Code 中为 python 设置虚拟环境 - How to setup a virtual environment for python in Visual Studio Code using the command line 如何在 Visual Studio 中运行单行 python 代码并在终端中获取 output? - How to run a single line of python code in Visual Studio an get the output in Terminal? Visual Studio代码上的Python 3 - Python 3 on visual studio code python visual studio代码 - python visual studio code 使用 Python 在 Visual Studio Code 中显示日语字符 - Display Japanese characters in Visual Studio Code using Python Python 3:读取一行时的 EOF(Visual Studio 代码) - Python 3: EOF when reading a line (Visual Studio Code) 尝试在 Visual Studio 代码中访问命令行 arguments - Python - Trying to access command line arguments in Visual Studio Code - Python 如何获取 Python 脚本以在 Adobe Illustrator 和 Visual Studio Code 中绘制简单的线条 - How do I get Python Script to draw a simple line in Adobe Illustrator and Visual Studio Code
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM