use completionProvider and seperate value and key completion. - #67
use completionProvider and seperate value and key completion.#67srivastava-diya wants to merge 2 commits into
Conversation
|
|
||
| expect(completions).toEqual([ | ||
| expect(labels(completions)).toEqual([ | ||
| { label: "name", kind: CompletionItemKind.Property } |
There was a problem hiding this comment.
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") { |
There was a problem hiding this comment.
skipping this for integer and number because there's nothing to show in the suggestion
| if (type === "boolean") { | ||
| completionItems.push( | ||
| { | ||
| label: "true", | ||
| kind: CompletionItemKind.Value, | ||
| insertTextFormat: InsertTextFormat.Snippet, | ||
| textEdit: { range, newText: " true" } | ||
| }, |
There was a problem hiding this comment.
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.
| if (valid && context.pendingAnnotations) { | ||
| const hasAlways = context.unconditionalAnnotations; | ||
| const hasGated = valid && context.pendingAnnotations; |
There was a problem hiding this comment.
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.
Description
Split into providers,
Completion.tsbecame a orchestrator soPropertyCompletion.tsandValueCompletion.tsbecame separate files.Capturing type as an annotation, removing
schemaStorelookup entirelyseperated
Completion.test.tsfile intoValueCompletion.test.tsandPropertyCompletion.test.ts