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

Track markdown rendering delays in parameter hints #211591

Merged
merged 2 commits into from
Apr 29, 2024
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
import { listHighlightForeground, registerColor } from 'vs/platform/theme/common/colorRegistry';
import { registerIcon } from 'vs/platform/theme/common/iconRegistry';
import { ThemeIcon } from 'vs/base/common/themables';
import { StopWatch } from 'vs/base/common/stopwatch';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';

const $ = dom.$;

Expand Down Expand Up @@ -61,6 +63,7 @@ export class ParameterHintsWidget extends Disposable implements IContentWidget {
@IContextKeyService contextKeyService: IContextKeyService,
@IOpenerService openerService: IOpenerService,
@ILanguageService languageService: ILanguageService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
) {
super();

Expand Down Expand Up @@ -272,12 +275,30 @@ export class ParameterHintsWidget extends Disposable implements IContentWidget {
}

private renderMarkdownDocs(markdown: IMarkdownString | undefined): IMarkdownRenderResult {
const stopWatch = new StopWatch();
const renderedContents = this.renderDisposeables.add(this.markdownRenderer.render(markdown, {
asyncRenderCallback: () => {
this.domNodes?.scrollbar.scanDomNode();
}
}));
renderedContents.element.classList.add('markdown-docs');

type RenderMarkdownPerformanceClassification = {
owner: 'donjayamanne';
comment: 'Measure the time taken to render markdown for parameter hints';
renderDuration: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Time in ms to render the markdown' };
};

type RenderMarkdownPerformanceEvent = {
renderDuration: number;
};
const renderDuration = stopWatch.elapsed();
if (renderDuration > 300) {
this.telemetryService.publicLog2<RenderMarkdownPerformanceEvent, RenderMarkdownPerformanceClassification>('parameterHints.parseMarkdown', {
renderDuration: stopWatch.elapsed()
DonJayamanne marked this conversation as resolved.
Show resolved Hide resolved
});
}

return renderedContents;
}

Expand Down
Loading