@github/copilot-language-server 1.286.0 → 1.288.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -69,10 +69,16 @@ export type UsageStatus = ResolutionStatus | 'partial_content_excluded' | 'none_
69
69
 
70
70
  export type ContextItemUsageDetails = {
71
71
  id: string;
72
- usage: UsageStatus;
73
- expectedTokens?: number;
74
- actualTokens?: number;
75
- };
72
+ type: SupportedContextItemType;
73
+ origin?: ContextItemOrigin;
74
+ } & (
75
+ | {
76
+ usage: Extract<UsageStatus, 'full' | 'partial' | 'partial_content_excluded'>;
77
+ expectedTokens: number;
78
+ actualTokens: number;
79
+ }
80
+ | {usage: Extract<UsageStatus, 'none' | 'none_content_excluded' | 'error'>}
81
+ );
76
82
 
77
83
  export type ContextUsageStatistics = {
78
84
  usage: UsageStatus;
@@ -84,9 +90,12 @@ export interface DocumentContext {
84
90
  uri: DocumentUri;
85
91
  languageId: string;
86
92
  version: number;
93
+ /**
94
+ * @deprecated Use `position` instead.
95
+ */
87
96
  offset: number;
88
97
  position: Position;
89
- edits: TextEdit[];
98
+ proposedEdits?: TextEdit[];
90
99
  }
91
100
  export interface ResolveRequest {
92
101
  // A unique ID to correlate the request with the completion request.
@@ -136,6 +145,13 @@ interface ContextItem {
136
145
  * the item's usage. If an ID is not provided, it will be generated randomly.
137
146
  */
138
147
  id?: string;
148
+
149
+ /**
150
+ * Specifies where the context item comes from, mostly relevant for LSP providers.
151
+ * - request: context is provided in the completion request
152
+ * - update: context is provided via context/update
153
+ */
154
+ origin?: ContextItemOrigin;
139
155
  }
140
156
 
141
157
  // A key-value pair used for short string snippets.
@@ -153,3 +169,5 @@ export interface CodeSnippet extends ContextItem {
153
169
  }
154
170
 
155
171
  export type SupportedContextItem = Trait | CodeSnippet;
172
+ export type SupportedContextItemType = 'Trait' | 'CodeSnippet';
173
+ export type ContextItemOrigin = 'request' | 'update';