Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const initEditor = () => {
if (!initDone) {
// for now, try to disable the built-in Javascript-specific completion helper thingies
monaco.languages.typescript.javascriptDefaults.setCompilerOptions({ noLib: true, allowNonTsExtensions: true })
// install any custom languages we might have
languages(monaco).forEach(({ language, provider }) => {
monaco.languages.registerCompletionItemProvider(language, provider)
})
initDone = true
}
// here we instantiate an editor widget
editorWrapper['baseFontSize'] = 14.4
editor = monaco.editor.create(editorWrapper, Object.assign({
automaticLayout: false, // respond to window layout changes
minimap: {
enabled: false
},
init() {
this.m_editorElem = document.createElement("div");
monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
validate: true,
schemas: [
{
uri: "https://github.com/heremaps/harp.gl/theme.scheme.json",
fileMatch: [".theme.json"],
schema
}
]
});
this.m_editor = monaco.editor.create(this.m_editorElem, {
language: "json",
model: this.m_model
});
window.addEventListener("resize", () => this.resize());
inlineSourceMap: true,
inlineSources: true,
isolatedModules: false,
jsx: Monaco.languages.typescript.JsxEmit.React,
lib: ['dom'],
module: Monaco.languages.typescript.ModuleKind.CommonJS,
moduleResolution: Monaco.languages.typescript.ModuleResolutionKind.NodeJs,
noEmit: false,
outDir: `dist`,
resolveJsonModule: true,
rootDir: '/',
sourceMap: true,
target: Monaco.languages.typescript.ScriptTarget.ES2015,
typeRoots: ['node_modules/@types'],
});
Monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
noSemanticValidation: true,
noSyntaxValidation: false,
});
if (options.files) {
for (const pathname in options.files) {
const content = options.files[pathname];
this.createModel(pathname, content);
}
}
Monaco.editor.onDidCreateModel(model => {
const onDidChangePackageJson = async () => {
const value = model.getValue();
[/\/\*/, 'comment.invalid'],
[/[/*]/, 'comment']
],
string: [
[/[^\\"]+/, 'string'],
[/@escapes/, 'string.escape'],
[/\\./, 'string.escape.invalid'],
[/"/, 'string', '@pop']
]
}
};
}
monaco.languages.register({id: 'zig'});
monaco.languages.setMonarchTokensProvider('zig', definition());
comment: [
[/[^/*]+/, 'comment'],
[/\*\//, 'comment', '@pop'],
[/[/*]/, 'comment']
],
whitespace: [
[/[ \t\r\n]+/, 'white'],
[/\/\*/, 'comment', '@comment'],
[/\/\/.*$/, 'comment']
]
}
};
}
monaco.languages.register({ id: 'clean' });
monaco.languages.setMonarchTokensProvider('clean', definition());
[/\*\//, 'comment', '@pop'],
[/[/*]/, 'comment']
],
whitespace: [
[/[ \t\r\n]+/, 'white'],
[/\/\*/, 'comment', '@comment'],
[/\/\/.*$/, 'comment'],
[/--.*$/, 'comment']
]
}
};
}
monaco.languages.register({id: 'haskell'});
monaco.languages.setMonarchTokensProvider('haskell', definition());
(label: string): Omit => ({
label,
kind: Monaco.languages.CompletionItemKind.Keyword,
detail: description,
insertText: `${label}:`,
filterText: label,
})
)
import * as monaco from 'monaco-editor';
const Snippet = monaco.languages.CompletionItemKind.Snippet;
const insertTextRules =
monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet;
export const initialValue = `{
"propsSchema": {
"type": "object",
"properties": {
},
"required": []
},
"uiSchema": {
},
"formData": {
}
}`;
}],
[/[ \t\r\n]+/, 'white']
],
string: [
[/[^\\"]+/, 'string'],
[/@escapes/, 'string.escape'],
[/\\./, 'string.escape.invalid'],
[/"/, 'string', '@pop']
]
}
};
}
monaco.languages.register({id: 'llvm-ir'});
monaco.languages.setMonarchTokensProvider('llvm-ir', definition());