Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new CompletionItem label API #4648

Merged
merged 3 commits into from
Jul 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"@types/semver": "5.5.0",
"@types/tmp": "0.0.33",
"@types/unzipper": "^0.9.1",
"@types/vscode": "1.57.0",
"@types/vscode": "1.58.0",
"@types/yauzl": "2.9.1",
"archiver": "5.3.0",
"chai": "4.3.4",
Expand Down
3 changes: 1 addition & 2 deletions src/features/completionProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,8 @@ export default class OmnisharpCompletionProvider extends AbstractProvider implem
const insertRange = omnisharpCompletion.TextEdit ? mapRange(omnisharpCompletion.TextEdit) : undefined;

return {
label: omnisharpCompletion.Label,
label: { label: omnisharpCompletion.Label, description: omnisharpCompletion.Detail },
kind: omnisharpCompletion.Kind - 1,
detail: omnisharpCompletion.Detail,
documentation: docs,
commitCharacters: omnisharpCompletion.CommitCharacters,
preselect: omnisharpCompletion.Preselect,
Expand Down
11 changes: 6 additions & 5 deletions src/features/json/jsonContributions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { configure as configureXHR, xhr } from 'request-light';

import {
CompletionItem, CompletionItemProvider, CompletionList, TextDocument, Position, Hover, HoverProvider,
CancellationToken, Range, TextEdit, MarkedString, DocumentSelector, languages, workspace
CancellationToken, Range, MarkedString, DocumentSelector, languages, workspace
} from 'vscode';
import CompositeDisposable from '../../CompositeDisposable';

Expand Down Expand Up @@ -113,10 +113,11 @@ export class JSONCompletionItemProvider implements CompletionItemProvider {
let proposed: { [key: string]: boolean } = {};
let collector: ISuggestionsCollector = {
add: (suggestion: CompletionItem) => {
if (!proposed[suggestion.label]) {
proposed[suggestion.label] = true;
if (!proposed[<string>suggestion.label]) {
proposed[<string>suggestion.label] = true;
if (overwriteRange) {
suggestion.textEdit = TextEdit.replace(overwriteRange, <string>suggestion.insertText);
suggestion.insertText = suggestion.insertText;
suggestion.range = overwriteRange;
}

items.push(suggestion);
Expand Down Expand Up @@ -162,4 +163,4 @@ export class JSONCompletionItemProvider implements CompletionItemProvider {
}
return text.substring(i + 1, position.character);
}
}
}
4 changes: 2 additions & 2 deletions src/features/json/projectJSONContribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export class ProjectJSONContribution implements IJSONContribution {
public resolveSuggestion(item: CompletionItem): Thenable<CompletionItem> {
if (item.kind === CompletionItemKind.Property) {
let pack = item.label;
return this.getInfo(pack).then(info => {
return this.getInfo(<string>pack).then(info => {
if (info.description) {
item.documentation = info.description;
}
Expand Down Expand Up @@ -244,4 +244,4 @@ export class ProjectJSONContribution implements IJSONContribution {
}
return null;
}
}
}