@github/copilot-language-server 1.285.0 → 1.287.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.
@@ -1,4 +1,11 @@
1
- import {CancellationToken, Disposable, DocumentSelector, DocumentUri, Position} from 'vscode-languageserver-protocol';
1
+ import {
2
+ CancellationToken,
3
+ Disposable,
4
+ DocumentSelector,
5
+ DocumentUri,
6
+ Position,
7
+ TextEdit,
8
+ } from 'vscode-languageserver-protocol';
2
9
 
3
10
  /**
4
11
  * The ContextProvider API allows extensions to provide additional context items that
@@ -62,10 +69,16 @@ export type UsageStatus = ResolutionStatus | 'partial_content_excluded' | 'none_
62
69
 
63
70
  export type ContextItemUsageDetails = {
64
71
  id: string;
65
- usage: UsageStatus;
66
- expectedTokens?: number;
67
- actualTokens?: number;
68
- };
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
+ );
69
82
 
70
83
  export type ContextUsageStatistics = {
71
84
  usage: UsageStatus;
@@ -77,8 +90,12 @@ export interface DocumentContext {
77
90
  uri: DocumentUri;
78
91
  languageId: string;
79
92
  version: number;
93
+ /**
94
+ * @deprecated Use `position` instead.
95
+ */
80
96
  offset: number;
81
97
  position: Position;
98
+ proposedEdits?: TextEdit[];
82
99
  }
83
100
  export interface ResolveRequest {
84
101
  // A unique ID to correlate the request with the completion request.
@@ -128,6 +145,13 @@ interface ContextItem {
128
145
  * the item's usage. If an ID is not provided, it will be generated randomly.
129
146
  */
130
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;
131
155
  }
132
156
 
133
157
  // A key-value pair used for short string snippets.
@@ -145,3 +169,5 @@ export interface CodeSnippet extends ContextItem {
145
169
  }
146
170
 
147
171
  export type SupportedContextItem = Trait | CodeSnippet;
172
+ export type SupportedContextItemType = 'Trait' | 'CodeSnippet';
173
+ export type ContextItemOrigin = 'request' | 'update';