@@ -3,6 +3,7 @@ import { parser } from "./syntax.grammar";
33import {
44 LRLanguage ,
55 LanguageSupport ,
6+ LanguageDescription ,
67 indentNodeProp ,
78 foldNodeProp ,
89 foldInside ,
@@ -40,11 +41,15 @@ function docCommentXmlOverlay(from: number, content: string) {
4041 return ranges . length > 0 ? ranges : null ;
4142}
4243
44+ /** A language provider for C#. */
4345export const csharpLanguage = LRLanguage . define ( {
4446 parser : parser . configure ( {
4547 props : [
4648 indentNodeProp . add ( {
47- Delim : continuedIndent ( { except : / ^ \s * [ \) \] \} ] / } ) ,
49+ BracesDelim : continuedIndent ( { except : / ^ \s * [ \} ] / } ) ,
50+ BracketsDelim : continuedIndent ( { except : / ^ \s * [ \] ] / } ) ,
51+ ParensDelim : continuedIndent ( { except : / ^ \s * [ \) ] / } ) ,
52+ ChevronsDelim : continuedIndent ( { except : / ^ \s * [ \> ] / } ) ,
4853 IfStmt : continuedIndent ( { except : / ^ \s * ( { | e l s e \b ) / } ) ,
4954 TryStmt : continuedIndent ( { except : / ^ \s * ( { | c a t c h \b | f i n a l l y \b ) / } ) ,
5055 LabeledStmt : flatIndent ,
@@ -116,6 +121,11 @@ export const csharpLanguage = LRLanguage.define({
116121import { Prec } from "@codemirror/state" ;
117122import { continueDocComment } from "./keymap" ;
118123import { csharpCompletion } from "./complete" ;
124+
125+ /**
126+ * Gets C# support. Includes {@link continueDocComment}, {@link csharpCompletion} and {@link xml.support}.
127+ * @returns A {@link LanguageSupport} instance for C#.
128+ */
119129export function csharp ( ) {
120130 return new LanguageSupport ( csharpLanguage , [
121131 Prec . high ( continueDocComment ) ,
@@ -124,4 +134,17 @@ export function csharp() {
124134 } ) ,
125135 xml . support
126136 ] ) ;
137+ }
138+
139+ /**
140+ * Gets C# language description.
141+ * @returns A {@link LanguageDescription} instance for C#.
142+ */
143+ export function csharpData ( ) {
144+ return LanguageDescription . of ( {
145+ name : "C#" ,
146+ alias : [ "csharp" , "cs" ] ,
147+ extensions : [ "cs" , "csx" ] ,
148+ support : csharp ( )
149+ } ) ;
127150}
0 commit comments