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 prettier codecov

Convert between language server types and Monaco editor types.

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-types, 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.

For example:

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

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 }

Some Monaco editor types contain a monaco.Uri instance. For these cases the to* accept monaco.Uri as a second argument.

License

MIT @ Remco Haszing

Keywords

FAQs

Package last updated on 26 Feb 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