New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

reactive-vscode

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reactive-vscode

Develop VSCode extension with Vue Reactivity API


Version published
Weekly downloads
898
decreased by-11.79%
Maintainers
0
Weekly downloads
 
Created

reactive-vscode

npm version npm downloads License

Header

Develop VSCode extension with Vue Reactivity API

Counter Example

import { defineExtension, ref, useCommands, useStatusBarItem } from 'reactive-vscode'
import { StatusBarAlignment } from 'vscode'

export = defineExtension(() => {
  const counter = ref(0)

  useStatusBarItem({
    alignment: StatusBarAlignment.Right,
    priority: 100,
    text: () => `$(megaphone) Hello*${counter.value}`,
  })

  useCommands({
    'extension.sayHello': () => counter.value++,
    'extension.sayGoodbye': () => counter.value--,
  })
})
Implementation with original VSCode API
import type { ExtensionContext } from 'vscode'
import { StatusBarAlignment, commands, window } from 'vscode'

export function activate(extensionContext: ExtensionContext) {
  let counter = 0

  const item = window.createStatusBarItem(StatusBarAlignment.Right, 100)

  function updateStatusBar() {
    item.text = `$(megaphone) Hello*${counter}`
    item.show()
  }

  updateStatusBar()

  extensionContext.subscriptions.push(
    commands.registerCommand('extension.sayHello', () => {
      counter++
      updateStatusBar()
    }),
    commands.registerCommand('extension.sayGoodbye', () => {
      counter--
      updateStatusBar()
    }),
  )
}

More examples.

License

MIT License © 2024-PRESENT _Kerman

Source code in the ./packages/reactivity directory is ported from @vue/runtime-core. Licensed under a MIT License.

The logo is modified from Vue Reactity Artworks. Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Part of the docs website is ported from VueUse. Licensed under a MIT License.

FAQs

Package last updated on 13 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts