Skip to content

Commit

Permalink
Refactor completionService to ignore certain schema references
Browse files Browse the repository at this point in the history
  • Loading branch information
davelopez committed Jun 22, 2024
1 parent 41e9ed6 commit 1f04d2a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions server/gx-workflow-ls-format2/src/services/completionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ import { FieldSchemaNode, RecordSchemaNode, SchemaNode, SchemaNodeResolver } fro
import { EnumSchemaNode } from "../schema/definitions";

export class GxFormat2CompletionService {
/**
* Schema references that should be ignored when suggesting completions.
* These are typically user-defined names and we cannot suggest completions for them.
*/
private readonly ignoredSchemaRefs = new Set(["InputParameter", "OutputParameter", "WorkflowStep"]);

constructor(protected readonly schemaNodeResolver: SchemaNodeResolver) {}

public doComplete(documentContext: GxFormat2WorkflowDocument, position: Position): Promise<CompletionList> {
Expand Down Expand Up @@ -111,6 +117,10 @@ export class GxFormat2CompletionService {
return result;
}

if (this.ignoredSchemaRefs.has(schemaNode.typeRef)) {
return result;
}

const schemaRecord = this.schemaNodeResolver.getSchemaNodeByTypeRef(schemaNode.typeRef);
if (schemaRecord) {
return this.getProposedItems(schemaRecord, textBuffer, exclude, offset);
Expand Down

0 comments on commit 1f04d2a

Please sign in to comment.