Skip to content

Commit 9c993ce

Browse files
committed
implement indenter settings
1 parent 920b6ae commit 9c993ce

File tree

6 files changed

+469
-116
lines changed

6 files changed

+469
-116
lines changed

rubberduckvba.Server/Program.cs

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -50,46 +50,26 @@ public static void Main(string[] args)
5050
policy
5151
.SetIsOriginAllowed(origin => true)
5252
.AllowAnyHeader()
53-
.AllowAnyMethod()
53+
.WithMethods("OPTIONS", "GET", "POST")
5454
.AllowCredentials()
5555
.Build();
5656
});
57-
/*
58-
var guestPolicy = new CorsPolicyBuilder()
59-
.SetIsOriginAllowed(origin => true)
60-
.WithHeaders("Content-Type", "Accept")
61-
.WithExposedHeaders("X-ACCESS-TOKEN")
62-
.WithMethods("GET", "POST", "OPTIONS")
63-
.DisallowCredentials()
64-
.SetPreflightMaxAge(TimeSpan.FromHours(48))
65-
.Build();
66-
//builder.AddDefaultPolicy(guestPolicy);
67-
//builder.DefaultPolicyName = nameof(guestPolicy);
68-
builder.AddPolicy(nameof(guestPolicy), guestPolicy);
69-
70-
var webhookPolicy = new CorsPolicyBuilder()
71-
#if DEBUG
72-
.SetIsOriginAllowed(origin => true)
73-
#else
74-
.SetIsOriginAllowedToAllowWildcardSubdomains()
75-
.WithOrigins("*.github.com")
76-
#endif
77-
.WithHeaders("Content-Type", "X-GitHub-Event", "X-GitHub-Delivery", "X-GitHub-Hook-ID", "X-Hub-Signature", "X-Hub-Signature256")
78-
.WithMethods("POST")
79-
.DisallowCredentials()
80-
.SetPreflightMaxAge(TimeSpan.FromHours(48))
81-
.Build();
82-
builder.AddPolicy(nameof(webhookPolicy), webhookPolicy);
83-
84-
var adminPolicy = new CorsPolicyBuilder()
85-
.SetIsOriginAllowed(origin => true)
86-
.WithHeaders("Content-Type", "Authorization")
87-
.WithExposedHeaders("X-ACCESS-TOKEN")
88-
.WithMethods("GET", "POST")
89-
.SetPreflightMaxAge(TimeSpan.FromHours(48))
90-
.Build();
91-
builder.AddPolicy(nameof(adminPolicy), adminPolicy);
92-
*/
57+
58+
builder.AddPolicy("webhookPolicy", policy =>
59+
{
60+
policy
61+
#if DEBUG
62+
.SetIsOriginAllowed(origin => true)
63+
#else
64+
.SetIsOriginAllowedToAllowWildcardSubdomains()
65+
.WithOrigins("*.github.com")
66+
#endif
67+
.WithHeaders("Content-Type", "X-GitHub-Event", "X-GitHub-Delivery", "X-GitHub-Hook-ID", "X-Hub-Signature", "X-Hub-Signature256")
68+
.WithMethods("POST")
69+
.DisallowCredentials()
70+
.SetPreflightMaxAge(TimeSpan.FromHours(48))
71+
.Build();
72+
});
9373
});
9474

9575
builder.Services.AddAuthentication(options =>

rubberduckvba.client/src/app/app.module.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,5 @@ export class LowerCaseUrlSerializer extends DefaultUrlSerializer {
111111
}
112112
]
113113
})
114+
114115
export class AppModule { }

rubberduckvba.client/src/app/components/example-box/example-box.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="accordion" id="exampleBoxAccordion">
22
<div class="card my-2">
33
<div class="card-header bg-light-subtle my-0 py-0" id="exampleBoxHeading">
4-
<div *ngIf="isInspection && inspectionExample" class="btn btn-link text-nowrap text-decoration-none w-100" role="button" data-toggle="collapse" data-target="#featureItemBoxCollapseBody" aria-controls="featureItemBoxCollapseBody" (click)="inspectionExample.isCollapsed = !inspectionExample.isCollapsed">
4+
<div *ngIf="isInspection && inspectionExample" class="btn btn-link text-nowrap text-decoration-none w-100" role="button" data-bs-toggle="collapse" data-bs-target="#featureItemBoxCollapseBody" aria-controls="featureItemBoxCollapseBody" (click)="inspectionExample.isCollapsed = !inspectionExample.isCollapsed">
55
<div class="row my-0 py-0">
66
<div class="col-1">
77
&nbsp;
@@ -20,7 +20,7 @@ <h4>
2020
</div>
2121
</div>
2222

23-
<div *ngIf="isQuickFix && quickFixExample" class="btn btn-link text-nowrap text-decoration-none w-100" role="button" data-toggle="collapse" data-target="#featureItemBoxCollapseBody" aria-controls="featureItemBoxCollapseBody" (click)="quickFixExample.isCollapsed = !quickFixExample.isCollapsed">
23+
<div *ngIf="isQuickFix && quickFixExample" class="btn btn-link text-nowrap text-decoration-none w-100" role="button" data-bs-toggle="collapse" data-bs-target="#featureItemBoxCollapseBody" aria-controls="featureItemBoxCollapseBody" (click)="quickFixExample.isCollapsed = !quickFixExample.isCollapsed">
2424
<div class="row my-0 py-0">
2525
<div class="col-1">
2626
&nbsp;
@@ -39,7 +39,7 @@ <h4>
3939
</div>
4040
</div>
4141

42-
<div *ngIf="isAnnotation && annotationExample" class="btn btn-link text-nowrap text-decoration-none w-100" role="button" data-toggle="collapse" data-target="#featureItemBoxCollapseBody" aria-controls="featureItemBoxCollapseBody" (click)="annotationExample.isCollapsed = !annotationExample.isCollapsed">
42+
<div *ngIf="isAnnotation && annotationExample" class="btn btn-link text-nowrap text-decoration-none w-100" role="button" data-bs-toggle="collapse" data-bs-target="#featureItemBoxCollapseBody" aria-controls="featureItemBoxCollapseBody" (click)="annotationExample.isCollapsed = !annotationExample.isCollapsed">
4343
<div class="row my-0 py-0">
4444
<div class="col-1">
4545
&nbsp;

rubberduckvba.client/src/app/model/indenter.model.ts

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,44 +13,44 @@ export enum IndenterEndOfLineCommentStyle {
1313

1414

1515
export interface IndenterViewModel {
16-
indenterVersion: string;
17-
code: string;
18-
indentedCode: string;
16+
indenterVersion: string;
17+
code: string;
18+
indentedCode: string;
1919

20-
// indent
21-
indentSpaces: number;
22-
emptyLineHandlingMethod: IndenterEmptyLineHandling;
23-
indentEntireProcedureBody: boolean;
24-
indentFirstDeclarationBlock: boolean;
25-
indentFirstCommentBlock: boolean;
26-
ignoreEmptyLinesInFirstBlock: boolean;
27-
indentEnumTypeAsProcedure: boolean;
28-
indentCase: boolean;
20+
// indent
21+
indentSpaces: number;
22+
emptyLineHandlingMethod: IndenterEmptyLineHandling;
23+
indentEntireProcedureBody: boolean;
24+
indentFirstDeclarationBlock: boolean;
25+
indentFirstCommentBlock: boolean;
26+
ignoreEmptyLinesInFirstBlock: boolean;
27+
indentEnumTypeAsProcedure: boolean;
28+
indentCase: boolean;
2929

30-
// outdent
31-
indentCompilerDirectives: boolean;
32-
forceCompilerDirectivesInColumn1: boolean;
33-
forceDebugPrintInColumn1: boolean;
34-
forceStopInColumn1: boolean;
35-
forceDebugAssertInColumn1: boolean;
36-
forceDebugStatementsInColumn1: boolean;
30+
// outdent
31+
//indentCompilerDirectives: boolean;
32+
forceCompilerDirectivesInColumn1: boolean;
33+
forceDebugPrintInColumn1: boolean;
34+
forceDebugAssertInColumn1: boolean;
35+
forceDebugStatementsInColumn1: boolean;
36+
forceStopInColumn1: boolean;
3737

38-
// alignment
39-
alignContinuations: boolean;
40-
ignoreOperatorsInContinuations: boolean;
41-
alignDims: boolean;
42-
alignDimColumn: number;
38+
// alignment
39+
alignContinuations: boolean;
40+
ignoreOperatorsInContinuations: boolean;
41+
alignDims: boolean;
42+
alignDimColumn: number;
4343

4444

45-
// comments
46-
alignCommentsWithCode: boolean;
47-
endOfLineCommentStyle: IndenterEndOfLineCommentStyle;
48-
endOfLineCommentColumnSpaceAlignment: number;
45+
// comments
46+
alignCommentsWithCode: boolean;
47+
endOfLineCommentStyle: IndenterEndOfLineCommentStyle;
48+
endOfLineCommentColumnSpaceAlignment: number;
4949

50-
// vertical spacing
51-
groupRelatedProperties: boolean;
52-
verticallySpaceProcedures: boolean;
53-
linesBetweenProcedures: number;
50+
// vertical spacing
51+
groupRelatedProperties: boolean;
52+
verticallySpaceProcedures: boolean;
53+
linesBetweenProcedures: number;
5454
}
5555

5656
export class IndenterVersionViewModelClass {
@@ -72,7 +72,7 @@ export class IndenterViewModelClass implements IndenterViewModel {
7272
ignoreEmptyLinesInFirstBlock: boolean;
7373
indentEnumTypeAsProcedure: boolean;
7474
indentCase: boolean;
75-
indentCompilerDirectives: boolean;
75+
//indentCompilerDirectives: boolean;
7676
forceCompilerDirectivesInColumn1: boolean;
7777
forceStopInColumn1: boolean;
7878
forceDebugPrintInColumn1: boolean;
@@ -92,7 +92,7 @@ export class IndenterViewModelClass implements IndenterViewModel {
9292
constructor(model: IndenterViewModel) {
9393
this.indenterVersion = model.indenterVersion;
9494
this.code = model.code;
95-
this.indentedCode = model.indentedCode;
95+
this.indentedCode = model.indentedCode ?? model.code;
9696

9797
this.indentSpaces = model.indentSpaces;
9898
this.emptyLineHandlingMethod = model.emptyLineHandlingMethod;
@@ -102,7 +102,7 @@ export class IndenterViewModelClass implements IndenterViewModel {
102102
this.ignoreEmptyLinesInFirstBlock = model.ignoreEmptyLinesInFirstBlock;
103103
this.indentEnumTypeAsProcedure = model.indentEnumTypeAsProcedure;
104104
this.indentCase = model.indentCase;
105-
this.indentCompilerDirectives = model.indentCompilerDirectives;
105+
//this.indentCompilerDirectives = model.indentCompilerDirectives;
106106
this.forceCompilerDirectivesInColumn1 = model.forceCompilerDirectivesInColumn1;
107107
this.forceStopInColumn1 = model.forceStopInColumn1;
108108
this.forceDebugPrintInColumn1 = model.forceDebugPrintInColumn1;

0 commit comments

Comments
 (0)