monaco-languageserver-types
TypeScript icon, indicating that this package has built-in type declarations

0.3.3 • Public • Published

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.

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 }

License

MIT © Remco Haszing

Package Sidebar

Install

npm i monaco-languageserver-types

Weekly Downloads

40,956

Version

0.3.3

License

MIT

Unpacked Size

303 kB

Total Files

263

Last publish

Collaborators

  • remcohaszing