mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-04 15:25:47 +01:00
adopt API changes in tests and extensions
This commit is contained in:
@@ -72,7 +72,7 @@ class MyCompletionItem extends vscode.CompletionItem {
|
||||
// Render "fancy" when source is a workspace path
|
||||
const qualifierCandidate = vscode.workspace.asRelativePath(tsEntry.source);
|
||||
if (qualifierCandidate !== tsEntry.source) {
|
||||
this.label2 = { name: tsEntry.name, qualifier: qualifierCandidate };
|
||||
this.label = { label: tsEntry.name, description: qualifierCandidate };
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -81,7 +81,7 @@ class MyCompletionItem extends vscode.CompletionItem {
|
||||
|
||||
const { sourceDisplay, isSnippet } = tsEntry;
|
||||
if (sourceDisplay) {
|
||||
this.label2 = { name: tsEntry.name, qualifier: Previewer.plainWithLinks(sourceDisplay, client) };
|
||||
this.label = { label: tsEntry.name, description: Previewer.plainWithLinks(sourceDisplay, client) };
|
||||
}
|
||||
|
||||
this.preselect = tsEntry.isRecommended;
|
||||
@@ -113,11 +113,11 @@ class MyCompletionItem extends vscode.CompletionItem {
|
||||
const kindModifiers = parseKindModifier(tsEntry.kindModifiers);
|
||||
if (kindModifiers.has(PConst.KindModifiers.optional)) {
|
||||
if (!this.insertText) {
|
||||
this.insertText = this.label;
|
||||
this.insertText = this.textLabel;
|
||||
}
|
||||
|
||||
if (!this.filterText) {
|
||||
this.filterText = this.label;
|
||||
this.filterText = this.textLabel;
|
||||
}
|
||||
this.label += '?';
|
||||
}
|
||||
@@ -146,6 +146,10 @@ class MyCompletionItem extends vscode.CompletionItem {
|
||||
this.resolveRange();
|
||||
}
|
||||
|
||||
private get textLabel() {
|
||||
return typeof this.label === 'string' ? this.label : this.label.label;
|
||||
}
|
||||
|
||||
private _resolvedPromise?: {
|
||||
readonly requestToken: vscode.CancellationTokenSource;
|
||||
readonly promise: Promise<ResolvedCompletionItem | undefined>;
|
||||
@@ -216,7 +220,7 @@ class MyCompletionItem extends vscode.CompletionItem {
|
||||
if (this.useCodeSnippet) {
|
||||
const shouldCompleteFunction = await this.isValidFunctionCompletionContext(client, filepath, this.position, this.document, token);
|
||||
if (shouldCompleteFunction) {
|
||||
const { snippet, parameterCount } = snippetForFunctionCall(this, detail.displayParts);
|
||||
const { snippet, parameterCount } = snippetForFunctionCall({ ...this, label: this.textLabel }, detail.displayParts);
|
||||
this.insertText = snippet;
|
||||
if (parameterCount > 0) {
|
||||
//Fix for https://github.com/microsoft/vscode/issues/104059
|
||||
@@ -408,8 +412,8 @@ class MyCompletionItem extends vscode.CompletionItem {
|
||||
private getFuzzyWordRange() {
|
||||
if (this.completionContext.useFuzzyWordRangeLogic) {
|
||||
// Try getting longer, prefix based range for completions that span words
|
||||
const text = this.completionContext.line.slice(Math.max(0, this.position.character - this.label.length), this.position.character).toLowerCase();
|
||||
const entryName = this.label.toLowerCase();
|
||||
const text = this.completionContext.line.slice(Math.max(0, this.position.character - this.textLabel.length), this.position.character).toLowerCase();
|
||||
const entryName = this.textLabel.toLowerCase();
|
||||
for (let i = entryName.length; i >= 0; --i) {
|
||||
if (text.endsWith(entryName.substr(0, i)) && (!this.completionContext.wordRange || this.completionContext.wordRange.start.character > this.position.character - i)) {
|
||||
return new vscode.Range(
|
||||
|
||||
Reference in New Issue
Block a user