Skip to content

Commit 7a6e6b3

Browse files
committed
Redo the order of autcompletion
1 parent 203777a commit 7a6e6b3

3 files changed

Lines changed: 29 additions & 25 deletions

File tree

client/src/test/suite/completion.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,8 @@ export async function testCompletion(
219219
assert.equal(
220220
actualCompletionList.items.length,
221221
expectedCompletionList.items.length,
222-
"Completion List doesn't have expected size"
222+
"Completion List doesn't have expected size: " +
223+
JSON.stringify(actualCompletionList.items)
223224
);
224225
expectedCompletionList.items
225226
.sort((a, b) => (a.label > b.label ? 1 : -1))

server/src/cfnSettings.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -49,37 +49,13 @@ export class SettingsState extends YamlSettingsState {
4949
cfnLintIgnoreRules: Array<string> = [];
5050
cfnLintOverrideSpecPath: string = "";
5151

52-
indentation: string = " ";
53-
5452
pendingValidationRequests: { [uri: string]: NodeJS.Timeout } = {};
5553
validationDelayMs = 200;
5654

5755
isPreviewing: { [index: string]: boolean } = {};
5856

5957
constructor() {
6058
super();
61-
this.customTags = [
62-
"!And sequence",
63-
"!If sequence",
64-
"!Not sequence",
65-
"!Equals sequence",
66-
"!Or sequence",
67-
"!FindInMap sequence",
68-
"!Base64 scalar",
69-
"!Join sequence",
70-
"!Cidr sequence",
71-
"!Ref scalar",
72-
"!Sub scalar",
73-
"!Sub sequence",
74-
"!GetAtt scalar",
75-
"!GetAtt sequence",
76-
"!GetAZs mapping",
77-
"!GetAZs scalar",
78-
"!ImportValue mapping",
79-
"!ImportValue scalar",
80-
"!Select sequence",
81-
"!Split sequence",
82-
];
8359
this.schemaStoreEnabled = false;
8460
}
8561
}

server/src/server/handlers/languageHandlers.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,24 @@ export class LanguageHandlers extends YamlLanguageHandlers {
4242
private cfnLanguageService: LanguageService;
4343
private cfnSettings: SettingsState;
4444
private cfnConnection: Connection;
45+
private customTags: string[] = [
46+
"!And",
47+
"!Base64",
48+
"!Cidr",
49+
"!Equals",
50+
"!FindInMap",
51+
"!GetAtt",
52+
"!GetAZs",
53+
"!If",
54+
"!ImportValue",
55+
"!Join",
56+
"!Not",
57+
"!Or",
58+
"!Ref",
59+
"!Select",
60+
"!Split",
61+
"!Sub",
62+
];
4563

4664
pendingLimitExceededWarnings: {
4765
[uri: string]: {
@@ -119,6 +137,15 @@ export class LanguageHandlers extends YamlLanguageHandlers {
119137
}
120138

121139
if (this.cfnSettings.yamlShouldCompletion) {
140+
for (var fn of this.customTags) {
141+
results.items.push({
142+
label: fn,
143+
sortText: "zzzzzzzzzz",
144+
insertText: fn + " ",
145+
insertTextFormat: 2,
146+
kind: 12,
147+
});
148+
}
122149
try {
123150
if (node !== null && template !== null) {
124151
if (isNode(node.internalNode)) {

0 commit comments

Comments
 (0)