Skip to content

Make the showAndLog family of functions usable without the vscode module#2511

Merged
koesie10 merged 5 commits intomainfrom
koesie10/show-and-log-without-vscode
Jun 15, 2023
Merged

Make the showAndLog family of functions usable without the vscode module#2511
koesie10 merged 5 commits intomainfrom
koesie10/show-and-log-without-vscode

Conversation

@koesie10
Copy link
Copy Markdown
Member

@koesie10 koesie10 commented Jun 13, 2023

This makes the following functions callable without a dependency on the vscode module:

  • showAndLogErrorMessage
  • showAndLogWarningMessage
  • showAndLogInformationMessage

This PR does not yet fix the showAndLogExceptionWithTelemetry function since it has a dependency on the telemetryListener, which imports the vscode module. This will be fixed in a follow-up PR.

Unfortunately, most of the call sites are still using extLogger as argument rather than app.logger. I'm hoping that this will be fixed in the future as we move more to using the App.

Please review this PR commit-by-commit. Each commit is relatively self-contained and most changes in each commit are changing 1 file path or call signature.

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.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

@koesie10 koesie10 force-pushed the koesie10/show-and-log-without-vscode branch 2 times, most recently from 91f1109 to 7f73966 Compare June 13, 2023 10:09
Base automatically changed from koesie10/split-helpers-4 to main June 14, 2023 09:15
koesie10 added 5 commits June 14, 2023 11:16
This moves the `showAndLog` family of functions to the `common/logging`
directory. It explicitly moves the `showAndLogExceptionWithTelemetry`
function to the `common/vscode/logging.ts` file because it still has a
dependency on the `telemetryListener`, which depends on the `vscode`
module.
To increase the use of the `app` logger, this replaces the direct use of
`extLogger` by the `app.logger` where possible. This should not change
the behavior since the `extLogger` is the logger used by the `app`.
@koesie10 koesie10 force-pushed the koesie10/show-and-log-without-vscode branch from 7f73966 to 108d526 Compare June 14, 2023 09:17
@koesie10 koesie10 marked this pull request as ready for review June 14, 2023 09:18
@koesie10 koesie10 requested review from a team as code owners June 14, 2023 09:18
Copy link
Copy Markdown
Contributor

@robertbrignull robertbrignull left a comment

Choose a reason for hiding this comment

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

LGTM

This is a good step towards untangling VS Code dependencies. Sadly results in some more logger arguments passed to methods, but I think that's largely unavoidable.

I understand there's another PR to come that'll deal with the telemetry, so I've not looked too hard at that area.

@koesie10 koesie10 merged commit 539284b into main Jun 15, 2023
@koesie10 koesie10 deleted the koesie10/show-and-log-without-vscode branch June 15, 2023 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants