Skip to content

Add "Show log" button for all messages#274

Merged
aeisenberg merged 3 commits intogithub:masterfrom
aeisenberg:show-log
Mar 10, 2020
Merged

Add "Show log" button for all messages#274
aeisenberg merged 3 commits intogithub:masterfrom
aeisenberg:show-log

Conversation

@aeisenberg
Copy link
Copy Markdown
Contributor

@aeisenberg aeisenberg commented Mar 9, 2020

This change ensures that "Show log" is available on all messages
from the extension. It's important to note that the only place that
was specifying an "item" before was doing it incorrectly. That's
been fixed.

Closes #287

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.

This change ensures that "Show log" is available on all messages
from the extension. It's important to note that the only place that
was specifying an "item" before was doing it incorrectly. That's
been fixed.

Closes github#287
@aeisenberg
Copy link
Copy Markdown
Contributor Author

Added the changelog update and this includes adding a few lines for changes in previous PRs that I forgot to add.

Comment thread extensions/ql-vscode/src/databases.ts
Copy link
Copy Markdown
Contributor

@jcreedcmu jcreedcmu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you see a convenient way to have
const response = await Window.showInformationMessage('CodeQL Query Server restarted.', 'Show Log');
in extension.ts also use this helper? Slightly awkward since it's a different logger object... Leave it up to you.

Capitalization of Log/log should be made consistent anyhow. Either one's one.

Comment thread extensions/ql-vscode/src/extension.ts Outdated
if (response === 'Show Log') {
qs.showLog();
}
helpers.showAndLogInformationMessage('CodeQL Query Server restarted.');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, my fault for not being clear; the helper just needs an extra (optional? defaulting to logging.logger?) OutputChannelArgument argument or something, since the log stream that this existing 'Show Log' button shows (which I think is what we want) is the one named 'CodeQL Query Server', rather than the default 'CodeQL Extension Log', which is what helpers.ts is getting from logging.logger.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Darn. You're right. I wasn't reading carefully enough. I'll fix. Though, it's a little more complex since the last argument is varargs, but I should be able to do something.

Copy link
Copy Markdown
Contributor

@jcreedcmu jcreedcmu Mar 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seeing as we're making the wrappers around the underlying varargs methods on vscode.window already, I wouldn't mind at all refactoring to make them take an explicit array argument instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about if it takes a message arg and an options arg. This will make it more flexible and future-proof since I'm sure we'll want to augment with different behaviour later.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, sounds fine

Comment thread extensions/ql-vscode/src/helpers.ts Outdated
async function internalShowAndLog(message: string, fn: Function, ...items: string[]): Promise<string | undefined> {
logger.log(message);
const label = 'Show log';
async function internalShowAndLog(message: string, items: string[], outputLogger = logger, fn: Function): Promise<string | undefined> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally a nit, but I think I'd prefer the specific type (message: string, label: string, ...items: string[]) => Thenable<string | undefined> to just Function.

Also, changes the showAndLog* signatures to accept an optional
logger argument.
@aeisenberg aeisenberg merged commit b577c12 into github:master Mar 10, 2020
@aeisenberg
Copy link
Copy Markdown
Contributor Author

Also, Closes #273

@aeisenberg aeisenberg deleted the show-log branch November 24, 2020 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants