Skip to content

Commit 56cd791

Browse files
committed
Extract has docs
1 parent e0d2ed9 commit 56cd791

1 file changed

Lines changed: 17 additions & 13 deletions

File tree

src/vs/editor/contrib/parameterHints/parameterHintsWidget.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -236,19 +236,7 @@ export class ParameterHintsWidget extends Disposable implements IContentWidget,
236236
dom.append(this.domNodes.docs, renderedContents.element);
237237
}
238238

239-
let hasDocs = false;
240-
if (activeParameter && typeof (activeParameter.documentation) === 'string' && activeParameter.documentation.length > 0) {
241-
hasDocs = true;
242-
}
243-
if (activeParameter && typeof (activeParameter.documentation) === 'object' && activeParameter.documentation.value.length > 0) {
244-
hasDocs = true;
245-
}
246-
if (typeof (signature.documentation) === 'string' && signature.documentation.length > 0) {
247-
hasDocs = true;
248-
}
249-
if (typeof (signature.documentation) === 'object' && signature.documentation.value.length > 0) {
250-
hasDocs = true;
251-
}
239+
const hasDocs = this.hasDocs(signature, activeParameter);
252240

253241
dom.toggleClass(this.domNodes.signature, 'has-docs', hasDocs);
254242
dom.toggleClass(this.domNodes.docs, 'empty', !hasDocs);
@@ -276,6 +264,22 @@ export class ParameterHintsWidget extends Disposable implements IContentWidget,
276264
this.domNodes.scrollbar.scanDomNode();
277265
}
278266

267+
private hasDocs(signature: modes.SignatureInformation, activeParameter: modes.ParameterInformation | undefined): boolean {
268+
if (activeParameter && typeof (activeParameter.documentation) === 'string' && activeParameter.documentation.length > 0) {
269+
return true;
270+
}
271+
if (activeParameter && typeof (activeParameter.documentation) === 'object' && activeParameter.documentation.value.length > 0) {
272+
return true;
273+
}
274+
if (typeof (signature.documentation) === 'string' && signature.documentation.length > 0) {
275+
return true;
276+
}
277+
if (typeof (signature.documentation) === 'object' && signature.documentation.value.length > 0) {
278+
return true;
279+
}
280+
return false;
281+
}
282+
279283
private renderParameters(parent: HTMLElement, signature: modes.SignatureInformation, currentParameter: number): void {
280284

281285
const [start, end] = this.getParameterLabelOffsets(signature, currentParameter);

0 commit comments

Comments
 (0)