This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
"target": "es6", | |
"module": "commonjs", | |
"allowJs": true, | |
"jsx": "react" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ADD TODO "Make the world a better place" | |
ADD TODO "read daily" | |
ADD TODO "Exercise" | |
COMPLETE TODO "Learn & share" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const languageID = 'todoLang'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grammar TodoLangGrammar; | |
todoExpressions : (addExpression)* (completeExpression)*; | |
addExpression : ADD TODO STRING EOL; | |
completeExpression : COMPLETE TODO STRING EOL; | |
ADD : 'ADD'; | |
TODO : 'TODO'; | |
COMPLETE: 'COMPLETE'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as monaco from "monaco-editor-core"; | |
import { languageExtensionPoint, languageID } from "./config"; | |
export function setupLanguage() { | |
monaco.languages.register(languageExtensionPoint); | |
monaco.languages.onLanguage(languageID, () => { | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const htmlWebpackPlugin = require('html-webpack-plugin'); | |
module.exports = { | |
mode: 'development', | |
entry: { | |
app: './src/index.tsx', | |
"editor.worker": 'monaco-editor-core/esm/vs/editor/editor.worker.js' | |
}, | |
output: { | |
globalObject: 'self', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as monaco from "monaco-editor-core"; | |
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration; | |
import ILanguage = monaco.languages.IMonarchLanguage; | |
export const monarchLanguage = <ILanguage>{ | |
// Set defaultToken to invalid to see what you do not tokenize yet | |
defaultToken: 'invalid', | |
keywords: [ | |
'COMPLETE', 'ADD', | |
], |
OlderNewer