|
9 | 9 | import {AST, ASTWithSource, BindingPipe, BindingType, Call, EmptyExpr, ImplicitReceiver, LiteralPrimitive, ParsedEventType, ParseSourceSpan, PropertyRead, PropertyWrite, SafePropertyRead, TmplAstBoundAttribute, TmplAstBoundEvent, TmplAstElement, TmplAstNode, TmplAstReference, TmplAstTemplate, TmplAstText, TmplAstTextAttribute, TmplAstVariable} from '@angular/compiler';
|
10 | 10 | import {NgCompiler} from '@angular/compiler-cli/src/ngtsc/core';
|
11 | 11 | import {CompletionKind, PotentialDirective, SymbolKind, TemplateDeclarationSymbol} from '@angular/compiler-cli/src/ngtsc/typecheck/api';
|
12 |
| -import {BoundEvent, DeferredBlock, TextAttribute, UnknownBlock} from '@angular/compiler/src/render3/r3_ast'; |
| 12 | +import {BoundEvent, DeferredBlock, SwitchBlock, TextAttribute, UnknownBlock} from '@angular/compiler/src/render3/r3_ast'; |
13 | 13 | import ts from 'typescript';
|
14 | 14 |
|
15 | 15 | import {addAttributeCompletionEntries, AsciiSortPriority, AttributeCompletionKind, buildAnimationCompletionEntries, buildAttributeCompletionTable, getAttributeCompletionSymbol} from './attribute_completions';
|
@@ -130,15 +130,18 @@ export class CompletionBuilder<N extends TmplAstNode|AST> {
|
130 | 130 | length: this.node.name.length,
|
131 | 131 | }
|
132 | 132 | };
|
133 |
| - const completionEntries: ts.CompletionEntry[] = [ |
134 |
| - ...blocksWithParens, ...blocksWithoutParens |
135 |
| - ].map(name => ({ |
136 |
| - name, |
137 |
| - sortText: `${AsciiSortPriority.First}${name}`, |
138 |
| - insertText: buildBlockSnippet(useSnippet, name, blocksWithParens.includes(name)), |
139 |
| - isSnippet: useSnippet || undefined, |
140 |
| - ...partialCompletionEntryWholeBlock, |
141 |
| - })); |
| 133 | + let competionKeywords: string[] = [...blocksWithParens, ...blocksWithoutParens]; |
| 134 | + if (this.nodeParent instanceof SwitchBlock) { |
| 135 | + competionKeywords = ['case', 'default']; |
| 136 | + } |
| 137 | + const completionEntries: ts.CompletionEntry[] = competionKeywords.map( |
| 138 | + name => ({ |
| 139 | + name, |
| 140 | + sortText: `${AsciiSortPriority.First}${name}`, |
| 141 | + insertText: buildBlockSnippet(useSnippet, name, blocksWithParens.includes(name)), |
| 142 | + isSnippet: useSnippet || undefined, |
| 143 | + ...partialCompletionEntryWholeBlock, |
| 144 | + })); |
142 | 145 |
|
143 | 146 | // Return the completions.
|
144 | 147 | const completionInfo: ts.CompletionInfo = {
|
|
0 commit comments