Skip to content

Commit

Permalink
v1.4.1 add some more logging on hover times.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbehr1 committed Apr 29, 2020
1 parent 3f3496d commit 375c6ee
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to the "smart-log" extension will be documented in this file

<!-- Check [Keep a Changelog](http:https://keepachangelog.com/) for recommendations on how to structure this file. -->

## [1.4.1]
- Added some console logs to find a bug where sometimes hover times are wrong.

## [1.4.0]
- Moved view into "Logs" activity bar so that the view appear in same bar as dlt-logs.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "smart-log",
"displayName": "Smart-Log",
"description": "Provides analysis and visualization features for text based log files.",
"version": "1.4.0",
"version": "1.4.1",
"license": "CC BY-NC-SA 4.0",
"publisher": "mbehr1",
"author": {
Expand Down
9 changes: 7 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,12 @@ export default class SmartLogs implements vscode.TreeDataProvider<EventNode>, vs

public async provideHover(doc: vscode.TextDocument, position: vscode.Position): Promise<vscode.Hover | null> {
const posTime = await this.provideTime(doc, position);
//const timePos = this.providePositionCloseTo(doc, posTime);
return new vscode.Hover({ language: "smart-log", value: `calculated time: ${posTime.toLocaleTimeString()}.${posTime.valueOf() % 1000} line#=${position.line}` }); // posCloseTo=${timePos?.line}` });
if (posTime && posTime.valueOf() > 0) {
//const timePos = this.providePositionCloseTo(doc, posTime);
return new vscode.Hover({ language: "smart-log", value: `calculated time: ${posTime.toLocaleTimeString()}.${posTime.valueOf() % 1000} line#=${position.line}` }); // posCloseTo=${timePos?.line}` });
}
console.warn(`smart-log.provideHover: can't determine time for position.line=${position.line} posTime=${posTime?.valueOf()}`);
return null;
}

public provideDocumentHighlights(doc: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken): vscode.ProviderResult<vscode.DocumentHighlight[]> {
Expand Down Expand Up @@ -436,6 +440,7 @@ export default class SmartLogs implements vscode.TreeDataProvider<EventNode>, vs
return new Date(0);
}

console.log(`smart-log.provideTimeByData regenerating cachedTimes. line=${line}/${data.doc.lineCount} vs. cachedTimes.lines=${data.cachedTimes?.length}`);

return vscode.window.withProgress({ location: vscode.ProgressLocation.Notification, cancellable: true }, async (progress, cancelToken): Promise<Date> => {

Expand Down

0 comments on commit 375c6ee

Please sign in to comment.