Skip to content

feat: rework vscode extension#2390

Merged
antfu merged 14 commits intoslidevjs:mainfrom
kermanx:rework-vscode
Dec 8, 2025
Merged

feat: rework vscode extension#2390
antfu merged 14 commits intoslidevjs:mainfrom
kermanx:rework-vscode

Conversation

@kermanx
Copy link
Member

@kermanx kermanx commented Dec 1, 2025

When developing https://github.com/kermanx/p2p-live-share, I found I was wrong in many things about VSCode extension development. This PR reworks the extension and resolves multiple bugs, reported or unreported.

fix #2336

@netlify
Copy link

netlify bot commented Dec 1, 2025

Deploy Preview for slidev ready!

Name Link
🔨 Latest commit 6659999
🔍 Latest deploy log https://app.netlify.com/projects/slidev/deploys/692fac3b5e49c40008444177
😎 Deploy Preview https://deploy-preview-2390--slidev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 1, 2025

Open in StackBlitz

@slidev/client

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/client@2390

create-slidev

npm i https://pkg.pr.new/slidevjs/slidev/create-slidev@2390

create-slidev-theme

npm i https://pkg.pr.new/slidevjs/slidev/create-slidev-theme@2390

@slidev/parser

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/parser@2390

@slidev/cli

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/cli@2390

@slidev/types

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/types@2390

commit: 6659999

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors and fixes the VSCode extension with significant architectural changes to improve project management, server detection, and state synchronization.

Key changes:

  • Migrated from createSingletonComposable to defineService for better service management
  • Reworked project lifecycle management with proper scoping and cleanup
  • Refactored server detection to support multiple ports and auto-discovery
  • Improved slide navigation and focus tracking with debouncing

Reviewed changes

Copilot reviewed 29 out of 30 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
pnpm-workspace.yaml Added picomatch and yaml-language-server dependencies to vscode catalog
pnpm-lock.yaml Updated lockfile with new dependencies and minor version bumps
packages/vscode/syntaxes/*.md Updated example markdown files for syntax testing
packages/vscode/src/views/slidesTree.ts Refactored slides tree with new drag-and-drop logic and project-relative tracking
packages/vscode/src/views/serverTerminal.ts Removed standalone file (functionality moved to useDevServer)
packages/vscode/src/views/projectsTree.ts Updated to use defineService and changed label/description layout
packages/vscode/src/views/previewWebview.ts Refactored preview state management and sync logic
packages/vscode/src/views/foldings.ts Migrated to defineService pattern
packages/vscode/src/views/annotations.ts Improved decorator definitions and added Unicode space character comment
packages/vscode/src/utils/getSlidesTitle.ts Added fallback to basename when title is missing
packages/vscode/src/utils/getSlideNo.ts Removed file (functionality relocated)
packages/vscode/src/projects.ts Major refactor with effect scopes, file watchers, and improved lifecycle management
packages/vscode/src/lmTools.ts Updated to use new focused slide composable
packages/vscode/src/index.ts Added try-catch for language model tools initialization
packages/vscode/src/html/error.ts Updated to use project.port.value instead of project.port
packages/vscode/src/configs.ts Simplified config exports by removing ref wrappers
packages/vscode/src/composables/useServerDetector.ts Complete refactor to support multi-port detection and auto-discovery
packages/vscode/src/composables/usePreviewState.ts Removed file (functionality merged into previewWebview)
packages/vscode/src/composables/useFocusedSlideNo.ts Removed file (replaced by useFocusedSlide)
packages/vscode/src/composables/useFocusedSlide.ts New composable combining slide navigation and focus tracking
packages/vscode/src/composables/useEditingSlideSource.ts Removed file (replaced by useFocusedSlide)
packages/vscode/src/composables/useDevServer.ts Refactored to return scoped server instances with integrated terminal
packages/vscode/src/composables/useDebouncedComputed.ts New utility for debounced computed values
packages/vscode/src/commands.ts Updated commands to work with new project structure and improved entry selection
packages/vscode/package.json Changed activation event and updated command titles/enablement conditions
packages/vscode/language-server/volar-service-yaml.ts Removed outdated ts-expect-error comment
packages/types/src/types.ts Fixed typo and improved YAML document type annotation
packages/parser/src/fs.ts Changed to support async file loading with custom source function
packages/client/composables/useEmbeddedCtrl.ts Reduced throttle from 300ms to 50ms for more responsive updates
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

packages/vscode/src/commands.ts:68

  • When removing an entry, the code calls projects.delete(entry) directly instead of using the removeProject(entry) function defined in projects.ts. This bypasses proper cleanup logic that includes stopping the project scope and clearing the active entry. Consider using removeProject(entry) instead.
  useCommand('slidev.remove-entry', async (node: any) => {
    const entry = slash(node.treeItem.resourceUri.fsPath)
    if (activeEntry.value === entry)
      activeEntry.value = null
    projects.delete(entry)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

kermanx and others added 8 commits December 1, 2025 19:22
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 29 out of 30 changed files in this pull request and generated 8 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

packages/vscode/package.json:198

  • The slidev.stop-dev command is removed from the command palette and menus in package.json (lines 193-198 and 332-337 deleted), but the command handler still exists in commands.ts. This creates an inconsistency - the command can still be invoked programmatically but won't be visible to users. Either remove the command handler entirely or keep it in the UI if users need this functionality.
      {
        "command": "slidev.open-in-browser",
        "category": "Slidev",
        "title": "Open slides in browser",
        "icon": "$(globe)"
      },

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@antfu antfu changed the title refactor/fix: rework vscode extension feat: rework vscode extension Dec 8, 2025
@antfu antfu merged commit 638e264 into slidevjs:main Dec 8, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VSCode extension causes infinite loop with imported slides

3 participants

Comments