Skip to content

Commit

Permalink
Merge pull request #302 from aeisenberg/aeisenberg/large-log
Browse files Browse the repository at this point in the history
feat: Allow large log files to be opened externally
  • Loading branch information
aeisenberg authored Mar 23, 2020
2 parents 0b56092 + eed85e9 commit b689e55
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
1 change: 0 additions & 1 deletion extensions/ql-vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ hour for unauthenticated IPs.
- Fix the automatic upgrading of CodeQL databases when using upgrade scripts from the workspace.
- Allow removal of items from the CodeQL Query History view.


## 1.0.0 - 14 November 2019

Initial release of CodeQL for Visual Studio Code.
21 changes: 18 additions & 3 deletions extensions/ql-vscode/src/query-history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { CompletedQuery } from './query-results';
import { QueryHistoryConfig } from './config';
import { QueryWithResults } from './run-queries';
import * as helpers from './helpers';
import { logger } from './logging';

/**
* query-history.ts
Expand Down Expand Up @@ -191,12 +192,26 @@ export class QueryHistoryManager {

async handleShowQueryLog(queryHistoryItem: CompletedQuery) {
if (queryHistoryItem.logFileLocation) {
const uri = vscode.Uri.parse(queryHistoryItem.logFileLocation);
try {
await vscode.window.showTextDocument(vscode.Uri.parse(queryHistoryItem.logFileLocation), {
viewColumn: vscode.ViewColumn.Beside
await vscode.window.showTextDocument(uri, {
});
} catch (e) {
helpers.showAndLogErrorMessage(`Could not open log file ${queryHistoryItem.logFileLocation}`);
if (e.message.includes('Files above 50MB cannot be synchronized with extensions')) {
const res = await helpers.showBinaryChoiceDialog('File is too large to open in the editor, do you want to open exterally?');
if (res) {
try {
await vscode.commands.executeCommand('revealFileInOS', uri);
} catch (e) {
helpers.showAndLogErrorMessage(e.message);
}
}
} else {
helpers.showAndLogErrorMessage(`Could not open log file ${queryHistoryItem.logFileLocation}`);
logger.log(e.message);
logger.log(e.stack);
}

}
} else {
helpers.showAndLogWarningMessage('No log file available');
Expand Down

0 comments on commit b689e55

Please sign in to comment.