Skip to content

Show the debugger survey banner for only a subset of users.#2425

Merged
ericsnowcurrently merged 12 commits into
microsoft:masterfrom
ericsnowcurrently:fix-2300-debugger-banner-2
Aug 22, 2018
Merged

Show the debugger survey banner for only a subset of users.#2425
ericsnowcurrently merged 12 commits into
microsoft:masterfrom
ericsnowcurrently:fix-2300-debugger-banner-2

Conversation

@ericsnowcurrently
Copy link
Copy Markdown

@ericsnowcurrently ericsnowcurrently commented Aug 21, 2018

(fixes #2300)

  • Title summarizes what is changing
  • Includes a news entry file (remember to thank yourself!)
  • Unit tests & code coverage are not adversely affected (within reason)
  • Works on all actively maintained versions of Python (e.g. Python 2.7 & the latest Python 3 release)
  • Works on Windows 10, macOS, and Linux (e.g. considered file system case-sensitivity)
  • Dependencies are pinned (e.g. "1.2.3", not "^1.2.3")
  • package-lock.json has been regenerated if dependencies have changed

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 21, 2018

Codecov Report

Merging #2425 into master will increase coverage by 0.08%.
The diff coverage is 93.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2425      +/-   ##
==========================================
+ Coverage    75.4%   75.49%   +0.08%     
==========================================
  Files         309      309              
  Lines       14331    14363      +32     
  Branches     2536     2538       +2     
==========================================
+ Hits        10807    10843      +36     
+ Misses       3515     3512       -3     
+ Partials        9        8       -1
Flag Coverage Δ
#MacOS 74.32% <93.75%> (+0.07%) ⬆️
#Windows 74.4% <93.75%> (+0.06%) ⬆️
Impacted Files Coverage Δ
src/client/common/types.ts 100% <100%> (ø) ⬆️
src/client/common/serviceRegistry.ts 100% <100%> (ø) ⬆️
src/client/debugger/serviceRegistry.ts 100% <100%> (ø) ⬆️
src/client/debugger/types.ts 100% <100%> (ø) ⬆️
src/client/extension.ts 95.42% <100%> (ø) ⬆️
src/client/common/utils.ts 74.68% <33.33%> (-1.64%) ⬇️
src/client/debugger/banner.ts 91.89% <95.52%> (+11.89%) ⬆️
src/client/linters/lintingEngine.ts 91.15% <0%> (-0.89%) ⬇️
src/client/debugger/mainV2.ts 68.32% <0%> (-0.36%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6369262...8275934. Read the comment docs.


// "enabled" state

public isEnabled(): boolean {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

readonly get?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It isn't necessarily a cheap operation. A function reflects that.

Comment thread src/client/common/platform/types.ts Outdated
createTemporaryFile(extension: string): Promise<TemporaryFile>;
}

export const IRuntime = Symbol('IRuntime');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks more like utilities than runtime

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

fixed

Comment thread src/client/debugger/banner.ts Outdated

public async show(): Promise<void> {
const appShell = this.serviceContainer.get<IApplicationShell>(IApplicationShell);
const msg = 'Can you please take 2 minutes to tell us how the Debugger is working for you?';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

debugger

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

fixed

Comment thread src/client/debugger/banner.ts Outdated
const yes = 'Yes, take survey now';
const no = 'No thanks';
const response = await appShell.showInformationMessage('Can you please take 2 minutes to tell us how the Debugger is working for you?', yes, no);
const later = 'Remind me Later';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

later

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

fixed

) { }

public initialize() {
if (this.initialized) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

can it simply init itself in ctor?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Apparently constructors are meant to contain only trivial initialization operations. Hence a separate initialize() method.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

But it has to be called anyway right after the construction? What does it save?

Copy link
Copy Markdown

@d3r3kk d3r3kk left a comment

Choose a reason for hiding this comment

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

I think your solution works. Consider my feedback on caching all the services on init, but it's definitely not necessary. @MikhailArkhipov's suggestions on wording/names are good ideas too.

// "enabled" state

public isEnabled(): boolean {
const factory = this.serviceContainer.get<IPersistentStateFactory>(IPersistentStateFactory);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Any way we can cache this at the initialize step in the class? Probably not going to make a huge difference, but perhaps it will speed some things along.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'm going to punt on this. :) There are a lot of little improvements that could be made. I had to stop myself. :)

const runtime = this.serviceContainer.get<IRuntime>(IRuntime);
const randomSample = runtime.getRandomInt(0, 100);
selected = randomSample < SAMPLE_SIZE_PER_HUNDRED;
state.updateValue(selected).ignoreErrors();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You can probably just await this one, no need to use the ignoreErrors I don't think. Consider using a then-clause?

state.updateValue(selected).then(() => {
    do_something_on_success();
}, (failReason) => {
    do_something_else_on_fail();
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This was copied from somewhere else.

@ericsnowcurrently ericsnowcurrently merged commit 2a6043d into microsoft:master Aug 22, 2018
@ericsnowcurrently ericsnowcurrently deleted the fix-2300-debugger-banner-2 branch August 22, 2018 16:51
@lock lock Bot locked as resolved and limited conversation to collaborators Jul 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

What do we do with the experimental debugger banner

4 participants