Skip to content

Commit

Permalink
Change ApplyKind to be integers
Browse files Browse the repository at this point in the history
  • Loading branch information
DanTup committed Sep 30, 2024
1 parent 21ff7ad commit 37f21df
Showing 1 changed file with 28 additions and 19 deletions.
47 changes: 28 additions & 19 deletions _specifications/lsp/3.18/language/completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ export interface CompletionList {
* If a completion list specifies a default value and a completion item
* also specifies a corresponding value, the rules for combining these are
* defined by `applyKinds` (if the client supports it), defaulting to
* "replace".
* ApplyKind.Replace.
*
* Servers are only allowed to return default values if the client
* signals support for this via the `completionList.itemDefaults`
Expand Down Expand Up @@ -407,14 +407,14 @@ export interface CompletionList {
* Specifies how fields from a completion item should be combined with those
* from `completionList.itemDefaults`.
*
* In unspecified, all fields will be treated as "replace".
* In unspecified, all fields will be treated as ApplyKind.Replace.
*
* If a field's value is "replace", the value from a completion item (if
* provided and not `null`) will always be used instead of the value from
* `completionItem.itemDefaults`.
* If a field's value is ApplyKind.Replace, the value from a completion item
* (if provided and not `null`) will always be used instead of the value
* from `completionItem.itemDefaults`.
*
* If a field's value is "merge", the values will be merged using the rules
* defined against each field below.
* If a field's value is ApplyKind.Merge, the values will be merged using
* the rules defined against each field below.
*
* Servers are only allowed to return `applyKind` if the client
* signals support for this via the `completionList.applyKindSupport`
Expand All @@ -427,16 +427,17 @@ export interface CompletionList {
* Specifies whether commitCharacters on a completion will replace or be
* merged with those in `completionList.itemDefaults.commitCharacters`.
*
* If "replace", the commit characters from the completion item will
* always be used unless not provided, in which case those from
* If ApplyKind.Replace, the commit characters from the completion item
* will always be used unless not provided, in which case those from
* `completionList.itemDefaults.commitCharacters` will be used. An
* empty list can be used if a completion item does not have any commit
* characters and also should not use those from
* `completionList.itemDefaults.commitCharacters`.
*
* If "merge" the commitCharacters for the completion will be the union
* of all values in both `completionList.itemDefaults.commitCharacters`
* and the completion's own `commitCharacters`.
* If ApplyKind.Merge the commitCharacters for the completion will be
* the union of all values in both
* `completionList.itemDefaults.commitCharacters` and the completion's
* own `commitCharacters`.
*
* @since 3.18.0
*/
Expand All @@ -446,13 +447,13 @@ export interface CompletionList {
* Specifies whether the `data` field on a completion will replace or
* be merged with data from `completionList.itemDefaults.data`.
*
* If "replace", the data from the completion item will be used if
* provided (and not `null`), otherwise
* If ApplyKind.Replace, the data from the completion item will be used
* if provided (and not `null`), otherwise
* `completionList.itemDefaults.data` will be used. An empty object can
* be used if a completion item does not have any data but also should
* not use the value from `completionList.itemDefaults.data`.
*
* If "merge", a shallow merge will be performed between
* If ApplyKind.Merge, a shallow merge will be performed between
* `completionList.itemDefaults.data` and the completion's own data
* using the following rules:
*
Expand Down Expand Up @@ -614,24 +615,32 @@ export interface CompletionItemLabelDetails {
/**
* Defines how values from a set of defaults and an individual item will be
* merged.
*
* @since 3.18.0
*/
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;
}

export type ApplyKind = 'replace' | 'merge';
/**
* Defines how values from a set of defaults and an individual item will be
* merged.
*
* @since 3.18.0
*/
export type ApplyKind = 1 | 2;
```

<div class="anchorHolder"><a href="#completionItem" name="completionItem" class="linkableAnchor"></a></div>
Expand Down

0 comments on commit 37f21df

Please sign in to comment.