Skip to content

Commit 41cc796

Browse files
committed
fix lint errors, handle top level sections in formatter
1 parent 6c69ac8 commit 41cc796

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/autocomplete/CompletionFormatter.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { SchemaRetriever } from '../schema/SchemaRetriever';
1717
import { EditorSettings } from '../settings/Settings';
1818
import { LoggerFactory } from '../telemetry/LoggerFactory';
1919
import { getIndentationString } from '../utils/IndentationUtils';
20-
import { RESOURCE_ATTRIBUTE_TYPES } from './CompletionUtils';
20+
import { RESOURCE_ATTRIBUTE_TYPES} from './CompletionUtils';
2121

2222
export type CompletionItemData = {
2323
type?: 'object' | 'array' | 'simple';
@@ -134,14 +134,20 @@ export class CompletionFormatter {
134134
let formatAsArray = itemData?.type === 'array';
135135
let formatAsString = false;
136136

137+
if (this.isTopLevelSection(label)) {
138+
if (label === String(TopLevelSection.Description)) {
139+
formatAsString = true;
140+
} else {
141+
formatAsObject = true;
142+
}
143+
}
137144
// If type is not in item.data and we have schemaRetriever, look it up from schema
138145
if ((!itemData?.type || itemData?.type === 'simple') && schemaRetriever && context.entity) {
139146
const propertyType = this.getPropertyTypeFromSchema(schemaRetriever, context, label);
140147

141148
switch (propertyType) {
142149
case 'object': {
143150
formatAsObject = true;
144-
145151
break;
146152
}
147153
case 'array': {

src/autocomplete/CompletionRouter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ export class CompletionRouter implements SettingsConfigurable, Closeable {
277277
}
278278

279279
static create(core: CfnInfraCore, external: CfnExternal, providers: CfnLspProviders) {
280-
CompletionFormatter.getInstance();
280+
CompletionFormatter.getInstance();
281281
return new CompletionRouter(
282282
core.contextManager,
283283
createCompletionProviders(core, external, providers),

0 commit comments

Comments
 (0)