Skip to content

Commit 0cb3b63

Browse files
author
veedrin
committed
Merge branch 'dashboard' of github.com:Coding/WebIDE-Frontend into dashboard
2 parents cf25713 + fe360de commit 0cb3b63

File tree

863 files changed

+422706
-803
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

863 files changed

+422706
-803
lines changed

.babelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"moduleName": "@babel/runtime"
1313
}],
1414
"@babel/plugin-syntax-export-default-from",
15+
"@babel/plugin-syntax-dynamic-import",
1516
["@babel/plugin-proposal-decorators", { "legacy": true }],
1617
["@babel/plugin-proposal-class-properties", { "loose": true }]
1718
],

app/components/Editor/components/EditorWidgets/ModeWidget.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { Component } from 'react'
22
import { observer } from 'mobx-react'
3-
import * as monaco from 'monaco-editor'
3+
44
import config from 'config'
55
import cx from 'classnames'
66
import modeInfos from 'components/Editor/components/CodeEditor/addons/mode/modeInfos'

app/components/MonacoEditor/MonacoReact/BaseDiffEditor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { PureComponent } from 'react'
22
import PropTypes from 'prop-types'
3-
import * as monaco from 'monaco-editor'
3+
44

55
import initialOptions from '../monacoDefaultOptions'
66
import { findLanguageByextensions } from '../utils/findLanguage'

app/components/MonacoEditor/MonacoReact/BaseEditor.jsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,30 @@ import { findLangueByExt } from '../utils/findLanguage'
1313
import { EditorInfo } from '../state'
1414
import initialOptions from '../monacoDefaultOptions'
1515
import registerCustomLanguages from '../languages'
16+
import { liftOff } from './grammars/configure-tokenizer'
17+
import { getTheme, getBase } from '../../../extensions/Editor.ext'
18+
19+
import themes from '../themes'
20+
21+
themes.forEach((themeConfig) => {
22+
const { name, theme } = themeConfig
23+
const transformedTheme = getTheme(theme)
24+
const { colors, rules, type } = transformedTheme
25+
monaco.editor.defineTheme(name, {
26+
base: getBase(type),
27+
inherit: true,
28+
colors,
29+
rules
30+
})
31+
})
32+
33+
// import 'monaco.languages.css'
34+
// import '../languageServices/css/monaco.contribution'
1635

1736
registerCustomLanguages()
1837

38+
liftOff(monaco)
39+
1940
function noop () {}
2041

2142
const Div = measure('div')
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { loadWASM } from 'onigasm' // peer dependency of 'monaco-textmate'
2+
import LanguageRegistry from './monaco-textmate-languages'
3+
import { wireTmGrammars } from './set-grammars'
4+
5+
import languages from './languages'
6+
7+
const grammars = new Map()
8+
9+
languages.forEach((language) => {
10+
grammars.set(language.id.toString(), language.scopeName.toString())
11+
})
12+
13+
let wasmLoaded = false
14+
15+
export async function liftOff (monaco) {
16+
if (!wasmLoaded) {
17+
// eslint-disable-next-line global-require
18+
await loadWASM(require('onigasm/lib/onigasm.wasm')) // See https://www.npmjs.com/package/onigasm#light-it-up
19+
wasmLoaded = true
20+
} else {
21+
return
22+
}
23+
const registry = new LanguageRegistry({
24+
basePath: 'grammarsDefinition',
25+
jsonFetcher: async (uri) => {
26+
const relativeUri = uri.replace('/grammars', '')
27+
const result = require(`./${relativeUri}`)
28+
return JSON.stringify(result)
29+
},
30+
})
31+
await wireTmGrammars(monaco, registry, grammars)
32+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"id": "applescript",
3+
"extensions": [".scpt"],
4+
"aliases": ["AppleScript", "applescript"],
5+
"mimeType": ["application/applescript"],
6+
"scopeName": "source.applescript"
7+
}

0 commit comments

Comments
 (0)