Skip to content

use completionProvider and seperate value and key completion. - #67

Draft
srivastava-diya wants to merge 2 commits into
hyperjump-io:mainfrom
srivastava-diya:value-completion-simple
Draft

use completionProvider and seperate value and key completion.#67
srivastava-diya wants to merge 2 commits into
hyperjump-io:mainfrom
srivastava-diya:value-completion-simple

Conversation

@srivastava-diya

Copy link
Copy Markdown
Collaborator

Description

  • Split into providers, Completion.ts became a orchestrator so PropertyCompletion.ts and ValueCompletion.ts became separate files.

  • Capturing type as an annotation, removing schemaStore lookup entirely

  • seperated Completion.test.ts file into ValueCompletion.test.ts and PropertyCompletion.test.ts


expect(completions).toEqual([
expect(labels(completions)).toEqual([
{ label: "name", kind: CompletionItemKind.Property }

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry i forgot what we decided for the property completion tests, should we assert the complete CompletionItem shape (label, kind, filterText, textEdit, command) every time, or just the (label + kind)?

continue;
}

if (type === "number" || type === "integer") {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

skipping this for integer and number because there's nothing to show in the suggestion

Comment on lines +43 to +50
if (type === "boolean") {
completionItems.push(
{
label: "true",
kind: CompletionItemKind.Value,
insertTextFormat: InsertTextFormat.Snippet,
textEdit: { range, newText: " true" }
},

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added this here to avoid a double dropdown situation, Before this boolean showed as ONE completion item, and only after selecting it did a second, nested dropdown appeared to pick from true/false.

Comment on lines -93 to +105
if (valid && context.pendingAnnotations) {
const hasAlways = context.unconditionalAnnotations;
const hasGated = valid && context.pendingAnnotations;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The null we add for empty value space makes that sub-schema fail validation, and the original logic only kept annotations when valid was true so type was getting dropped. since we're using type to decide what to suggest so it needs to survive even when the value doesn't validate. pendingAnnotations stays as it is. added new unconditionalAnnotations which holds annotations like type that should always be kept regardless of validity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant