Skip to content

Commit

Permalink
Add folding rules
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdima committed Mar 14, 2018
1 parent 46247f8 commit 21ac5f1
Show file tree
Hide file tree
Showing 17 changed files with 115 additions and 15 deletions.
8 changes: 7 additions & 1 deletion src/bat/bat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ export const conf: IRichLanguageConfiguration = {
{ open: '[', close: ']' },
{ open: '(', close: ')' },
{ open: '"', close: '"' },
]
],
folding: {
markers: {
start: new RegExp("^\\s*(::\\s*|REM\\s+)#region"),
end: new RegExp("^\\s*(::\\s*|REM\\s+)#endregion")
}
}
};

export const language = <ILanguage>{
Expand Down
8 changes: 7 additions & 1 deletion src/coffee/coffee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ export const conf: IRichLanguageConfiguration = {
{ open: '(', close: ')' },
{ open: '"', close: '"' },
{ open: '\'', close: '\'' },
]
],
folding: {
markers: {
start: new RegExp("^\\s*#region\\b"),
end: new RegExp("^\\s*#endregion\\b")
}
}
};

export const language = <ILanguage>{
Expand Down
8 changes: 7 additions & 1 deletion src/cpp/cpp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ export const conf: IRichLanguageConfiguration = {
{ open: '(', close: ')' },
{ open: '"', close: '"' },
{ open: '\'', close: '\'' },
]
],
folding: {
markers: {
start: new RegExp("^\\s*#pragma\\s+region\\b"),
end: new RegExp("^\\s*#pragma\\s+endregion\\b")
}
}
};

export const language = <ILanguage>{
Expand Down
8 changes: 7 additions & 1 deletion src/csharp/csharp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ export const conf: IRichLanguageConfiguration = {
{ open: '<', close: '>' },
{ open: '\'', close: '\'' },
{ open: '"', close: '"' },
]
],
folding: {
markers: {
start: new RegExp("^\\s*#region\\b"),
end: new RegExp("^\\s*#endregion\\b")
}
}
};

export const language = <ILanguage>{
Expand Down
9 changes: 8 additions & 1 deletion src/css/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,14 @@ export const conf: LanguageConfiguration = {
{ open: '(', close: ')' },
{ open: '"', close: '"' },
{ open: '\'', close: '\'' }
]
],

folding: {
markers: {
start: new RegExp("^\\s*\\/\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\/"),
end: new RegExp("^\\s*\\/\\*\\s*#endregion\\b.*\\*\\/")
}
}
};

export const language = <IMonarchLanguage>{
Expand Down
8 changes: 7 additions & 1 deletion src/fsharp/fsharp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ export const conf: IRichLanguageConfiguration = {
{ open: '(', close: ')' },
{ open: '"', close: '"' },
{ open: '\'', close: '\'' }
]
],
folding: {
markers: {
start: new RegExp("^\\s*//\\s*#region\\b|^\\s*\\(\\*\\s*#region(.*)\\*\\)"),
end: new RegExp("^\\s*//\\s*#endregion\\b|^\\s*\\(\\*\\s*#endregion\\s*\\*\\)")
}
}
};

export const language = <ILanguage>{
Expand Down
7 changes: 7 additions & 0 deletions src/html/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ export const conf: IRichLanguageConfiguration = {
action: { indentAction: _monaco.languages.IndentAction.Indent }
}
],

folding: {
markers: {
start: new RegExp("^\\s*<!--\\s*#region\\b.*-->"),
end: new RegExp("^\\s*<!--\\s*#endregion\\b.*-->")
}
}
};

export const language = <ILanguage>{
Expand Down
8 changes: 7 additions & 1 deletion src/java/java.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ export const conf: IRichLanguageConfiguration = {
{ open: '"', close: '"' },
{ open: '\'', close: '\'' },
{ open: '<', close: '>' },
]
],
folding: {
markers: {
start: new RegExp("^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))"),
end: new RegExp("^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))")
}
}
};

export const language = <ILanguage>{
Expand Down
8 changes: 7 additions & 1 deletion src/less/less.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ export const conf: IRichLanguageConfiguration = {
{ open: '(', close: ')' },
{ open: '"', close: '"' },
{ open: '\'', close: '\'' },
]
],
folding: {
markers: {
start: new RegExp("^\\s*\\/\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\/"),
end: new RegExp("^\\s*\\/\\*\\s*#endregion\\b.*\\*\\/")
}
}
};

export const language = <ILanguage>{
Expand Down
8 changes: 7 additions & 1 deletion src/markdown/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ export const conf: IRichLanguageConfiguration = {
{ open: '(', close: ')' },
{ open: '[', close: ']' },
{ open: '`', close: '`' },
]
],
folding: {
markers: {
start: new RegExp("^\\s*<!--\\s*#?region\\b.*-->"),
end: new RegExp("^\\s*<!--\\s*#?endregion\\b.*-->")
}
}
};

export const language = <ILanguage>{
Expand Down
9 changes: 8 additions & 1 deletion src/php/php.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ export const conf: IRichLanguageConfiguration = {
{ open: '(', close: ')', notIn: ['string'] },
{ open: '"', close: '"', notIn: ['string'] },
{ open: '\'', close: '\'', notIn: ['string', 'comment'] }
]
],

folding: {
markers: {
start: new RegExp("^\\s*(#|\/\/)region\\b"),
end: new RegExp("^\\s*(#|\/\/)endregion\\b")
}
}
};

export const language = <ILanguage>{
Expand Down
8 changes: 7 additions & 1 deletion src/powershell/powershell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ export const conf: IRichLanguageConfiguration = {
{ open: '(', close: ')' },
{ open: '"', close: '"' },
{ open: '\'', close: '\'' },
]
],
folding: {
markers: {
start: new RegExp("^\\s*#region\\b"),
end: new RegExp("^\\s*#endregion\\b")
}
}
};

export const language = <ILanguage>{
Expand Down
5 changes: 4 additions & 1 deletion src/pug/pug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ export const conf: IRichLanguageConfiguration = {
{ open: '{', close: '}', notIn: ['string', 'comment'] },
{ open: '[', close: ']', notIn: ['string', 'comment'] },
{ open: '(', close: ')', notIn: ['string', 'comment'] },
]
],
folding: {
offSide: true
}
};

export const language = <ILanguage>{
Expand Down
9 changes: 8 additions & 1 deletion src/python/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,14 @@ export const conf: IRichLanguageConfiguration = {
{ open: '(', close: ')' },
{ open: '"', close: '"' },
{ open: '\'', close: '\'' },
]
],
folding: {
offSide: true,
markers: {
start: new RegExp("^\\s*#region\\b"),
end: new RegExp("^\\s*#endregion\\b")
}
}
};

export const language = <ILanguage>{
Expand Down
8 changes: 7 additions & 1 deletion src/scss/scss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ export const conf: LanguageConfiguration = {
{ open: '(', close: ')' },
{ open: '"', close: '"' },
{ open: '\'', close: '\'' },
]
],
folding: {
markers: {
start: new RegExp("^\\s*\\/\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\/"),
end: new RegExp("^\\s*\\/\\*\\s*#endregion\\b.*\\*\\/")
}
}
};

export const language = <IMonarchLanguage>{
Expand Down
8 changes: 7 additions & 1 deletion src/vb/vb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@ export const conf: IRichLanguageConfiguration = {
{ open: '(', close: ')', notIn: ['string', 'comment'] },
{ open: '"', close: '"', notIn: ['string', 'comment'] },
{ open: '<', close: '>', notIn: ['string', 'comment'] },
]
],
folding: {
markers: {
start: new RegExp("^\\s*#Region\\b"),
end: new RegExp("^\\s*#End Region\\b")
}
}
};

export const language = <ILanguage>{
Expand Down
3 changes: 3 additions & 0 deletions src/yaml/yaml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export const conf: IRichLanguageConfiguration = {
{ open: '"', close: '"' },
{ open: '\'', close: '\'' },
],
folding: {
offSide: true
}
};

export const language = <ILanguage>{
Expand Down

0 comments on commit 21ac5f1

Please sign in to comment.