Add C,C++ and Go language support (#463)
This commit is contained in:
committed by
GitHub
parent
69f6226fec
commit
201094bab7
@@ -20,6 +20,8 @@
|
||||
"@codemirror/lang-markdown": "^6.5.0",
|
||||
"@codemirror/lang-python": "^6.2.1",
|
||||
"@codemirror/lang-rust": "^6.0.2",
|
||||
"@codemirror/lang-cpp": "^6.0.3",
|
||||
"@codemirror/lang-go": "^6.0.1",
|
||||
"@codemirror/lang-sql": "^6.10.0",
|
||||
"@codemirror/lang-xml": "^6.1.0",
|
||||
"@codemirror/lang-yaml": "^6.1.2",
|
||||
|
||||
@@ -12,6 +12,8 @@ import { xml } from '@codemirror/lang-xml';
|
||||
import { yaml as yamlLanguage } from '@codemirror/lang-yaml';
|
||||
import { rust } from '@codemirror/lang-rust';
|
||||
import { elixir } from 'codemirror-lang-elixir';
|
||||
import { cpp } from '@codemirror/lang-cpp';
|
||||
import { go } from '@codemirror/lang-go';
|
||||
|
||||
import { Language, LanguageDescription, StreamLanguage, HighlightStyle, syntaxHighlighting } from '@codemirror/language';
|
||||
import { tags as t } from '@lezer/highlight';
|
||||
@@ -81,6 +83,13 @@ function codeBlockLanguageResolver(info: string): Language | LanguageDescription
|
||||
case 'rs':
|
||||
case 'rust':
|
||||
return rust().language;
|
||||
case 'c':
|
||||
case 'cpp':
|
||||
case 'h':
|
||||
case 'hpp':
|
||||
return cpp().language;
|
||||
case 'go':
|
||||
return go().language;
|
||||
case 'ex':
|
||||
case 'exs':
|
||||
case 'elixir':
|
||||
@@ -210,6 +219,13 @@ export function languageByExtension(filePath: string): Extension | null {
|
||||
return xml();
|
||||
case 'rs':
|
||||
return rust();
|
||||
case 'c':
|
||||
case 'cpp':
|
||||
case 'h':
|
||||
case 'hpp':
|
||||
return cpp();
|
||||
case 'go':
|
||||
return go();
|
||||
|
||||
// Legacy modes
|
||||
case 'rb':
|
||||
|
||||
Reference in New Issue
Block a user