Skip to content

Commit

Permalink
Add double click check for VSCode (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaogaotiantian authored Dec 3, 2023
1 parent 69ac289 commit 17a1678
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
25 changes: 25 additions & 0 deletions src/viztracer/web_dist/v37.0-a9e8e2a6b/frontend_bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -303312,6 +303312,16 @@ function requireChrome_slice_details_tab () {
this.pre_height = 100;
// Start loading the slice details
const { id, table } = this.config;
// Handle double click
ChromeSliceDetailsTab.lastRenderTimestamp = ChromeSliceDetailsTab.currRenderTimestamp;
ChromeSliceDetailsTab.currRenderTimestamp = Date.now();
if (ChromeSliceDetailsTab.lastClickedSliceId == id) {
ChromeSliceDetailsTab.doubleClickHandled = false;
}
else {
ChromeSliceDetailsTab.doubleClickHandled = true;
}
ChromeSliceDetailsTab.lastClickedSliceId = id;
getSliceDetails(this.engine, id, table)
.then((sliceDetails) => this.sliceDetails = sliceDetails);
}
Expand Down Expand Up @@ -303488,6 +303498,16 @@ function requireChrome_slice_details_tab () {
if (globals_1.globals.inVscode && sourceStorage && sourceStorage["functions"]) {
const file_data = sourceStorage["functions"][funcName] || null;
if (file_data) {
if (!ChromeSliceDetailsTab.doubleClickHandled &&
ChromeSliceDetailsTab.currRenderTimestamp - ChromeSliceDetailsTab.lastRenderTimestamp < 500) {
ChromeSliceDetailsTab.doubleClickHandled = true;
window.parent.postMessage({
type: 'viztracer',
action: 'openfile',
file: file_data[0],
line: file_data[1]
}, '*');
}
return (0, mithril_1.default)('button', {
style: {
'display': 'flex',
Expand Down Expand Up @@ -303618,6 +303638,11 @@ function requireChrome_slice_details_tab () {
}
}
ChromeSliceDetailsTab.kind = 'dev.perfetto.ChromeSliceDetailsTab';
// Handle double click for VS Code
ChromeSliceDetailsTab.lastRenderTimestamp = 0;
ChromeSliceDetailsTab.currRenderTimestamp = 0;
ChromeSliceDetailsTab.lastClickedSliceId = -1;
ChromeSliceDetailsTab.doubleClickHandled = false;
chrome_slice_details_tab.ChromeSliceDetailsTab = ChromeSliceDetailsTab;
bottom_tab_1.bottomTabRegistry.register(ChromeSliceDetailsTab);

Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/viztracer/web_dist/v37.0-a9e8e2a6b/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"assets/scheduling_latency.png": "sha256-B5t/L/QvRS9hk856dejJJvA157w3Lk9nCTJfE9O1mXw=",
"assets/vscode-icon.png": "sha256-gnDKIFtMec1sbVIFhIz6CLCas3ddURGjUzZ8QC8iBrk=",
"engine_bundle.js": "sha256-fJh6K/Awr+uiG9DYH8guGN4GAolmOIsgegw0x9GNsFs=",
"frontend_bundle.js": "sha256-sC71Y4sMzYxNsPRWwEpd3CeDoOX7+/PPsuS/QsAPmuQ=",
"frontend_bundle.js": "sha256-Ingdpdyg7s/gEB3QBlIf7ZumpN+JwLg/SsCkRgfdj3k=",
"perfetto.css": "sha256-wt6m8eOTQraicmSbDvOML9rHKtvOlv1ZgirBZ5tWk0U=",
"trace_processor.wasm": "sha256-t8HHNrPJmFfQ9pFA166tXseXceDNK+aiU38LQppimzE=",
"traceconv.wasm": "sha256-Cwcc4DTt1FzJtNx2QFvGGciL0Yk+ssJnpKBog+Thevo=",
Expand Down

0 comments on commit 17a1678

Please sign in to comment.