Skip to content

Commit

Permalink
Merge pull request #678 from Hi-Windom/v0.32
Browse files Browse the repository at this point in the history
V0.32
  • Loading branch information
Soltus authored May 3, 2024
2 parents 7aeca6a + a39416e commit 1d71ce3
Show file tree
Hide file tree
Showing 76 changed files with 314 additions and 41 deletions.
27 changes: 25 additions & 2 deletions .vscode/Sillot.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@
{
"path": "../_pkgs/siyuan", // 思源本源
"name": "思源🤍../siyuan 🗂️"
}
},
{
"path": "../_pkgs/siyuan-android", // 思源本源
"name": "思源安卓🤍../siyuan-android 🗂️"
}
],
"settings": {
"files.associations": {
Expand All @@ -48,9 +52,28 @@
"*.tpl": "html"
},
"workbench.editor.wrapTabs": true,
"terminal.integrated.gpuAcceleration": "auto",
"scm.workingSets.enabled": true,
"scm.workingSets.default": "current",
"editor.guides.indentation": true,
"editor.stickyScroll.enabled": true,
"editor.minimap.side": "left", // 显示在左侧更专注
"editor.minimap.enabled": true,
"workbench.editor.titleScrollbarSizing": "large",
"workbench.editor.openPositioning": "right",
"workbench.editor.showTabs": "multiple",
"workbench.editor.enablePreview": true, // 启用或禁用预览编辑器
"workbench.editor.closeEmptyGroups": false, // 关闭编辑器组的最后一个编辑器是否关闭该组本身
"workbench.editor.customLabels.enabled": true, // REF https://code.visualstudio.com/docs/getstarted/userinterface#_customize-tab-labels
"workbench.editor.customLabels.patterns": {
"**/src/**/index.ts": "${dirname}/${filename} 💕"
},
"search.exclude": {
"**/.history": true
}
},
// 实验性设置
"notebook.experimental.remoteSave": true,
"markdown.experimental.updateLinksOnPaste": true
},
"extensions": {
"recommendations": [
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "sillot",
"displayName": "汐洛 Sillot",
"description": "汐洛(Sillot)孵化自思源笔记(siyuan-note),致力于服务智慧新彖乄。此插件为汐洛官方插件,提供多功能一体化集成。",
"version": "0.1.1700",
"version": "0.1.1800",
"preview": true,
"repository": "https://github.com/Hi-Windom/Sillot",
"publisher": "Hi-Windom",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { CodelensProvider } from "./CodelensProvider";
import { GenericCompletionItemProvider } from "./provider/_Generic";
import { Credentials } from "./auth/github";
import { ColorPickerProvider } from "./provider/_ColorPicker";
import { YamlCompletionItemProvider } from "./provider/yaml";

let lastChangedDocument: vscode.TextDocument | null = null;
let myWebviewPanel: vscode.WebviewPanel | undefined;
Expand Down Expand Up @@ -281,14 +282,21 @@ export async function activate(context: vscode.ExtensionContext) {
// context.subscriptions.push(disposable3);
context.subscriptions.push(测试序列化字典);
context.subscriptions.push(测试反序列化字典);
context.subscriptions.push(vscode.languages.registerCompletionItemProvider('*', new GenericCompletionItemProvider()));
context.subscriptions.push(vscode.languages.registerCompletionItemProvider("*", new GenericCompletionItemProvider()));
context.subscriptions.push(vscode.languages.registerCompletionItemProvider("yaml", new YamlCompletionItemProvider()));
context.subscriptions.push(vscode.languages.registerHoverProvider("sy", new SyHoverProvider()));
context.subscriptions.push(vscode.languages.registerCompletionItemProvider("sy", new SyCompletionItemProvider()));
context.subscriptions.push(vscode.languages.registerCodeActionsProvider({ language: 'sy' }, new SyCodeActionProvider()));
context.subscriptions.push(vscode.languages.registerDocumentSemanticTokensProvider({ language: 'sy' }, new SySemanticTokensProvider(), new vscode.SemanticTokensLegend([
'type',
'trailingComma', // 表示尾随逗号错误
])));
context.subscriptions.push(vscode.languages.registerCodeActionsProvider({ language: "sy" }, new SyCodeActionProvider()));
context.subscriptions.push(
vscode.languages.registerDocumentSemanticTokensProvider(
{ language: "sy" },
new SySemanticTokensProvider(),
new vscode.SemanticTokensLegend([
"type",
"trailingComma", // 表示尾随逗号错误
])
)
);
// context.subscriptions.push(vscode.languages.registerCompletionItemProvider("dosc", new SyCompletionItemProvider()));

const disposable5 = vscode.commands.registerCommand("sillot.pickEXE", () => {
Expand Down Expand Up @@ -354,29 +362,29 @@ export async function activate(context: vscode.ExtensionContext) {
vscode.window.showInformationMessage(`CodeLens action clicked with args=${args}`);
});
const credentials = new Credentials();
await credentials.initialize(context);
const disposable99 = vscode.commands.registerCommand('extension.getGitHubUser', async () => {
/**
* Octokit (https://github.com/octokit/rest.js#readme) is a library for making REST API
* calls to GitHub. It provides convenient typings that can be helpful for using the API.
*
* Documentation on GitHub's REST API can be found here: https://docs.github.com/en/rest
*/
const octokit = await credentials.getOctokit();
const userInfo = await octokit.users.getAuthenticated();

vscode.window.showInformationMessage(`Logged into GitHub as ${userInfo.data.login}`);
});
const disposable88 = vscode.commands.registerCommand('sillot.getGitHubUser', async () => {
vscode.window.showInformationMessage("这个还没有实现嘞");
});
await credentials.initialize(context);
const disposable99 = vscode.commands.registerCommand("extension.getGitHubUser", async () => {
/**
* Octokit (https://github.com/octokit/rest.js#readme) is a library for making REST API
* calls to GitHub. It provides convenient typings that can be helpful for using the API.
*
* Documentation on GitHub's REST API can be found here: https://docs.github.com/en/rest
*/
const octokit = await credentials.getOctokit();
const userInfo = await octokit.users.getAuthenticated();

vscode.window.showInformationMessage(`Logged into GitHub as ${userInfo.data.login}`);
});
const disposable88 = vscode.commands.registerCommand("sillot.getGitHubUser", async () => {
vscode.window.showInformationMessage("这个还没有实现嘞");
});
context.subscriptions.push(disposable88);
context.subscriptions.push(disposable99);
context.subscriptions.push(disposable99);

context.subscriptions.push(vscode.languages.registerColorProvider({ language: 'xml' }, new ColorPickerProvider())); // 记得在 .vscode 中把 .tmTheme 文件视为 xml
context.subscriptions.push(vscode.languages.registerColorProvider({ language: 'json' }, new ColorPickerProvider()));
context.subscriptions.push(vscode.languages.registerColorProvider({ language: 'typescript' }, new ColorPickerProvider()));
context.subscriptions.push(vscode.languages.registerColorProvider({ language: 'html' }, new ColorPickerProvider()));
context.subscriptions.push(vscode.languages.registerColorProvider({ language: "xml" }, new ColorPickerProvider())); // 记得在 .vscode 中把 .tmTheme 文件视为 xml
context.subscriptions.push(vscode.languages.registerColorProvider({ language: "json" }, new ColorPickerProvider()));
context.subscriptions.push(vscode.languages.registerColorProvider({ language: "typescript" }, new ColorPickerProvider()));
context.subscriptions.push(vscode.languages.registerColorProvider({ language: "html" }, new ColorPickerProvider()));
}

// 当你的扩展被禁用时,这个方法将被调用
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
152 changes: 152 additions & 0 deletions .vscode/extensions/Sillot/src/provider/yaml.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
import * as vscode from "vscode";

const ActionFile_kind = vscode.CompletionItemKind.Constant;

/**
* github workflows action.yaml
*/
const ActionFileCompletionItems: Array<vscode.CompletionItem> = [
{
label: "☄️",
filterText: "action emoji 彗星 检出仓库",
insertText: "☄️",
detail: "☄️ 彗星:检出仓库",
documentation: "Github Action 步骤名称开头的 emoji",
kind:ActionFile_kind,
},
{
label: "🔨",
filterText: "action emoji 锤子 准备工具",
insertText: "🔨",
detail: "🔨 锤子:准备工具",
documentation: "Github Action 步骤名称开头的 emoji",
kind:ActionFile_kind,
},
{
label: "💫",
filterText: "action emoji 头晕",
insertText: "💫",
detail: "💫 头晕:获取值、字段、属性等",
documentation: "Github Action 步骤名称开头的 emoji",
kind:ActionFile_kind,
},
{
label: "📃",
filterText: "action emoji 带卷边的页面 生成非日志 非持久化的输出",
insertText: "📃",
detail: "📃 带卷边的页面:生成非日志、非持久化的输出",
documentation: "Github Action 步骤名称开头的 emoji",
kind:ActionFile_kind,
},
{
label: "🚩",
filterText: "action emoji 三角旗 创建发布",
insertText: "🚩",
detail: "🚩 三角旗:创建发布",
documentation: "Github Action 步骤名称开头的 emoji",
kind:ActionFile_kind,
},
{
label: "✅",
filterText: "action emoji 勾号按钮 检查",
insertText: "✅",
detail: "✅ 勾号按钮:检查",
documentation: "Github Action 步骤名称开头的 emoji",
kind:ActionFile_kind,
},
{
label: "📦",
filterText: "action emoji 包裹 打包",
insertText: "📦",
detail: "📦 包裹:打包",
documentation: "Github Action 步骤名称开头的 emoji",
kind:ActionFile_kind,
},
{
label: "✍️",
filterText: "action emoji 写字 写入文件 修改文件",
insertText: "✍️",
detail: "✍️ 写字:写入或修改文件",
documentation: "Github Action 步骤名称开头的 emoji",
kind:ActionFile_kind,
},
{
label: "🗑️",
filterText: "action emoji 垃圾桶 清理文件 清理目录 释放空间",
insertText: "🗑️",
detail: "🗑️ 垃圾桶:清理文件、目录;释放空间",
documentation: "Github Action 步骤名称开头的 emoji",
kind:ActionFile_kind,
},
{
label: "🔥",
filterText: "action emoji 火焰 构建",
insertText: "🔥",
detail: "🔥 火焰:构建",
documentation: "Github Action 步骤名称开头的 emoji",
kind:ActionFile_kind,
},
{
label: "📤",
filterText: "action emoji 发件箱 上传 发送",
insertText: "📤",
detail: "📤 发件箱:上传;发送",
documentation: "Github Action 步骤名称开头的 emoji",
kind:ActionFile_kind,
},
{
label: "💥",
filterText: "action emoji 爆炸 运行脚本",
insertText: "💥",
detail: "💥 爆炸:运行脚本",
documentation: "Github Action 步骤名称开头的 emoji",
kind:ActionFile_kind,
},
{
label: "🌠",
filterText: "action emoji 流星 签名",
insertText: "🌠",
detail: "🌠 流星 签名",
documentation: "Github Action 步骤名称开头的 emoji",
kind:ActionFile_kind,
},
{
label: "🧲",
filterText: "action emoji 磁铁 获取资产 下载",
insertText: "🧲",
detail: "🧲 磁铁:获取资产;下载",
documentation: "Github Action 步骤名称开头的 emoji",
kind:ActionFile_kind,
},
{
label: "🚀",
filterText: "action emoji 安装依赖",
insertText: "🚀",
detail: "🚀 安装依赖",
documentation: "Github Action 步骤名称开头的 emoji",
kind:ActionFile_kind,
},
];

/**
* 已知无法在 .github 目录内与 Github Action 扩展同时使用,还不知道如何解决这一冲突。
*/
export class YamlCompletionItemProvider implements vscode.CompletionItemProvider {
// 这里提供补全项
public provideCompletionItems(
document: vscode.TextDocument,
position: vscode.Position,
token: vscode.CancellationToken,
context: vscode.CompletionContext
): vscode.ProviderResult<vscode.CompletionItem[] | vscode.CompletionList> {
return ActionFileCompletionItems;
}

// 这里增强补全项
public resolveCompletionItem?(
item: vscode.CompletionItem,
token: vscode.CancellationToken
): vscode.ProviderResult<vscode.CompletionItem> {
return item;
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@

注意:"path": "./snippets/sofill.json" 这里的路径不能在 ./src 目录下(这是因为 .vscodeignore 中忽略了 src,因此 src 里最好只包含源代码)


vscode.CompletionItem

举例:
Expand All @@ -65,3 +64,32 @@ vscode.CompletionItem
```

label 匹配用户输入,当 insertText不存在时也是输出

### vscode.CompletionItemProvider

> 在 VS Code 中,当一个特定的语言或文件类型被打开时,可以有多个扩展为其提供语言功能,如语法高亮、代码补全、悬停信息等。然而,对于某些功能,如代码补全(Completion Item Provider),VS Code 会选择一个“活动的”提供者来处理用户的输入。

> 这意味着,尽管可以有多个扩展注册了同一个语言或文件类型的 Completion Item Provider,但 VS Code 会在这些提供者中选择一个来响应自动完成请求。通常,选择哪个提供者取决于提供者的注册方式和它们的优先级。

举例:

```json
{
label: "☄️",
filterText: "彗星 检出仓库",
insertText: "☄️",
documentation: "☄️ 彗星:检出仓库",
detail: "Github Action 步骤名称开头的 emoji",
kind: vscode.CompletionItemKind.User,
}
```

label是显示在自动补全主框里的内容

filterText可以理解为输入联想,用空格分割关键词

insertText就是自动完成的内容了

documentation是自动补全副框里的主要内容

detail是自动补全副框里的次要内容(非显著颜色的就是了);当自动补全副框处于关闭状态时,他会显示在主框
File renamed without changes.
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ ENV CGO_ENABLED=1
RUN apk add --no-cache gcc musl-dev && \
cd kernel && go build --tags fts5 -v -ldflags "-s -w -X github.com/Hi-Windom/Sillot/kernel/util.Mode=prod" && \
mkdir /opt/Sillot/ && \
# mv /Hi-Windom/Sillot/app/appearance/ /opt/Sillot/ && \
# -a选项表示归档模式,保持符号链接、权限、时间戳等,-v表示详细输出。
rsync -av --exclude='zh_CHT.json' --exclude='fr_FR.json' --exclude='es_ES.json' /Hi-Windom/Sillot/app/appearance/ /opt/Sillot/
rm /Hi-Windom/Sillot/app/appearance/langs/zh_CHT.json && \
rm /Hi-Windom/Sillot/app/appearance/langs/fr_FR.json && \
rm /Hi-Windom/Sillot/app/appearance/langs/es_ES.json && \
mv /Hi-Windom/Sillot/app/appearance/ /opt/Sillot/ && \
mv /Hi-Windom/Sillot/app/stage/ /opt/Sillot/ && \
mv /Hi-Windom/Sillot/app/guide/ /opt/Sillot/ && \
mv /Hi-Windom/Sillot/app/changelogs/ /opt/Sillot/ && \
Expand Down
3 changes: 0 additions & 3 deletions _vscode_plugin/Sillot/src/provider/yaml.ts

This file was deleted.

2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sillot",
"version": "0.32.1340",
"version": "0.32.1400",
"syv": "3.0.13",
"sypv": "[]",
"description": "Build Your Eternal Digital Garden",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"siyuan:b:lint": "",
"dep:check": "pnpm outdated --filter *",
"dev:docs": "pnpm --filter ./docs/starlight run dev",
"vsce:sillot": "pnpm --filter ./_vscode_plugin/Sillot run vsce:package",
"vsce:sillot": "pnpm --filter ./.vscode/extensions/Sillot run vsce:package",
"git:proxy": "git config --global http.proxy http://127.0.0.1:7890 && git config --global https.proxy http://127.0.0.1:7890 && echo '7890是 clash 默认端口'",
"test": "pnpm -r run test"
},
Expand Down
Loading

0 comments on commit 1d71ce3

Please sign in to comment.