Merge pull request #302 from aeisenberg/aeisenberg/large-log

feat: Allow large log files to be opened externally
This commit is contained in:
Andrew Eisenberg 2020-03-23 09:13:42 -07:00 коммит произвёл GitHub
Родитель 0b56092466 eed85e9e28
Коммит b689e55f61
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 18 добавлений и 4 удалений

Просмотреть файл

@ -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.

Просмотреть файл

@ -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
@ -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');