Skip to content

Commit

Permalink
Add default value completion for primitive types in format2 workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
davelopez committed Jun 1, 2024
1 parent 5fa9f99 commit 635a35d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions server/gx-workflow-ls-format2/src/services/completionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,23 @@ export class GxFormat2CompletionService {
result.push(item);
});
} else if (schemaNode instanceof FieldSchemaNode) {
if (this.schemaNodeResolver.definitions.primitiveTypes.has(schemaNode.typeRef)) {
const defaultValue = String(schemaNode.default ?? "");
if (defaultValue) {
const item: CompletionItem = {
label: defaultValue,
kind: CompletionItemKind.Value,
documentation: schemaNode.documentation,
insertText: defaultValue,
textEdit: {
range: overwriteRange,
newText: defaultValue,
},
};
result.push(item);
return result;
}
}
const schemaRecord = this.schemaNodeResolver.getSchemaNodeByTypeRef(schemaNode.typeRef);
if (schemaRecord instanceof EnumSchemaNode) {
schemaRecord.symbols
Expand Down

0 comments on commit 635a35d

Please sign in to comment.