Show deprecated indicator in CodeMirror autocomplete (#4983)
This commit is contained in:
@ -368,13 +368,20 @@ export class LanguageServerPlugin implements PluginValue {
|
|||||||
sortText,
|
sortText,
|
||||||
filterText,
|
filterText,
|
||||||
}) => {
|
}) => {
|
||||||
|
const detailText = [
|
||||||
|
deprecated ? 'Deprecated' : undefined,
|
||||||
|
labelDetails ? labelDetails.detail : detail,
|
||||||
|
]
|
||||||
|
// Don't let undefined appear.
|
||||||
|
.filter(Boolean)
|
||||||
|
.join(' ')
|
||||||
const completion: Completion & {
|
const completion: Completion & {
|
||||||
filterText: string
|
filterText: string
|
||||||
sortText?: string
|
sortText?: string
|
||||||
apply: string
|
apply: string
|
||||||
} = {
|
} = {
|
||||||
label,
|
label,
|
||||||
detail: labelDetails ? labelDetails.detail : detail,
|
detail: detailText,
|
||||||
apply: label,
|
apply: label,
|
||||||
type: kind && CompletionItemKindMap[kind].toLowerCase(),
|
type: kind && CompletionItemKindMap[kind].toLowerCase(),
|
||||||
sortText: sortText ?? label,
|
sortText: sortText ?? label,
|
||||||
@ -382,7 +389,11 @@ export class LanguageServerPlugin implements PluginValue {
|
|||||||
}
|
}
|
||||||
if (documentation) {
|
if (documentation) {
|
||||||
completion.info = () => {
|
completion.info = () => {
|
||||||
const htmlString = formatMarkdownContents(documentation)
|
const deprecatedHtml = deprecated
|
||||||
|
? '<p><strong>Deprecated</strong></p>'
|
||||||
|
: ''
|
||||||
|
const htmlString =
|
||||||
|
deprecatedHtml + formatMarkdownContents(documentation)
|
||||||
const htmlNode = document.createElement('div')
|
const htmlNode = document.createElement('div')
|
||||||
htmlNode.style.display = 'contents'
|
htmlNode.style.display = 'contents'
|
||||||
htmlNode.innerHTML = htmlString
|
htmlNode.innerHTML = htmlString
|
||||||
|
Reference in New Issue
Block a user