Skip to content

Commit

Permalink
Change ApplyKind to ints
Browse files Browse the repository at this point in the history
  • Loading branch information
DanTup committed Sep 30, 2024
1 parent 3884a04 commit f8ed433
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
20 changes: 10 additions & 10 deletions client-node-tests/src/converter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ suite('Protocol Converter', () => {
isIncomplete: false,
itemDefaults: { commitCharacters: ['1'] },
// Set other fields to "merge" to ensure the correct field was used.
applyKind: { commitCharacters: 'replace', data: 'merge' },
applyKind: { commitCharacters: proto.ApplyKind.Replace, data: proto.ApplyKind.Merge },
items: [{ label: 'item', commitCharacters: ['2'] }]
};
const result = await p2c.asCompletionResult(completionResult);
Expand All @@ -886,7 +886,7 @@ suite('Protocol Converter', () => {
isIncomplete: false,
itemDefaults: { commitCharacters: ['1'] },
// Set other fields to "merge" to ensure the correct field was used.
applyKind: { commitCharacters: 'replace', data: 'merge' },
applyKind: { commitCharacters: proto.ApplyKind.Replace, data: proto.ApplyKind.Merge },
items: [{ label: 'item', commitCharacters: [] }]
};
const result = await p2c.asCompletionResult(completionResult);
Expand All @@ -897,7 +897,7 @@ suite('Protocol Converter', () => {
const completionResult: proto.CompletionList = {
isIncomplete: false,
itemDefaults: { commitCharacters: ['d', 'b'] },
applyKind: { commitCharacters: 'merge' },
applyKind: { commitCharacters: proto.ApplyKind.Merge },
items: [{ label: 'item', commitCharacters: ['b', 'i'] }]
};
const result = await p2c.asCompletionResult(completionResult);
Expand All @@ -908,7 +908,7 @@ suite('Protocol Converter', () => {
const completionResult: proto.CompletionList = {
isIncomplete: false,
itemDefaults: { commitCharacters: ['d'] },
applyKind: { commitCharacters: 'merge' },
applyKind: { commitCharacters: proto.ApplyKind.Merge },
items: [{ label: 'item' }]
};
const result = await p2c.asCompletionResult(completionResult);
Expand All @@ -919,7 +919,7 @@ suite('Protocol Converter', () => {
const completionResult: proto.CompletionList = {
isIncomplete: false,
itemDefaults: { },
applyKind: { commitCharacters: 'merge' },
applyKind: { commitCharacters: proto.ApplyKind.Merge },
items: [{ label: 'item', commitCharacters: ['i'] }]
};
const result = await p2c.asCompletionResult(completionResult);
Expand All @@ -942,7 +942,7 @@ suite('Protocol Converter', () => {
isIncomplete: false,
itemDefaults: { data: { 'd': 'd' } },
// Set other fields to "merge" to ensure the correct field was used.
applyKind: { data: 'replace', commitCharacters: 'merge' },
applyKind: { data: proto.ApplyKind.Replace, commitCharacters: proto.ApplyKind.Merge },
items: [{ label: 'item', data: { 'i': 'i' } }]
};
const result = await p2c.asCompletionResult(completionResult);
Expand All @@ -954,7 +954,7 @@ suite('Protocol Converter', () => {
const completionResult: proto.CompletionList = {
isIncomplete: false,
itemDefaults: { data: { 'd': 'd' } },
applyKind: { data: 'merge' },
applyKind: { data: proto.ApplyKind.Merge },
items: [{ label: 'item', data: { 'i': 'i' } }]
};
const result = await p2c.asCompletionResult(completionResult);
Expand All @@ -966,7 +966,7 @@ suite('Protocol Converter', () => {
const completionResult: proto.CompletionList = {
isIncomplete: false,
itemDefaults: { data: { 'd': 'd' } },
applyKind: { data: 'merge' },
applyKind: { data: proto.ApplyKind.Merge },
items: [{ label: 'item', data: null }] // null treated like undefined
};
const result = await p2c.asCompletionResult(completionResult);
Expand All @@ -978,7 +978,7 @@ suite('Protocol Converter', () => {
const completionResult: proto.CompletionList = {
isIncomplete: false,
itemDefaults: { data: { 'd': 'd' } },
applyKind: { data: 'merge' },
applyKind: { data: proto.ApplyKind.Merge },
items: [{ label: 'item', data: { 'd': null, 'i': 'i'} }] // null treated like undefined
};
const result = await p2c.asCompletionResult(completionResult);
Expand All @@ -990,7 +990,7 @@ suite('Protocol Converter', () => {
const completionResult: proto.CompletionList = {
isIncomplete: false,
itemDefaults: { data: { 'd1': 'd1', 'd2': 'd2' } },
applyKind: { data: 'merge' },
applyKind: { data: proto.ApplyKind.Merge },
items: [{ label: 'item', data: { 'd1': 0, 'd2': ''} }] // Both falsy, but should be used.
};
const result = await p2c.asCompletionResult(completionResult);
Expand Down
6 changes: 3 additions & 3 deletions types/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2231,15 +2231,15 @@ export namespace ApplyKind {
* The value from the individual item (if provided and not `null`) will be
* used instead of the default.
*/
export const Replace: 'replace' = 'replace';
export const Replace: 1 = 1;

/**
* The value from the item will be merged with the default.
*
* The specific rules for mergeing values are defined against each field
* that supports merging.
*/
export const Merge: 'merge' = 'merge';
export const Merge: 2 = 2;
}

/**
Expand All @@ -2248,7 +2248,7 @@ export namespace ApplyKind {
*
* @since 3.18.0
*/
export type ApplyKind = 'replace' | 'merge';
export type ApplyKind = 1 | 2;

/**
* Additional details for a completion item label.
Expand Down

0 comments on commit f8ed433

Please sign in to comment.