npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

monaco-marker-data-provider

v1.2.2

Published

Provide Monaco marker data in a similar way as other integrations

Downloads

965,049

Readme

Monaco marker data provider

ci workflow npm version npm downloads

Provider marker data for Monaco models.

Table of Contents

Introduction

Monaco editor supports marker data to highlight parts of a document using squiggly lines. This is analogous to diagnostics in the language server protocol. Monaco editor itself only supports this through the editor.setModelMarkers function. This allows users to set marker data even if a file isn’t open. This is useful for situations where a change in one file may lead to a marker data change in another. However, in many cases models don’t depend on each other to determine marker data. This is where monaco-marker-data-provider comes in. It exposes an API to set model markers using a provider, in a similar fashion as other Monaco providers.

Installation

This project has a peer dependency on monaco-editor. It’s recommended to add it explicitly.

npm install monaco-editor monaco-marker-data-provider

Usage

import * as monaco from 'monaco-editor'
import { registerMarkerDataProvider } from 'monaco-marker-data-provider'

import { myCustomValidator } from './myCustomValidator'

registerMarkerDataProvider(monaco, 'plaintext', {
  owner: 'my-custom-markers',

  provideMarkerData(model) {
    return myCustomValidator(model.getValue())
  }
})

API

registerMarkerDataProvider(monaco, languageId, provider)

This function returns a disposable.

Options

  • monaco: The monaco-editor module instance.
  • languageId (string): The language id to register the provider for.
  • provider (MarkerDataProvider): The object which provides Monaco marker data.

Returns

A MarkerDataProviderInstance instance

Types

MarkerDataProvider

An object with the following properties:

  • owner: A unique string to determine the owner of the marker data. This may be used to retrieve the marker data using editor.getModelMarkers(owner).
  • provideMarkerData: A function which provides marker data for the given model. It must return null, undefined, a list of marker data, or a promise that returns those values.
  • doReset: An optional function to perform a reset after a model has been removed.

MarkerDataProviderInstance

A disposable with the following properties:

  • revalidate: A function to revalidate all models.

License

MIT © Remco Haszing