Add support for more clike languages

main
Jake Dexheimer 7 years ago committed by Jake Dexheimer
parent 93c0214081
commit 7bfa2ef621

@ -61,7 +61,7 @@ class Carbon extends React.Component {
LANGUAGE_MODE_HASH[detectedLanguage] || LANGUAGE_NAME_HASH[detectedLanguage] LANGUAGE_MODE_HASH[detectedLanguage] || LANGUAGE_NAME_HASH[detectedLanguage]
if (languageMode) { if (languageMode) {
this.setState({ language: languageMode.mime ? languageMode.mime : languageMode.mode }) this.setState({ language: languageMode.mime || languageMode.mode })
} }
} else { } else {
this.setState({ language: props.config.language }) this.setState({ language: props.config.language })

@ -79,7 +79,21 @@ export const LANGUAGES = [
}, },
{ {
name: 'C', name: 'C',
mode: 'clike' mode: 'clike',
mime: 'text/x-csrc',
short: 'c'
},
{
name: 'C++',
mode: 'clike',
mime: 'text/x-c++src',
short: 'cpp'
},
{
name: 'C#',
mode: 'clike',
mime: 'text/x-csharp',
short: 'cs'
}, },
{ {
name: 'Clojure', name: 'Clojure',
@ -157,6 +171,12 @@ export const LANGUAGES = [
name: 'HTML', name: 'HTML',
mode: 'htmlmixed' mode: 'htmlmixed'
}, },
{
name: 'Java',
mode: 'clike',
mime: 'text/x-java',
short: 'java'
},
{ {
name: 'JavaScript', name: 'JavaScript',
mode: 'javascript' mode: 'javascript'
@ -200,6 +220,12 @@ export const LANGUAGES = [
mode: 'nimrod', mode: 'nimrod',
custom: true custom: true
}, },
{
name: 'Objective C',
mode: 'clike',
mime: 'text/x-objectivec',
short: 'objectivec'
},
{ {
name: 'Pascal', name: 'Pascal',
mode: 'pascal' mode: 'pascal'
@ -234,7 +260,9 @@ export const LANGUAGES = [
}, },
{ {
name: 'Scala', name: 'Scala',
mode: 'clike' mode: 'clike',
mime: 'text/x-scala',
short: 'scala'
}, },
{ {
name: 'Smalltalk', name: 'Smalltalk',

@ -112,7 +112,7 @@ class Editor extends React.Component {
<Dropdown <Dropdown
list={LANGUAGES} list={LANGUAGES}
onChange={language => onChange={language =>
this.setState({ language: language.mime ? language.mime : language.mode })} this.setState({ language: language.mime || language.mode })}
/> />
<ColorPicker <ColorPicker
onChange={color => this.setState({ background: color })} onChange={color => this.setState({ background: color })}

Loading…
Cancel
Save