Skip to content

Commit

Permalink
Merge pull request #12 from Zuoqiu-Yingyi/dev
Browse files Browse the repository at this point in the history
chore: release v0.2.0
  • Loading branch information
Zuoqiu-Yingyi committed Sep 18, 2023
2 parents 319df86 + 93bd42f commit 12d8767
Show file tree
Hide file tree
Showing 21 changed files with 1,024 additions and 147 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ permissions:

env:
PACKAGE_NAME: jupyter-client
PACKAGE_VERSION: 0.1.2
PACKAGE_VERSION: 0.2.0

jobs:
release-please:
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jupyter-client",
"private": true,
"version": "0.1.2",
"version": "0.2.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -13,8 +13,10 @@
"check": "svelte-check --tsconfig ./tsconfig.json"
},
"devDependencies": {
"@jupyterlab/services": "^7.0.5",
"@sveltejs/vite-plugin-svelte": "^2.4.5",
"@jupyter-lsp/theme-vscode": "3.0.0-rc.0",
"@jupyterlab/services": "^7.0.6",
"@jupyterlab/ui-components": "^4.0.6",
"@sveltejs/vite-plugin-svelte": "^2.4.6",
"@tsconfig/svelte": "^5.0.2",
"less": "^4.2.0",
"strip-ansi": "^7.1.0",
Expand All @@ -24,7 +26,7 @@
"tslib": "^2.6.2",
"typescript": "^5.2.2",
"vite": "^4.4.9",
"xterm": "^5.2.1",
"xterm": "^5.3.0",
"xterm-addon-fit": "^0.7.0"
},
"dependencies": {
Expand Down
20 changes: 20 additions & 0 deletions public/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,15 @@ This is a plugin for [SiYuan Note](https://github.com/siyuan-note/siyuan) that c

* The code cannot be executed until the document is connected to a session (see the *Session Management* section for details)

#### Language Services

* Contextual help

* The <kbd>Jupyter Contextual Help</kbd> side panel displays contextual information about the current code.
* Code suggestions and completion

* When editing in code cells, suggestions for the current code are displayed, and selecting one will complete the code.

#### Import `*.ipynb` Files

* Calling method
Expand All @@ -272,6 +281,17 @@ This is a plugin for [SiYuan Note](https://github.com/siyuan-note/siyuan) that c

* When enabled, this plugin will attempt to connect to the Jupyter service
* When disabled, all sessions created by this plugin will be interrupted and disconnected from the Jupyter service
* `Language service call delay`

* The delay time when calling Jupyter kernel language service to retrieve <kbd>contextual help</kbd> and <kbd>code suggestions</kbd>.
* Unit: milliseconds
* After entering text in a code cell, there is a certain delay before calling the Jupyter kernel language service.

* The language service requires support from the corresponding Jupyter kernel session.
* Currently supported language services:

* Retrieve and update the content of the <kbd>Jupyter contextual help</kbd> sidebar.
* Display code suggestion list.
* Server settings

* `Jupyter Server URL`
Expand Down
20 changes: 20 additions & 0 deletions public/README_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,15 @@

* 必须将文档与一个会话建立连接后才能运行代码 (详情请参考 *会话管理* 一节)

#### 语言服务

* 上下文帮助

* 在 <kbd>Jupyter 上下文帮助</kbd> 侧边面板显示当前代码的上下文信息
* 代码建议与补全

* 在代码单元格中进行编辑时显示当前代码的输入建议, 选择后可补全代码

#### 导入 `*.ipynb` 文件

* 调用方式
Expand All @@ -272,6 +281,17 @@

* 开启后将本插件将尝试与 Jupyter 服务建立连接
* 关闭后将中断所有本插件建立的会话并断开与 Jupyter 服务的连接
* `语言服务调用延时`

* 调用 Jupyter 内核语言服务获取<kbd>上下文帮助</kbd>与<kbd>代码建议</kbd>时的延时时间
* 单位:毫秒
* 在代码单元格中输入文本后经过一定延时后再调用 Jupyter 内核语言服务

* 语言服务需要会话对应的 Jupyter 内核支持
* 目前支持的语言服务

* 获取并更新 <kbd>Jupyter 上下文帮助</kbd> 侧边栏的内容
* 显示代码建议列表
* 服务设置

* `Jupyter 服务 URL`
Expand Down
7 changes: 7 additions & 0 deletions public/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
},
"title": "Jupyter"
},
"inspectDock": {
"title": "Jupyter Contextual Help"
},
"menu": {
"import": {
"accelerator": "*.ipynb",
Expand Down Expand Up @@ -198,6 +201,10 @@
"description": "Enable to attempt to establish connection with Jupyter service",
"title": "Enable Jupyter client"
},
"delay": {
"description": "The delay time when calling the Jupyter kernel language service to get context help and code suggestions.<br/>Unit: milliseconds",
"title": "Language service call delay"
},
"title": "Global"
},
"importTab": {
Expand Down
7 changes: 7 additions & 0 deletions public/i18n/zh_CHT.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
},
"title": "Jupyter"
},
"inspectDock": {
"title": "Jupyter 上下文幫助"
},
"menu": {
"import": {
"accelerator": "*.ipynb",
Expand Down Expand Up @@ -198,6 +201,10 @@
"description": "開啟後將嘗試與 Jupyter 服務建立連接",
"title": "啟用 Jupyter 客戶端"
},
"delay": {
"description": "調用 Jupyter 內核語言服務獲取上下文幫助與代碼建議時的延時時間<br/>單位:毫秒",
"title": "語言服務調用延時"
},
"title": "全局"
},
"importTab": {
Expand Down
7 changes: 7 additions & 0 deletions public/i18n/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
},
"title": "Jupyter"
},
"inspectDock": {
"title": "Jupyter 上下文帮助"
},
"menu": {
"import": {
"accelerator": "*.ipynb",
Expand Down Expand Up @@ -198,6 +201,10 @@
"description": "开启后将尝试与 Jupyter 服务建立连接",
"title": "启用 Jupyter 客户端"
},
"delay": {
"description": "调用 Jupyter 内核语言服务获取上下文帮助与代码建议时的延时时间<br/>单位:毫秒",
"title": "语言服务调用延时"
},
"title": "全局"
},
"importTab": {
Expand Down
2 changes: 1 addition & 1 deletion public/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "jupyter-client",
"author": "Zuoqiu Yingyi",
"url": "https://github.com/Zuoqiu-Yingyi/siyuan-plugin-jupyter-client",
"version": "0.1.2",
"version": "0.2.0",
"minAppVersion": "2.10.3",
"displayName": {
"default": "Jupyter Client",
Expand Down
8 changes: 8 additions & 0 deletions src/assets/symbols/icon-jupyter-client-inspect.symbol
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<symbol
id="icon-jupyter-client-inspect"
viewBox="0 0 24 24"
>
<path
d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-5 14H4v-4h11v4zm0-5H4V9h11v4zm5 5h-4V9h4v9z"
/>
</symbol>
40 changes: 4 additions & 36 deletions src/assets/symbols/icon-jupyter-client-simple.symbol
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,8 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
>
<!-- Generator: Sketch 39.1 (31720) - http://www.bohemiancoding.com/sketch -->
<title>logo</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g fill="#F37726">
<g>
<g>
<g>
<g>
<g transform="translate(0.000000, 109.804878)">
<g>
<g
transform="translate(0.078947, 0.778049)">
<path
d="M75.9422842,29.5804561 C43.3023947,29.5804561 14.7967832,17.6534634 0,0 C5.51083211,15.8406829 15.7815389,29.5667732 29.3904947,39.2784171 C42.9997,48.9898537 59.2737,54.2067805 75.9605789,54.2067805 C92.6474579,54.2067805 108.921458,48.9898537 122.530663,39.2784171 C136.139453,29.5667732 146.410284,15.8406829 151.921158,0 C137.087868,17.6534634 108.582589,29.5804561 75.9422842,29.5804561 L75.9422842,29.5804561 Z"
/>
</g>
</g>
</g>
<g>
<g>
<g
transform="translate(0.037368, 0.704878)">
<path
d="M75.9784579,24.6264073 C108.618763,24.6264073 137.124458,36.5534415 151.921158,54.2067805 C146.410284,38.366222 136.139453,24.6401317 122.530663,14.9284878 C108.921458,5.2168439 92.6474579,0 75.9605789,0 C59.2737,0 42.9997,5.2168439 29.3904947,14.9284878 C15.7815389,24.6401317 5.51083211,38.366222 0,54.2067805 C14.8330816,36.5899293 43.3385684,24.6264073 75.9784579,24.6264073 L75.9784579,24.6264073 Z"
/>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
<g class="jp-jupyter-icon-color" fill="#F37726">
<path transform="translate(0.078947, 110.582927)" d="M75.9422842,29.5804561 C43.3023947,29.5804561 14.7967832,17.6534634 0,0 C5.51083211,15.8406829 15.7815389,29.5667732 29.3904947,39.2784171 C42.9997,48.9898537 59.2737,54.2067805 75.9605789,54.2067805 C92.6474579,54.2067805 108.921458,48.9898537 122.530663,39.2784171 C136.139453,29.5667732 146.410284,15.8406829 151.921158,0 C137.087868,17.6534634 108.582589,29.5804561 75.9422842,29.5804561 L75.9422842,29.5804561 Z" />
<path transform="translate(0.037368, 0.704878)" d="M75.9784579,24.6264073 C108.618763,24.6264073 137.124458,36.5534415 151.921158,54.2067805 C146.410284,38.366222 136.139453,24.6401317 122.530663,14.9284878 C108.921458,5.2168439 92.6474579,0 75.9605789,0 C59.2737,0 42.9997,5.2168439 29.3904947,14.9284878 C15.7815389,24.6401317 5.51083211,38.366222 0,54.2067805 C14.8330816,36.5899293 43.3385684,24.6264073 75.9784579,24.6264073 L75.9784579,24.6264073 Z" />
</g>
</symbol>
4 changes: 2 additions & 2 deletions src/components/JupyterDock.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
import moment from "@workspace/utils/date/moment";
import type { IBar } from "@workspace/components/siyuan/dock/index";
import type Plugin from "@/index";
import type JupyterClientPlugin from "@/index";
import { FileTreeNodeType, type IFileTreeFileNode, type IFileTreeFolderNode, type IFileTreeRootNode } from "@workspace/components/siyuan/tree/file";
import type { KernelSpec, Kernel, Session } from "@jupyterlab/services";
import type { WorkerHandlers } from "@/workers/jupyter";
export let plugin: InstanceType<typeof Plugin>; // 插件对象
export let plugin: InstanceType<typeof JupyterClientPlugin>; // 插件对象
export let kernelspecs: KernelSpec.ISpecModels = {
default: "",
kernelspecs: {},
Expand Down
66 changes: 66 additions & 0 deletions src/components/JupyterInspectDock.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!--
Copyright (C) 2023 Zuoqiu Yingyi
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->

<script
context="module"
lang="ts"
>
import type { ISiyuanGlobal } from "@workspace/types/siyuan";
declare var globalThis: ISiyuanGlobal;
</script>

<script lang="ts">
import Bar from "@workspace/components/siyuan/dock/Bar.svelte";
import { TooltipsDirection } from "@workspace/components/siyuan/misc/tooltips";
import type { IBar } from "@workspace/components/siyuan/dock/index";
import type JupyterClientPlugin from "@/index";
import type { XtermOutputElement } from "./XtermOutputElement";
/* 标题栏配置 */
export let plugin: InstanceType<typeof JupyterClientPlugin>; // 插件对象
export let stream: string = ""; // 使用 base64 编码的数据流
let xterm: XtermOutputElement;
const bar: IBar = {
logo: "#icon-jupyter-client-inspect",
title: plugin.i18n.inspectDock.title,
icons: [
{
// 最小化
icon: "#iconMin",
type: "min",
ariaLabel: `${globalThis.siyuan.languages.min} ${plugin.siyuan.adaptHotkey("⌘W")}`,
tooltipsDirection: TooltipsDirection.sw,
},
],
};
</script>

<Bar {...bar} />
<jupyter-xterm-output
bind:this={xterm}
data-stream={stream}
class="xtrem fn__flex-1"
/>

<style lang="less">
.xtrem {
padding: 0.5em;
}
</style>
23 changes: 23 additions & 0 deletions src/components/Settings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,28 @@
}}
/>
</Item>

<!-- 语言服务调用延时 -->
<Item
title={i18n.settings.jupyterSettings.globalTab.delay.title}
text={i18n.settings.jupyterSettings.globalTab.delay.description}
>
<Input
slot="input"
type={ItemType.number}
settingKey="delay"
settingValue={config.jupyter.edit.delay}
limits={{
min: 0,
max: Infinity,
step: 25,
}}
on:changed={async e => {
config.jupyter.edit.delay = e.detail.value;
await updated();
}}
/>
</Item>
</div>

<!-- 标签页 2 - 服务设置 -->
Expand Down Expand Up @@ -453,6 +475,7 @@
type={ItemType.text}
settingKey="fontFamily"
settingValue={config.xterm.options.fontFamily}
placeholder="--b3-font-family-code"
on:changed={async e => {
config.xterm.options.fontFamily = e.detail.value;
await updated();
Expand Down
Loading

0 comments on commit 12d8767

Please sign in to comment.