Skip to content

Commit cc3c309

Browse files
committed
feat:delete RSS link
1 parent 1ad2a54 commit cc3c309

2 files changed

Lines changed: 25 additions & 2 deletions

File tree

extension.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,14 @@ async function activate(context) {
9595
}, RSS_CHECK_INTERVAL);
9696

9797
let disposable = vscode.commands.registerCommand('allblog.searchBlog', async () => {
98+
// 选项
9899
const choiceItems = [
99100
{ label: 'Add new RSS link', isNew: true },
100-
...Object.keys(rssLinks).map(link => ({ label: rssLinks[link], link, isNew: false }))
101+
...Object.keys(rssLinks).map(link => ({ label: rssLinks[link], link, isNew: false })),
102+
{ label: 'Delete RSS link', isDelete: true }
101103
];
102104

105+
103106
const selectedChoice = await vscode.window.showQuickPick(choiceItems, {
104107
placeHolder: 'Select an RSS link or add a new one'
105108
});
@@ -136,6 +139,15 @@ async function activate(context) {
136139
await getArticleContent(newLink, customName);
137140
}
138141
}
142+
}else if (selectedChoice.isDelete) {
143+
const linkToDelete = await vscode.window.showQuickPick(Object.keys(rssLinks).map(link => ({ label: rssLinks[link], link })), {
144+
placeHolder: '选择要删除的RSS链接'
145+
});
146+
147+
if (linkToDelete) {
148+
delete rssLinks[linkToDelete.link];
149+
context.globalState.update(RSS_LINKS_CONFIG_KEY, rssLinks);
150+
}
139151
} else {
140152
await getArticleContent(selectedChoice.link, selectedChoice.label);
141153
}
@@ -150,4 +162,4 @@ function deactivate() { }
150162
module.exports = {
151163
activate,
152164
deactivate
153-
};
165+
};

package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@
1616
],
1717
"main": "./extension.js",
1818
"contributes": {
19+
"configuration": [
20+
{
21+
"title": "RSS Links for RSS-searchBlog",
22+
"properties": {
23+
"allblog.rssLinks": {
24+
"type": "object",
25+
"description": "RSS links for the RSS-searchBlog extension"
26+
}
27+
}
28+
}
29+
],
1930
"commands": [
2031
{
2132
"command": "allblog.searchBlog",

0 commit comments

Comments
 (0)