@actions/languageserver 0.3.27 → 0.3.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.bundle.cjs +47 -6
- package/package.json +4 -4
package/dist/cli.bundle.cjs
CHANGED
|
@@ -24455,13 +24455,13 @@ var DefinitionValueMode;
|
|
|
24455
24455
|
DefinitionValueMode2[DefinitionValueMode2["Parent"] = 0] = "Parent";
|
|
24456
24456
|
DefinitionValueMode2[DefinitionValueMode2["Key"] = 1] = "Key";
|
|
24457
24457
|
})(DefinitionValueMode = DefinitionValueMode || (DefinitionValueMode = {}));
|
|
24458
|
-
function definitionValues(def, indentation, mode) {
|
|
24458
|
+
function definitionValues(def, indentation, mode, tokenStructure) {
|
|
24459
24459
|
const schema2 = getWorkflowSchema();
|
|
24460
24460
|
if (def instanceof MappingDefinition) {
|
|
24461
24461
|
return mappingValues(def, schema2.definitions, indentation, mode);
|
|
24462
24462
|
}
|
|
24463
24463
|
if (def instanceof OneOfDefinition) {
|
|
24464
|
-
return oneOfValues(def, schema2.definitions, indentation, mode);
|
|
24464
|
+
return oneOfValues(def, schema2.definitions, indentation, mode, tokenStructure);
|
|
24465
24465
|
}
|
|
24466
24466
|
if (def instanceof BooleanDefinition) {
|
|
24467
24467
|
return stringsToValues(["true", "false"]);
|
|
@@ -24540,10 +24540,20 @@ ${indentation}${key}: `;
|
|
|
24540
24540
|
}
|
|
24541
24541
|
return properties;
|
|
24542
24542
|
}
|
|
24543
|
-
function oneOfValues(oneOfDefinition, definitions, indentation, mode) {
|
|
24543
|
+
function oneOfValues(oneOfDefinition, definitions, indentation, mode, tokenStructure) {
|
|
24544
24544
|
const values = [];
|
|
24545
24545
|
for (const key of oneOfDefinition.oneOf) {
|
|
24546
|
-
|
|
24546
|
+
const variantDef = definitions[key];
|
|
24547
|
+
if (!variantDef) {
|
|
24548
|
+
continue;
|
|
24549
|
+
}
|
|
24550
|
+
if (tokenStructure) {
|
|
24551
|
+
const variantBucket = getStructuralBucket(variantDef.definitionType);
|
|
24552
|
+
if (variantBucket !== tokenStructure) {
|
|
24553
|
+
continue;
|
|
24554
|
+
}
|
|
24555
|
+
}
|
|
24556
|
+
values.push(...definitionValues(variantDef, indentation, mode, tokenStructure));
|
|
24547
24557
|
}
|
|
24548
24558
|
return distinctValues(values);
|
|
24549
24559
|
}
|
|
@@ -24570,17 +24580,22 @@ function expandOneOfToCompletions(oneOfDef, definitions, key, description, inden
|
|
|
24570
24580
|
sequence: false,
|
|
24571
24581
|
mapping: false
|
|
24572
24582
|
};
|
|
24583
|
+
let scalarIsOnlyNull = true;
|
|
24573
24584
|
for (const variantKey of oneOfDef.oneOf) {
|
|
24574
24585
|
const variantDef = definitions[variantKey];
|
|
24575
24586
|
if (variantDef) {
|
|
24576
24587
|
const bucket = getStructuralBucket(variantDef.definitionType);
|
|
24577
24588
|
buckets[bucket] = true;
|
|
24589
|
+
if (bucket === "scalar" && !(variantDef instanceof NullDefinition)) {
|
|
24590
|
+
scalarIsOnlyNull = false;
|
|
24591
|
+
}
|
|
24578
24592
|
}
|
|
24579
24593
|
}
|
|
24580
24594
|
const results = [];
|
|
24581
24595
|
const bucketCount = [buckets.scalar, buckets.sequence, buckets.mapping].filter(Boolean).length;
|
|
24582
24596
|
const needsQualifier = bucketCount > 1;
|
|
24583
|
-
|
|
24597
|
+
const skipNullOnlyScalar = mode === DefinitionValueMode.Key && scalarIsOnlyNull;
|
|
24598
|
+
if (buckets.scalar && !skipNullOnlyScalar) {
|
|
24584
24599
|
const insertText = mode === DefinitionValueMode.Key ? `
|
|
24585
24600
|
${indentation}${key}: ` : `${key}: `;
|
|
24586
24601
|
results.push({
|
|
@@ -24715,9 +24730,35 @@ async function getValues(token, keyToken, parent, valueProviderConfig, workflowC
|
|
|
24715
24730
|
if (!def) {
|
|
24716
24731
|
return [];
|
|
24717
24732
|
}
|
|
24718
|
-
const
|
|
24733
|
+
const tokenStructure = getTokenStructure(token);
|
|
24734
|
+
const values = definitionValues(def, indentation, keyToken ? DefinitionValueMode.Key : DefinitionValueMode.Parent, tokenStructure);
|
|
24719
24735
|
return filterAndSortCompletionOptions(values, existingValues);
|
|
24720
24736
|
}
|
|
24737
|
+
function getTokenStructure(token) {
|
|
24738
|
+
if (!token) {
|
|
24739
|
+
return void 0;
|
|
24740
|
+
}
|
|
24741
|
+
switch (token.templateTokenType) {
|
|
24742
|
+
case TokenType2.Mapping:
|
|
24743
|
+
return "mapping";
|
|
24744
|
+
case TokenType2.Sequence:
|
|
24745
|
+
return "sequence";
|
|
24746
|
+
case TokenType2.Null:
|
|
24747
|
+
return void 0;
|
|
24748
|
+
case TokenType2.String: {
|
|
24749
|
+
const stringToken = token.assertString("getTokenStructure expected string token");
|
|
24750
|
+
if (stringToken.value === "") {
|
|
24751
|
+
return void 0;
|
|
24752
|
+
}
|
|
24753
|
+
return "scalar";
|
|
24754
|
+
}
|
|
24755
|
+
case TokenType2.Boolean:
|
|
24756
|
+
case TokenType2.Number:
|
|
24757
|
+
return "scalar";
|
|
24758
|
+
default:
|
|
24759
|
+
return void 0;
|
|
24760
|
+
}
|
|
24761
|
+
}
|
|
24721
24762
|
function getExistingValues(token, parent) {
|
|
24722
24763
|
if (token) {
|
|
24723
24764
|
if (!isString(token)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@actions/languageserver",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.28",
|
|
4
4
|
"description": "Language server for GitHub Actions",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"actions-languageserver": "./bin/actions-languageserver"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@actions/languageservice": "^0.3.
|
|
52
|
-
"@actions/workflow-parser": "^0.3.
|
|
51
|
+
"@actions/languageservice": "^0.3.28",
|
|
52
|
+
"@actions/workflow-parser": "^0.3.28",
|
|
53
53
|
"@octokit/rest": "^21.1.1",
|
|
54
54
|
"@octokit/types": "^9.0.0",
|
|
55
55
|
"vscode-languageserver": "^8.0.2",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"ts-jest": "^29.0.3",
|
|
79
79
|
"typescript": "^4.8.4"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "a06ceee92b19cc7432ed25f63e8b4968b8ecb9ef"
|
|
82
82
|
}
|