Skip to content

Instantly share code, notes, and snippets.

View amazzalel-habib's full-sized avatar
🏠
Working from home

AMAZZAL amazzalel-habib

🏠
Working from home
View GitHub Profile
import * as monaco from "monaco-editor-core";
import { languageExtensionPoint, languageID } from "./config";
export function setupLanguage() {
monaco.languages.register(languageExtensionPoint);
monaco.languages.onLanguage(languageID, () => {
});
}
import * as monaco from "monaco-editor-core";
import { languageExtensionPoint, languageID } from "./config";
export function setupLanguage() {
(window as any).MonacoEnvironment = {
getWorkerUrl: function (moduleId, label) {
return './editor.worker.js';
}
}
monaco.languages.register(languageExtensionPoint);
grammar TodoLangGrammar;
todoExpressions : (addExpression)* (completeExpression)*;
addExpression : ADD TODO STRING EOL;
completeExpression : COMPLETE TODO STRING EOL;
ADD : 'ADD';
TODO : 'TODO';
COMPLETE: 'COMPLETE';
export const languageID = 'todoLang';
import * as React from 'react';
import * as monaco from 'monaco-editor-core';
interface IEditorPorps {
language: string;
}
const Editor: React.FC<IEditorPorps> = (props: IEditorPorps) => {
let divNode;
const assignRef = React.useCallback((node) => {
ADD TODO "Make the world a better place"
ADD TODO "read daily"
ADD TODO "Exercise"
COMPLETE TODO "Learn & share"
const path = require('path');
const htmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
mode: 'development',
entry: {
app: './src/index.tsx'
},
output: {
filename: 'bundle.[hash].js',
path: path.resolve(__dirname, 'dist')
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"allowJs": true,
"jsx": "react"
}
}