File tree Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -432,6 +432,10 @@ function constructArgs(ctx: vscode.ExtensionContext): string[] {
432
432
args . push ( '--includeCompletionsWithSnippetText' ) ;
433
433
}
434
434
435
+ if ( ! anyProjectSupportsBlockSyntax ( ) ) {
436
+ args . push ( '--disableBlockSyntax' ) ;
437
+ }
438
+
435
439
const forceStrictTemplates = config . get < boolean > ( 'angular.forceStrictTemplates' ) ;
436
440
if ( forceStrictTemplates ) {
437
441
args . push ( '--forceStrictTemplates' ) ;
@@ -505,3 +509,20 @@ function extensionVersionCompatibleWithAllProjects(serverModuleLocation: string)
505
509
}
506
510
return true ;
507
511
}
512
+
513
+ /**
514
+ * Returns true if any project in the workspace supports block syntax (v17+).
515
+ */
516
+ function anyProjectSupportsBlockSyntax ( ) {
517
+ const workspaceFolders = vscode . workspace . workspaceFolders || [ ] ;
518
+ for ( const workspaceFolder of workspaceFolders ) {
519
+ const angularCore = resolve ( '@angular/core' , workspaceFolder . uri . fsPath ) ;
520
+ if ( angularCore === undefined ) {
521
+ continue ;
522
+ }
523
+ if ( angularCore . version . major >= 17 ) {
524
+ return true ;
525
+ }
526
+ }
527
+ return false ;
528
+ }
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ interface CommandLineOptions {
36
36
includeAutomaticOptionalChainCompletions : boolean ;
37
37
includeCompletionsWithSnippetText : boolean ;
38
38
forceStrictTemplates : boolean ;
39
+ disableBlockSyntax : boolean ;
39
40
}
40
41
41
42
export function parseCommandLine ( argv : string [ ] ) : CommandLineOptions {
@@ -50,6 +51,7 @@ export function parseCommandLine(argv: string[]): CommandLineOptions {
50
51
hasArgument ( argv , '--includeAutomaticOptionalChainCompletions' ) ,
51
52
includeCompletionsWithSnippetText : hasArgument ( argv , '--includeCompletionsWithSnippetText' ) ,
52
53
forceStrictTemplates : hasArgument ( argv , '--forceStrictTemplates' ) ,
54
+ disableBlockSyntax : hasArgument ( argv , '--disableBlockSyntax' ) ,
53
55
} ;
54
56
}
55
57
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ function main() {
46
46
includeAutomaticOptionalChainCompletions : options . includeAutomaticOptionalChainCompletions ,
47
47
includeCompletionsWithSnippetText : options . includeCompletionsWithSnippetText ,
48
48
forceStrictTemplates : isG3 || options . forceStrictTemplates ,
49
+ disableBlockSyntax : options . disableBlockSyntax ,
49
50
} ) ;
50
51
51
52
// Log initialization info
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ export interface SessionOptions {
33
33
includeAutomaticOptionalChainCompletions : boolean ;
34
34
includeCompletionsWithSnippetText : boolean ;
35
35
forceStrictTemplates : boolean ;
36
+ disableBlockSyntax : boolean ;
36
37
}
37
38
38
39
enum LanguageId {
@@ -156,6 +157,9 @@ export class Session {
156
157
if ( options . forceStrictTemplates ) {
157
158
pluginConfig . forceStrictTemplates = true ;
158
159
}
160
+ if ( options . disableBlockSyntax ) {
161
+ ( pluginConfig as any ) . enableBlockSyntax = false ;
162
+ }
159
163
projSvc . configurePlugin ( {
160
164
pluginName : options . ngPlugin ,
161
165
configuration : pluginConfig ,
You can’t perform that action at this time.
0 commit comments