1056
return result;
1057
}
1059
>
1060
>
/** @internal */
1061
>
export class VersionedExtensionId {
1062
>
public static tryCreate(extensionId: string | undefined, version: string | undefined): VersionedExtensionId | undefined {
1063
>
if (!extensionId || !version) {
1064
>
return undefined;
1065
>
}
1066
>
return new VersionedExtensionId(extensionId, version);
1067
>
}
1068
>
1069
>
constructor(
1070
public readonly extensionId: string,
1071
public readonly version: string,
1072
) { }
1074
>
toString(): string {
1075
return `${this.extensionId}@${this.version}`;
1076
}
1078
>
1079
>
export type InlineCompletionsDisposeReason = { kind: 'lostRace' | 'tokenCancellation' | 'other' | 'empty' | 'notTaken' };
1080
>
1081
>
export enum InlineCompletionEndOfLifeReasonKind {
1082
>
Accepted = 0,
1083
>
Rejected = 1,
1084
>
Ignored = 2,
1085
>
}
1086
>
1087
>
export type InlineCompletionEndOfLifeReason<TInlineCompletion = InlineCompletion> = {
1088
>
kind: InlineCompletionEndOfLifeReasonKind.Accepted; // User did an explicit action to accept
1089
>
alternativeAction: boolean; // Whether the user performed an alternative action.
1090
>
} | {
1091
>
kind: InlineCompletionEndOfLifeReasonKind.Rejected; // User did an explicit action to reject
1092
>
} | {
1093
>
kind: InlineCompletionEndOfLifeReasonKind.Ignored;
1094
>
supersededBy?: TInlineCompletion;
1095
>
userTypingDisagreed: boolean;
1096
>
};
1097
>
1098
>
export type LifetimeSummary = {
1099
>
requestUuid: string;
1100
>
correlationId: string | undefined;
1101
>
partiallyAccepted: number;
1102
>
partiallyAcceptedCountSinceOriginal: number;
1103
>
partiallyAcceptedRatioSinceOriginal: number;
1104
>
partiallyAcceptedCharactersSinceOriginal: number;
1105
>
shown: boolean;
1106
>
shownDuration: number;
1107
>
shownDurationUncollapsed: number;
1108
>
timeUntilShown: number | undefined;
1109
>
timeUntilActuallyShown: number | undefined;
1110
>
timeUntilProviderRequest: number;
1111
>
timeUntilProviderResponse: number;
1112
>
notShownReason: string | undefined;
1113
>
editorType: string;
1114
>
viewKind: string | undefined;
1115
>
preceeded: boolean;
1116
>
languageId: string;
1117
>
requestReason: string;
1118
>
performanceMarkers?: string;
1119
>
cursorColumnDistance?: number;
1120
>
cursorLineDistance?: number;
1121
>
lineCountOriginal?: number;
1122
>
lineCountModified?: number;
1123
>
characterCountOriginal?: number;
1124
>
characterCountModified?: number;
1125
>
disjointReplacements?: number;
1126
>
sameShapeReplacements?: boolean;
1127
>
typingInterval: number;
1128
>
typingIntervalCharacterCount: number;
1129
>
selectedSuggestionInfo: boolean;
1130
>
availableProviders: string;
1131
>
skuPlan: string | undefined;
1132
>
skuType: string | undefined;
1133
>
renameCreated: boolean | undefined;
1134
>
renameDuration: number | undefined;
1135
>
renameTimedOut: boolean | undefined;
1136
>
renameDroppedOtherEdits: number | undefined;
1137
>
renameDroppedRenameEdits: number | undefined;
1138
>
editKind: string | undefined;
1139
>
longDistanceHintVisible?: boolean;
1140
>
longDistanceHintDistance?: number;
1141
>
isForAnotherDocument?: boolean;
1142
>
};
1143
>
1144
>
export interface CodeAction {
1145
>
title: string;
1146
>
command?: Command;
1147
>
edit?: WorkspaceEdit;
1148
>
diagnostics?: IMarkerData[];
1149
>
kind?: string;
1150
>
isPreferred?: boolean;
1151
>
isAI?: boolean;
1152
>
disabled?: string;
1153
>
ranges?: IRange[];
1154
>
}
1155
>
1156
>
export const enum CodeActionTriggerType {
1157
>
Invoke = 1,
1158
>
Auto = 2,
1159
>
}
1160
>
1161
>
/**
1162
>
* @internal
1163
>
*/
1164
>
export interface CodeActionContext {
1165
>
only?: string;
1166
>
trigger: CodeActionTriggerType;
1167
>
}
1168
>
1169
>
export interface CodeActionList extends IDisposable {
1170
>
readonly actions: ReadonlyArray<CodeAction>;
1171
>
}
1172
>
1173
>
/**
1174
>
* The code action interface defines the contract between extensions and
1175
>
* the [light bulb](https://code.visualstudio.com/docs/editor/editingevolved#_code-action) feature.
1176
>
* @internal
1177
>
*/
1178
>
export interface CodeActionProvider {
1179
>
1180
>
displayName?: string;
1181
>
1182
>
extensionId?: string;
1183
>
1184
>
/**
1185
>
* Provide commands for the given document and range.
1186
>
*/
1187
>
provideCodeActions(model: model.ITextModel, range: Range | Selection, context: CodeActionContext, token: CancellationToken): ProviderResult<CodeActionList>;
1188
>
1189
>
/**
1190
>
* Given a code action fill in the edit. Will only invoked when missing.
1191
>
*/
1192
>
resolveCodeAction?(codeAction: CodeAction, token: CancellationToken): ProviderResult<CodeAction>;
1193
>
1194
>
/**
1195
>
* Optional list of CodeActionKinds that this provider returns.
1196
>
*/
1197
>
readonly providedCodeActionKinds?: ReadonlyArray<string>;
1198
>
1199
>
readonly documentation?: ReadonlyArray<{ readonly kind: string; readonly command: Command }>;
1200
>
1201
>
/**
1202
>
* @internal
1203
>
*/
1204
>
_getAdditionalMenuItems?(context: CodeActionContext, actions: readonly CodeAction[]): Command[];
1205
>
}
1206
>
1207
>
/**
1208
>
* @internal
1209
>
*/
1210
>
export interface DocumentPasteEdit {
1211
>
readonly title: string;
1212
>
readonly kind: HierarchicalKind;
1213
>
readonly handledMimeType?: string;
1214
>
yieldTo?: readonly DropYieldTo[];
1215
>
insertText: string | { readonly snippet: string };
1216
>
additionalEdit?: WorkspaceEdit;
1217
>
}
1218
>
1219
>
/**
1220
>
* @internal
1221
>
*/
1222
>
export enum DocumentPasteTriggerKind {
1223
>
Automatic = 0,
1224
>
PasteAs = 1,
1225
>
}
1226
>
1227
>
/**
1228
>
* @internal
1229
>
*/
1230
>
export interface DocumentPasteContext {
1231
>
readonly only?: HierarchicalKind;
1232
>
readonly triggerKind: DocumentPasteTriggerKind;
1233
>
}
1234
>
1235
>
/**
1236
>
* @internal
1237
>
*/
1238
>
export interface DocumentPasteEditsSession {
1239
>
edits: readonly DocumentPasteEdit[];
1240
>
dispose(): void;
1241
>
}
1242
>
1243
>
/**
1244
>
* @internal
1245
>
*/
1246
>
export interface DocumentPasteEditProvider {
1247
>
readonly id?: string;
1248
>
readonly copyMimeTypes: readonly string[];
1249
>
readonly pasteMimeTypes: readonly string[];
1250
>
readonly providedPasteEditKinds: readonly HierarchicalKind[];
1251
>
1252
>
prepareDocumentPaste?(model: model.ITextModel, ranges: readonly IRange[], dataTransfer: IReadonlyVSDataTransfer, token: CancellationToken): Promise<undefined | IReadonlyVSDataTransfer>;
1253
>
1254
>
provideDocumentPasteEdits?(model: model.ITextModel, ranges: readonly IRange[], dataTransfer: IReadonlyVSDataTransfer, context: DocumentPasteContext, token: CancellationToken): Promise<DocumentPasteEditsSession | undefined>;
1255
>
1256
>
resolveDocumentPasteEdit?(edit: DocumentPasteEdit, token: CancellationToken): Promise<DocumentPasteEdit>;
1257
>
}
1258
>
1259
>
/**
1260
>
* Represents a parameter of a callable-signature. A parameter can
1261
>
* have a label and a doc-comment.
1262
>
*/
1263
>
export interface ParameterInformation {
1264
>
/**
1265
>
* The label of this signature. Will be shown in
1266
>
* the UI.
1267
>
*/
1268
>
label: string | [number, number];
1269
>
/**
1270
>
* The human-readable doc-comment of this signature. Will be shown
1271
>
* in the UI but can be omitted.
1272
>
*/
1273
>
documentation?: string | IMarkdownString;
1274
>
}
1275
>
/**
1276
>
* Represents the signature of something callable. A signature
1277
>
* can have a label, like a function-name, a doc-comment, and
1278
>
* a set of parameters.
1279
>
*/
1280
>
export interface SignatureInformation {
1281
>
/**
1282
>
* The label of this signature. Will be shown in
1283
>
* the UI.
1284
>
*/
1285
>
label: string;
1286
>
/**
1287
>
* The human-readable doc-comment of this signature. Will be shown
1288
>
* in the UI but can be omitted.
1289
>
*/
1290
>
documentation?: string | IMarkdownString;
1291
>
/**
1292
>
* The parameters of this signature.
1293
>
*/
1294
>
parameters: ParameterInformation[];
1295
>
/**
1296
>
* Index of the active parameter.
1297
>
*
1298
>
* If provided, this is used in place of `SignatureHelp.activeSignature`.
1299
>
*/
1300
>
activeParameter?: number;
1301
>
}
1302
>
/**
1303
>
* Signature help represents the signature of something
1304
>
* callable. There can be multiple signatures but only one
1305
>
* active and only one active parameter.
1306
>
*/
1307
>
export interface SignatureHelp {
1308
>
/**
1309
>
* One or more signatures.
1310
>
*/
1311
>
signatures: SignatureInformation[];
1312
>
/**
1313
>
* The active signature.
1314
>
*/
1315
>
activeSignature: number;
1316
>
/**
1317
>
* The active parameter of the active signature.
1318
>
*/
1319
>
activeParameter: number;
1320
>
}
1321
>
1322
>
export interface SignatureHelpResult extends IDisposable {
1323
>
value: SignatureHelp;
1324
>
}
1325
>
1326
>
export enum SignatureHelpTriggerKind {
1327
>
Invoke = 1,
1328
>
TriggerCharacter = 2,
1329
>
ContentChange = 3,
1330
>
}
1331
>
1332
>
export interface SignatureHelpContext {
1333
>
readonly triggerKind: SignatureHelpTriggerKind;
1334
>
readonly triggerCharacter?: string;
1335
>
readonly isRetrigger: boolean;
1336
>
readonly activeSignatureHelp?: SignatureHelp;
1337
>
}
1338
>
1339
>
/**
1340
>
* The signature help provider interface defines the contract between extensions and
1341
>
* the [parameter hints](https://code.visualstudio.com/docs/editor/intellisense)-feature.
1342
>
*/
1343
>
export interface SignatureHelpProvider {
1344
>
1345
>
readonly signatureHelpTriggerCharacters?: ReadonlyArray<string>;
1346
>
readonly signatureHelpRetriggerCharacters?: ReadonlyArray<string>;
1347
>
1348
>
/**
1349
>
* Provide help for the signature at the given position and document.
1350
>
*/
1351
>
provideSignatureHelp(model: model.ITextModel, position: Position, token: CancellationToken, context: SignatureHelpContext): ProviderResult<SignatureHelpResult>;
1352
>
}
1353
>
1354
>
/**
1355
>
* A document highlight kind.
1356
>
*/
1357
>
export enum DocumentHighlightKind {
1358
>
/**
1359
>
* A textual occurrence.
1360
>
*/
1361
>
Text,
1362
>
/**
1363
>
* Read-access of a symbol, like reading a variable.
1364
>
*/
1365
>
Read,
1366
>
/**
1367
>
* Write-access of a symbol, like writing to a variable.
1368
>
*/
1369
>
Write
1370
>
}
1371
>
/**
1372
>
* A document highlight is a range inside a text document which deserves
1373
>
* special attention. Usually a document highlight is visualized by changing
1374
>
* the background color of its range.
1375
>
*/
1376
>
export interface DocumentHighlight {
1377
>
/**
1378
>
* The range this highlight applies to.
1379
>
*/
1380
>
range: IRange;
1381
>
/**
1382
>
* The highlight kind, default is {@link DocumentHighlightKind.Text text}.
1383
>
*/
1384
>
kind?: DocumentHighlightKind;
1385
>
}
1386
>
1387
>
/**
1388
>
* Represents a set of document highlights for a specific URI.
1389
>
*/
1390
>
export interface MultiDocumentHighlight {
1391
>
/**
1392
>
* The URI of the document that the highlights belong to.
1393
>
*/
1394
>
uri: URI;
1395
>
1396
>
/**
1397
>
* The set of highlights for the document.
1398
>
*/
1399
>
highlights: DocumentHighlight[];
1400
>
}
1401
>
1402
>
/**
1403
>
* The document highlight provider interface defines the contract between extensions and
1404
>
* the word-highlight-feature.
1405
>
*/
1406
>
export interface DocumentHighlightProvider {
1407
>
/**
1408
>
* Provide a set of document highlights, like all occurrences of a variable or
1409
>
* all exit-points of a function.
1410
>
*/
1411
>
provideDocumentHighlights(model: model.ITextModel, position: Position, token: CancellationToken): ProviderResult<DocumentHighlight[]>;
1412
>
}
1413
>
1414
>
/**
1415
>
* A provider that can provide document highlights across multiple documents.
1416
>
*/
1417
>
export interface MultiDocumentHighlightProvider {
1418
>
readonly selector: LanguageSelector;
1419
>
1420
>
/**
1421
>
* Provide a Map of URI --> document highlights, like all occurrences of a variable or
1422
>
* all exit-points of a function.
1423
>
*
1424
>
* Used in cases such as split view, notebooks, etc. where there can be multiple documents
1425
>
* with shared symbols.
1426
>
*
1427
>
* @param primaryModel The primary text model.
1428
>
* @param position The position at which to provide document highlights.
1429
>
* @param otherModels The other text models to search for document highlights.
1430
>
* @param token A cancellation token.
1431
>
* @returns A map of URI to document highlights.
1432
>
*/
1433
>
provideMultiDocumentHighlights(primaryModel: model.ITextModel, position: Position, otherModels: model.ITextModel[], token: CancellationToken): ProviderResult<Map<URI, DocumentHighlight[]>>;
1434
>
}
1435
>
1436
>
/**
1437
>
* The linked editing range provider interface defines the contract between extensions and
1438
>
* the linked editing feature.
1439
>
*/
1440
>
export interface LinkedEditingRangeProvider {
1441
>
1442
>
/**
1443
>
* Provide a list of ranges that can be edited together.
1444
>
*/
1445
>
provideLinkedEditingRanges(model: model.ITextModel, position: Position, token: CancellationToken): ProviderResult<LinkedEditingRanges>;
1446
>
}
1447
>
1448
>
/**
1449
>
* Represents a list of ranges that can be edited together along with a word pattern to describe valid contents.
1450
>
*/
1451
>
export interface LinkedEditingRanges {
1452
>
/**
1453
>
* A list of ranges that can be edited together. The ranges must have
1454
>
* identical length and text content. The ranges cannot overlap
1455
>
*/
1456
>
ranges: IRange[];
1457
>
1458
>
/**
1459
>
* An optional word pattern that describes valid contents for the given ranges.
1460
>
* If no pattern is provided, the language configuration's word pattern will be used.
1461
>
*/
1462
>
wordPattern?: RegExp;
1463
>
}
1464
>
1465
>
/**
1466
>
* Value-object that contains additional information when
1467
>
* requesting references.
1468
>
*/
1469
>
export interface ReferenceContext {
1470
>
/**
1471
>
* Include the declaration of the current symbol.
1472
>
*/
1473
>
includeDeclaration: boolean;
1474
>
}
1475
>
/**
1476
>
* The reference provider interface defines the contract between extensions and
1477
>
* the [find references](https://code.visualstudio.com/docs/editor/editingevolved#_peek)-feature.
1478
>
*/
1479
>
export interface ReferenceProvider {
1480
>
/**
1481
>
* Provide a set of project-wide references for the given position and document.
1482
>
*/
1483
>
provideReferences(model: model.ITextModel, position: Position, context: ReferenceContext, token: CancellationToken): ProviderResult<Location[]>;
1484
>
}
1485
>
1486
>
/**
1487
>
* Represents a location inside a resource, such as a line
1488
>
* inside a text file.
1489
>
*/
1490
>
export interface Location {
1491
>
/**
1492
>
* The resource identifier of this location.
1493
>
*/
1494
>
uri: URI;
1495
>
/**
1496
>
* The document range of this locations.
1497
>
*/
1498
>
range: IRange;
1499
>
}
1500
>
1501
>
export interface LocationLink {
1502
>
/**
1503
>
* A range to select where this link originates from.
1504
>
*/
1505
>
originSelectionRange?: IRange;
1506
>
1507
>
/**
1508
>
* The target uri this link points to.
1509
>
*/
1510
>
uri: URI;
1511
>
1512
>
/**
1513
>
* The full range this link points to.
1514
>
*/
1515
>
range: IRange;
1516
>
1517
>
/**
1518
>
* A range to select this link points to. Must be contained
1519
>
* in `LocationLink.range`.
1520
>
*/
1521
>
targetSelectionRange?: IRange;
1522
>
}
1523
>
1524
>
/**
1525
>
* @internal
1526
>
*/
1527
>
export function isLocationLink(thing: unknown): thing is LocationLink {
1528
return !!thing
1529
&& URI.isUri((thing as LocationLink).uri)