注:后来开发过一个 Send To Terminal ,个人认为将更加适用多场景。
(示例中,设置了用户快捷键 ctrl+enter
作为命令 ipython.sendSelectedToIPython
的启动。)
鸣谢:
- 首先特别鸣谢开源的原始开发者及其贡献项目(pancho111203 / vscode-ipython);原作链接:IPython for VSCode - Visual Studio Marketplace
- 因写关于 Python 代码的 markdown 文档需要,特此修改插件以便个性化使用。
功能简介:
- 将活动窗口的文本发送到
ipython
运行,可以配合markdown快速书写python文档。
个性化修改:
- 设置可选:在
ipython
运行代码后,是否设置直接返回聚焦于文档的编辑窗口。 - 设置可选:运行时在
ipython
初始化中是否自动加载进入到编辑文件所在文件夹去运行(可方便读取不同级文件夹文件)。 - 设置可选:是否通过使用
ipython
的命令%load -r
直接将选择内容相关发送至ipython
终端,否则仅发送选择文本内容。 - 设置可选:发送前可以选择是否自动保存,此选项配合
ipython
语法load
的使用。 - 设置可选:发送后是否让光标自动切换到下一行,方便更为快捷
文件
-->终端
的交互。
当前它包括两个命令:
ipython.sendFileContentsToIPython
: 会将完整的文件内容发送到打开的ipython实例中(如果没有打开,则发送一个新的实例)ipython.sendSelectedToIPython
: 将选定的行或光标所在的行发送到打开的ipython实例(如果没有打开,则发送新的行)
限制:
- 只有一个ipython实例可以工作,不能同时有多个。因此特别需要注意,在切换文件使用时,对于环境变量的控制。
修复BUG
- 修复更新 vscode
January 2021 (version 1.53)
后无法正常使用的BUG。
功能优化
- 选中状态下,不自动跳转下一行。
BUG修复
- 更新功能选项的说明及README文档。
- 修复
ipython
命令# %load
后,会多进行一行换行的BUG。
功能新增
- 增加可选选项,发送前可以选择自动保存,以配合ipython语法
load
的使用。 - 增加可选选项,发送后光标自动切换到下一行,方便更为快捷的交互。
界面及描述优化
- 使用方法的动画制作
- 更新文字语言描述
- 更新及美化图标
BUG 修复
- 修复了有关末尾输入
\n
时终端无法自动执行的问题。
BUG 修复
- 修复输入ipython后因加载超时不运行的问题。
功能新增
- 设置可选设置:是否使用ipython从文件读取行的命令
%load -r
直接将选择内容相关直接发送至ipython终端,否则直接发送选择内容。
功能新增
- 设置可选设置:运行后可以设置直接返回文档编辑窗口
- 设置可选设置:可直接将选择内容直接发送至ipython终端
(In the example, the user shortcut key ctrl+enter
is set as the start of the command ipython.sendSelectedToIPython
.)
Thanks:
- First of all, special thanks to the original open source developers and their contributions (pancho111203 / vscode-ipython); original link: [IPython for VSCode-Visual Studio Marketplace] (https://marketplace.visualstudio.com/items?itemName=pancho111203.vscode-ipython)
- Due to the need to write markdown documents about Python code, the plugin is hereby modified for personalized use.
Function introduction:
- Send the text of the active window to
ipython
to run, and you can quickly write python documents with markdown.
Personalized modification:
- Optional setting: whether to set to directly return to the editing window focused on the document after running the code in
ipython
. - Optional setting: whether to automatically load into the folder where the edited file is located during the initialization of
ipython
during runtime to run (it is convenient to read files in different folders). - Optional setting: Whether to directly send the selected content to the terminal of
ipython
by using the command%load -r
ofipython
, otherwise only the selected text content will be sent. - Optional setting: You can choose whether to save automatically before sending. This option is used with the
ipython
syntaxload
. - Optional setting: Whether to make the cursor automatically switch to the next line after sending, which is convenient and quicker to interact with
File
-->Terminal
.
Currently it includes two commands:
ipython.sendFileContentsToIPython
: will send the complete file content to the opened ipython instance (if not opened, send a new instance)ipython.sendSelectedToIPython
: Send the selected line or the line where the cursor is located to the opened ipython instance (if it is not open, then send a new line)
Limit:
- Only one ipython instance can work, not multiple instances at the same time. Therefore, special attention should be paid to the control of environment variables when switching files.
Fix BUG
- Fix the bug that vscode cannot be used normally after updating vscode
January 2021 (version 1.53)
.
Function optimization
- When selected, do not automatically jump to the next line.
BUG fix
- Update the description of the function options and the README document.
- Fix the bug that after the
ipython
command# %load
, there will be one more line wrap.
New features
- Add optional options, you can choose to automatically save before sending to match the use of ipython syntax
load
. - Add optional options, the cursor will automatically switch to the next line after sending, which is convenient and faster for interaction.
Interface and description optimization
- How to use animation
- Update text language description
- Update and beautify icons
BUG fix
- Fixed the problem that the terminal cannot be executed automatically when
\n
is entered at the end.
BUG fix
- Fix the problem that ipython does not run due to loading timeout after inputting ipython.
New features
- Set optional settings: whether to use the command
%load -r
to read lines from the file using ipython to directly send the selected content directly to the ipython terminal, otherwise directly send the selected content.
New features
- Set optional settings: After running, you can set and directly return to the document editing window
- Set optional settings: you can send the selected content directly to the ipython terminal