本文整理汇总了C#中CodeFormattingOptions类的典型用法代码示例。如果您正苦于以下问题:C# CodeFormattingOptions类的具体用法?C# CodeFormattingOptions怎么用?C# CodeFormattingOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CodeFormattingOptions类属于命名空间,在下文中一共展示了CodeFormattingOptions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AppendCodeString
internal override void AppendCodeString(StringBuilder res, PythonAst ast, CodeFormattingOptions format) {
Target.AppendCodeString(res, ast, format);
format.Append(
res,
format.SpaceBeforeIndexBracket,
" ",
"",
this.GetProceedingWhiteSpace(ast)
);
res.Append('[');
_index.AppendCodeString(
res,
ast,
format,
format.SpaceWithinIndexBrackets != null ? format.SpaceWithinIndexBrackets.Value ? " " : "" : null
);
if (!this.IsMissingCloseGrouping(ast)) {
format.Append(
res,
format.SpaceWithinIndexBrackets,
" ",
"",
this.GetSecondWhiteSpace(ast)
);
res.Append(']');
}
}
开发者ID:RussBaz,项目名称:PTVS,代码行数:29,代码来源:IndexExpression.cs
示例2: AppendCodeString
internal override void AppendCodeString(StringBuilder res, PythonAst ast, CodeFormattingOptions format) {
if (this.IsAltForm(ast)) {
this.AppendCodeString(res, ast, format, "", "", _item);
} else {
this.AppendCodeString(res, ast, format, "(", this.IsMissingCloseGrouping(ast) ? "" : ")", _item);
}
}
开发者ID:wenh123,项目名称:PTVS,代码行数:7,代码来源:GeneratorExpression.cs
示例3: AppendCodeString
internal override void AppendCodeString(StringBuilder res, JAst ast, CodeFormattingOptions format)
{
if (_preceeding != null) {
_preceeding.AppendCodeString(res, ast, format);
}
res.Append(_verbatimImage ?? "<error>");
}
开发者ID:borota,项目名称:JTVS,代码行数:7,代码来源:ErrorExpression.cs
示例4: AppendCodeStringStmt
internal override void AppendCodeStringStmt(StringBuilder res, JAst ast, CodeFormattingOptions format)
{
foreach(var preceeding in _preceeding) {
preceeding.AppendCodeString(res, ast, format);
}
res.Append(this.GetVerbatimImage(ast) ?? "<error stmt>");
}
开发者ID:borota,项目名称:JTVS,代码行数:7,代码来源:ErrorStatement.cs
示例5: AppendCodeString
internal override void AppendCodeString(StringBuilder res, JAst ast, CodeFormattingOptions format, string leadingWhiteSpace)
{
string kwOnlyText = this.GetExtraVerbatimText(ast);
if (kwOnlyText != null) {
if (leadingWhiteSpace != null) {
res.Append(leadingWhiteSpace);
res.Append(kwOnlyText.TrimStart());
leadingWhiteSpace = null;
} else {
res.Append(kwOnlyText);
}
}
bool isAltForm = this.IsAltForm(ast);
if (isAltForm) {
res.Append(leadingWhiteSpace ?? this.GetProceedingWhiteSpace(ast));
res.Append('(');
leadingWhiteSpace = null;
}
_error.AppendCodeString(res, ast, format, leadingWhiteSpace);
if (this.DefaultValue != null) {
res.Append(this.GetSecondWhiteSpace(ast));
res.Append('=');
this.DefaultValue.AppendCodeString(res, ast, format);
}
if (isAltForm && !this.IsMissingCloseGrouping(ast)) {
res.Append(this.GetSecondWhiteSpace(ast));
res.Append(')');
}
}
开发者ID:borota,项目名称:JTVS,代码行数:29,代码来源:ErrorParameter.cs
示例6: AppendCodeStringStmt
internal override void AppendCodeStringStmt(StringBuilder res, PythonAst ast, CodeFormattingOptions format) {
_left.AppendCodeString(res, ast, format);
res.Append(this.GetProceedingWhiteSpace(ast));
res.Append(_op.ToCodeString());
res.Append('=');
_right.AppendCodeString(res, ast, format);
}
开发者ID:omnimark,项目名称:PTVS,代码行数:7,代码来源:AugmentedAssignStatement.cs
示例7: AppendCodeString
internal override void AppendCodeString(StringBuilder res, PythonAst ast, CodeFormattingOptions format) {
Expression left = _left;
Expression right = _right;
string op1, op2;
if (Operator == PythonOperator.NotIn) {
op1 = "not";
if (!this.IsIncompleteNode(ast)) {
op2 = "in";
} else {
op2 = null;
}
} else if (Operator == PythonOperator.IsNot) {
op1 = "is";
op2 = "not";
} else if ((op1 = this.GetVerbatimImage(ast)) != null) {
// operator image differs from the operator enum, for example <> is always NotEqual which is !=
// so we store the verbatim image and use it here.
op2 = null;
} else {
op1 = Operator.ToCodeString();
op2 = null;
}
BinaryToCodeString(res, ast, format, this, _left, _right, op1, op2);
}
开发者ID:RussBaz,项目名称:PTVS,代码行数:25,代码来源:BinaryExpression.cs
示例8: AppendCodeStringStmt
internal override void AppendCodeStringStmt(StringBuilder res, PythonAst ast, CodeFormattingOptions format) {
format.ReflowComment(res, this.GetProceedingWhiteSpace(ast));
res.Append("with");
var itemWhiteSpace = this.GetListWhiteSpace(ast);
int whiteSpaceIndex = 0;
for (int i = 0; i < _items.Length; i++) {
var item = _items[i];
if (i != 0) {
if (itemWhiteSpace != null) {
res.Append(itemWhiteSpace[whiteSpaceIndex++]);
}
res.Append(',');
}
item.ContextManager.AppendCodeString(res, ast, format);
if (item.Variable != null) {
if (itemWhiteSpace != null) {
res.Append(itemWhiteSpace[whiteSpaceIndex++]);
} else {
res.Append(' ');
}
res.Append("as");
item.Variable.AppendCodeString(res, ast, format);
}
}
_body.AppendCodeString(res, ast, format);
}
开发者ID:wenh123,项目名称:PTVS,代码行数:28,代码来源:WithStatement.cs
示例9: AppendCodeString
internal override void AppendCodeString(StringBuilder res, PythonAst ast, CodeFormattingOptions format) {
format.ReflowComment(res, this.GetProceedingWhiteSpaceDefaultNull(ast));
if (format.UseVerbatimImage) {
res.Append(this.GetVerbatimImage(ast) ?? _name);
} else {
res.Append(_name);
}
}
开发者ID:jsschultz,项目名称:PTVS,代码行数:8,代码来源:NameExpression.cs
示例10: AppendCodeString
internal override void AppendCodeString(StringBuilder res, PythonAst ast, CodeFormattingOptions format) {
_target.AppendCodeString(res, ast, format);
res.Append(this.GetProceedingWhiteSpaceDefaultNull(ast));
res.Append('.');
if (!this.IsIncompleteNode(ast)) {
res.Append(this.GetSecondWhiteSpaceDefaultNull(ast));
res.Append(this.GetVerbatimImage(ast) ?? _name);
}
}
开发者ID:wenh123,项目名称:PTVS,代码行数:9,代码来源:MemberExpression.cs
示例11: AppendCodeString
internal override void AppendCodeString(StringBuilder res, PythonAst ast, CodeFormattingOptions format) {
format.ReflowComment(res, this.GetProceedingWhiteSpace(ast));
res.Append('`');
_expression.AppendCodeString(res, ast, format);
if (!this.IsMissingCloseGrouping(ast)) {
res.Append(this.GetSecondWhiteSpace(ast));
res.Append('`');
}
}
开发者ID:wenh123,项目名称:PTVS,代码行数:9,代码来源:BackQuoteExpression.cs
示例12: AppendCodeString
internal override void AppendCodeString(StringBuilder res, PythonAst ast, CodeFormattingOptions format) {
res.Append(this.GetProceedingWhiteSpace(ast));
res.Append("for");
_lhs.AppendCodeString(res, ast, format);
if (!this.IsIncompleteNode(ast)) {
res.Append(this.GetSecondWhiteSpace(ast));
res.Append("in");
_list.AppendCodeString(res, ast, format);
}
}
开发者ID:omnimark,项目名称:PTVS,代码行数:10,代码来源:ComprehensionFor.cs
示例13: AppendCodeString
internal override void AppendCodeString(StringBuilder res, PythonAst ast, CodeFormattingOptions format) {
var whitespace = this.GetListWhiteSpace(ast);
for (int i = 0; i < _dotCount; i++) {
if (whitespace != null) {
res.Append(whitespace[i]);
}
res.Append('.');
}
base.AppendCodeString(res, ast, format);
}
开发者ID:wenh123,项目名称:PTVS,代码行数:10,代码来源:RelativeModuleName.cs
示例14: AppendCodeStringStmt
internal override void AppendCodeStringStmt(StringBuilder res, PythonAst ast, CodeFormattingOptions format) {
format.ReflowComment(res, this.GetProceedingWhiteSpace(ast));
res.Append("assert");
_test.AppendCodeString(res, ast, format);
if (_message != null) {
res.Append(this.GetSecondWhiteSpace(ast));
res.Append(',');
_message.AppendCodeString(res, ast, format);
}
}
开发者ID:omnimark,项目名称:PTVS,代码行数:10,代码来源:AssertStatement.cs
示例15: AppendCodeStringStmt
internal override void AppendCodeStringStmt(StringBuilder res, PythonAst ast, CodeFormattingOptions format) {
format.ReflowComment(res, this.GetProceedingWhiteSpace(ast));
res.Append("while");
_test.AppendCodeString(res, ast, format);
_body.AppendCodeString(res, ast, format);
if (_else != null) {
format.ReflowComment(res, this.GetSecondWhiteSpaceDefaultNull(ast));
res.Append("else");
_else.AppendCodeString(res, ast, format);
}
}
开发者ID:wenh123,项目名称:PTVS,代码行数:11,代码来源:WhileStatement.cs
示例16: AppendCodeString
internal override void AppendCodeString(StringBuilder res, PythonAst ast, CodeFormattingOptions format) {
_target.AppendCodeString(res, ast, format);
format.Append(
res,
format.SpaceBeforeCallParen,
" ",
"",
this.GetProceedingWhiteSpaceDefaultNull(ast)
);
res.Append('(');
if (_args.Length == 0) {
if (format.SpaceWithinEmptyCallArgumentList != null && format.SpaceWithinEmptyCallArgumentList.Value) {
res.Append(' ');
}
} else {
var listWhiteSpace = this.GetListWhiteSpace(ast);
for (int i = 0; i < _args.Length; i++) {
if (i > 0) {
if (listWhiteSpace != null) {
res.Append(listWhiteSpace[i - 1]);
}
res.Append(',');
} else if (format.SpaceWithinCallParens != null) {
_args[i].AppendCodeString(res, ast, format, format.SpaceWithinCallParens.Value ? " " : "");
continue;
}
_args[i].AppendCodeString(res, ast, format);
}
if (listWhiteSpace != null && listWhiteSpace.Length == _args.Length) {
// trailing comma
res.Append(listWhiteSpace[listWhiteSpace.Length - 1]);
res.Append(",");
}
}
if (!this.IsMissingCloseGrouping(ast)) {
if (Args.Count != 0 ||
format.SpaceWithinEmptyCallArgumentList == null ||
!String.IsNullOrWhiteSpace(this.GetSecondWhiteSpaceDefaultNull(ast))) {
format.Append(
res,
format.SpaceWithinCallParens,
" ",
"",
this.GetSecondWhiteSpaceDefaultNull(ast)
);
}
res.Append(')');
}
}
开发者ID:wenh123,项目名称:PTVS,代码行数:54,代码来源:CallExpression.cs
示例17: AppendCodeString
internal override void AppendCodeString(StringBuilder res, PythonAst ast, CodeFormattingOptions format) {
format.ReflowComment(res, this.GetProceedingWhiteSpace(ast));
res.Append("await");
if (!this.IsAltForm(ast)) {
_expression.AppendCodeString(res, ast, format);
var itemWhiteSpace = this.GetListWhiteSpace(ast);
if (itemWhiteSpace != null) {
res.Append(",");
res.Append(itemWhiteSpace[0]);
}
}
}
开发者ID:wenh123,项目名称:PTVS,代码行数:12,代码来源:AwaitExpression.cs
示例18: AppendCodeStringStmt
internal override void AppendCodeStringStmt(StringBuilder res, PythonAst ast, CodeFormattingOptions format) {
var namesWhiteSpace = this.GetNamesWhiteSpace(ast);
if (namesWhiteSpace != null) {
ListExpression.AppendItems(res, ast, format, "nonlocal", "", this, Names.Count, (i, sb) => {
sb.Append(namesWhiteSpace[i]);
Names[i].AppendCodeString(res, ast, format);
});
} else {
ListExpression.AppendItems(res, ast, format, "nonlocal", "", this, Names.Count, (i, sb) => Names[i].AppendCodeString(sb, ast, format));
}
}
开发者ID:RussBaz,项目名称:PTVS,代码行数:12,代码来源:NonlocalStatement.cs
示例19: AppendCodeString
internal override void AppendCodeString(StringBuilder res, PythonAst ast, CodeFormattingOptions format) {
_expression.AppendCodeString(res, ast, format);
if (_annotation != null) {
// For now, use same formatting as around an assignment
if (format.SpacesAroundAssignmentOperator == null) {
res.Append(this.GetSecondWhiteSpaceDefaultNull(ast) ?? "");
} else if (format.SpacesAroundAssignmentOperator == true) {
res.Append(' ');
}
res.Append(':');
_annotation.AppendCodeString(res, ast, format);
}
}
开发者ID:jsschultz,项目名称:PTVS,代码行数:13,代码来源:ExpressionWithAnnotation.cs
示例20: AppendCodeStringStmt
internal override void AppendCodeStringStmt(StringBuilder res, PythonAst ast, CodeFormattingOptions format) {
format.ReflowComment(res, this.GetProceedingWhiteSpace(ast));
res.Append("print");
if (_dest != null) {
res.Append(this.GetSecondWhiteSpace(ast));
res.Append(">>");
_dest.AppendCodeString(res, ast, format);
if (_expressions.Length > 0) {
res.Append(this.GetThirdWhiteSpace(ast));
res.Append(',');
}
}
ListExpression.AppendItems(res, ast, format, "", "", this, Expressions);
}
开发者ID:omnimark,项目名称:PTVS,代码行数:14,代码来源:PrintStatement.cs
注:本文中的CodeFormattingOptions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论