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-sql-languages-clickhouse

v1.0.0-beta.2

Published

monaco-sql-languages:0.9.4 fork with clickhouse support

Downloads

9

Readme

Monaco SQL Languages NPM version NPM downloads

This is a SQL Languages project for Monaco Editor forked it from monaco-languages. The differences are we integrated with many kinds of SQL Languages for BigData domain, like FLinkSQL, SParkSQL, HiveSQL, and so on. We provided the basic SQL syntax validation feature by dt-sql-parser, and we are going to provide Autocomplete feature in future.

Online Preview: https://dtstack.github.io/monaco-sql-languages/

Supported SQL Languages

  • Generic SQL (MySQL)
  • FLinkSQL
  • SparkSQL
  • HiveSQL
  • PGSQL
  • PLSQL

Installation

npm install monaco-sql-languages

or


yarn add monaco-sql-languages

Usage

Add language worker in the Webpack entry field:

entry: {
 'sparksql.worker': 'monaco-sql-languages/out/esm/sparksql/sparksql.worker.js',
 'flinksql.worker': 'monaco-sql-languages/out/esm/flinksql/flinksql.worker.js'),
 'hivesql.worker': 'monaco-sql-languages/out/esm/hivesql/hivesql.worker.js'),
 'mysql.worker': 'monaco-sql-languages/out/esm/mysql/mysql.worker.js'),
 'plsql.worker': 'monaco-sql-languages/out/esm/plsql/plsql.worker.js'),
 'sql.worker': 'monaco-sql-languages/out/esm/sql/sql.worker.js')
},

Define the MonacoEnvironment for worker file:

window.MonacoEnvironment = {
	getWorkerUrl: function (moduleId, label) {
		switch (label) {
			case 'sparksql': {
				return './sparksql.worker.js';
			}
			case 'flinksql': {
				return './flinksql.worker.js';
			}
			case 'hivesql': {
				return './hivesql.worker.js';
			}
			case 'mysql': {
				return './mysql.worker.js';
			}
			case 'plsql': {
				return './plsql.worker.js';
			}
			case 'sql': {
				return './sql.worker.js';
			}
			default: {
				return './editor.worker.js';
			}
		}
	}
};

Import the language contribution before creating the editor by monaco-editor:

import 'monaco-sql-languages/out/esm/flinksql/flinksql.contribution';
import 'monaco-sql-languages/out/esm/hivesql/hivesql.contribution';
import 'monaco-sql-languages/out/esm/sparksql/sparksql.contribution';
import 'monaco-sql-languages/out/esm/mysql/mysql.contribution';
import 'monaco-sql-languages/out/esm/plsql/plsql.contribution';
import 'monaco-sql-languages/out/esm/sql/sql.contribution';

Then, set the language value you need when creating the moanco-editor instance:

monaco.editor.create(document.getElementById("container"), {
 value: "select * from tb_test",
 language: "sql" // you need
});

Tips: you can change the editor model language by monaco.editor.setModelLanguage(model, language)

Example

Reference from here.

Dev: cheat sheet

  • initial setup with npm install .
  • open the dev web with npm run dev
  • compile with npm run watch
  • test with npm run test
  • bundle with npm run prepublishOnly

Dev: Adding a new language

  • create $/src/myLang/myLang.contribution.ts
  • create $/src/myLang/myLang.ts
  • create $/src/myLang/myLang.test.ts
  • edit $/src/monaco.contribution.ts and register your new language
import './myLang/myLang.contribution';

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

License

MIT