Socket
Socket
Sign inDemoInstall

monaco-languageserver-types

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

monaco-languageserver-types

Convert between language server types and Monaco editor types


Version published
Weekly downloads
72K
increased by4.15%
Maintainers
1
Weekly downloads
 
Created
Source

monaco-languageserver-types

github actions npm version npm downloads codecov

Convert between language server types and Monaco editor types.

Table of Contents

Installation

npm install monaco-languageserver-types

Usage

This package exports function to convert language server types to Monaco editor types and vise versa. It does so without importing monaco-editor or vscode-languageserver-protocol, meaning it has no runtime dependencies.

For each Monaco editor / language server type, there are two functions:

  • from* converts a value from a Monaco editor type to a language server type.
  • to* converts a value from a language server type to a Monaco editor type.

Some types require the Monaco editor module. However, users may load Monaco from different sources. To support this, you should call setMonaco(monaco) once in your application.

For example:

import * as monaco from 'monaco-editor'
import { fromRange, setMonaco, toRange } from 'monaco-languageserver-types'

setMonaco(monaco)

const monacoRange: monaco.IRange = {
  startLineNumber: 1,
  startColumn: 2,
  endLineNumber: 3,
  endColumn: 4
}

const lsRange = fromRange(monacoRange)
// { start: { line: 0, column: 1 }, end: { line: 2, column: 3 } }

console.log(toRange(lsRange))
// { startLineNumber: 1, startColumn: 2, endLineNumber: 3, endColumn: 4 }

License

MIT © Remco Haszing

Keywords

FAQs

Package last updated on 06 Sep 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc