Skip to content

Commit

Permalink
feat(vscode): add menu button for add-entry command (#1585)
Browse files Browse the repository at this point in the history
  • Loading branch information
KermanX authored May 10, 2024
1 parent d091b1e commit e640606
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
22 changes: 14 additions & 8 deletions packages/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,18 @@
{
"command": "slidev.choose-entry",
"category": "Slidev",
"title": "Choose active slides entry."
"title": "Choose active slides entry"
},
{
"command": "slidev.add-entry",
"category": "Slidev",
"title": "Choose Markdown files to add as slides entries."
"title": "Choose Markdown files to add as slides entries",
"icon": "$(add)"
},
{
"command": "slidev.remove-entry",
"category": "Slidev",
"title": "Remove the given entry file from the active slides entries.",
"title": "Remove the given entry file from the active slides entries",
"icon": "$(close)"
},
{
Expand Down Expand Up @@ -98,25 +99,25 @@
{
"command": "slidev.preview-prev-click",
"category": "Slidev",
"title": "Navigate to prev click in preview window.",
"title": "Navigate to prev click in preview window",
"icon": "$(arrow-left)"
},
{
"command": "slidev.preview-next-click",
"category": "Slidev",
"title": "Navigate to next click in preview window.",
"title": "Navigate to next click in preview window",
"icon": "$(arrow-right)"
},
{
"command": "slidev.preview-prev-slide",
"category": "Slidev",
"title": "Navigate to prev slide in preview window.",
"title": "Navigate to prev slide in preview window",
"icon": "$(arrow-up)"
},
{
"command": "slidev.preview-next-slide",
"category": "Slidev",
"title": "Navigate to next slide in preview window.",
"title": "Navigate to next slide in preview window",
"icon": "$(arrow-down)"
},
{
Expand Down Expand Up @@ -167,10 +168,15 @@
}
],
"view/title": [
{
"command": "slidev.add-entry",
"when": "view =~ /slidev-projects-tree/",
"group": "navigation@1"
},
{
"command": "slidev.rescan-projects",
"when": "view =~ /slidev-projects-tree/",
"group": "navigation"
"group": "navigation@2"
},
{
"command": "slidev.preview-prev-slide",
Expand Down
2 changes: 2 additions & 0 deletions packages/vscode/src/utils/findPossibleEntries.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { basename } from 'node:path'
import { slash } from '@antfu/utils'
import { workspace } from 'vscode'
import { projects } from '../projects'

export async function findPossibleEntries() {
const files = await workspace.findFiles('**/*.md', '**/{node_modules,.github}/**')
return files
.map(uri => slash(uri.fsPath))
.filter(path => !projects.has(path))
.filter(path => ![
'readme.md',
'code_of_conduct.md',
Expand Down

0 comments on commit e640606

Please sign in to comment.