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

@openctx/monaco-editor-extension

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openctx/monaco-editor-extension

OpenCtx extension for Monaco Editor

0.0.8
Source
npm
Version published
Weekly downloads
0
-100%
Maintainers
2
Weekly downloads
 
Created
Source

OpenCtx extension for Monaco Editor

The @openctx/monaco-editor-extension npm package implements a Monaco Editor extension that shows OpenCtx items on files.

Usage

Install it:

npm install @openctx/monaco-editor-extension @openctx/client

Set up an OpenCtx client:

import { createClient } from '@openctx/client'
import { createExtension, makeRange } from '@openctx/monaco-editor-extension'

// Set up a client.
const client = createClient({
  configuration: () =>
    Promise.resolve({
      enable: true,
      providers: {
        'https://openctx.org/npm/@openctx/provider-hello-world': true,
      },
    }),
  makeRange,
  logger: console.error,
})

// Now, get the editor object that refers to the Monaco editor you want to
// extend. Some code calls monaco.editor.create directly, and some code uses
// a wrapper around Monaco.
const editor: monaco.editor.IStandaloneCodeEditor = monaco.editor.create(/* ... */)

// Then create the extension and call it on the Monaco editor object.
const disposable = createExtension(client)(editor)

// Call disposable.dispose() when done to free resources.

Demo

Clone this repository and run pnpm run demo from this directory, then visit http://localhost:5901. See the demo/ dir for source code.

Development

  • Source code
  • Docs
  • License: Apache 2.0

FAQs

Package last updated on 20 May 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