Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createNewProposal(name: string, kind: CompletionItemKind, entry?: CompletionEntry, sortPrefix?: string): CompletionItem {
const proposal: CompletionItem = new CompletionItem(name, kind);
if (entry) {
if (entry.detail) {
proposal.detail = entry.detail;
}
if (entry.description) {
proposal.documentation = textToMarkdownString(entry.description);
}
}
if (sortPrefix) {
proposal.sortText = `${sortPrefix}${name}`;
}
return proposal;
}