monaco-languageserver-types
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)
console.log(toRange(lsRange))
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