Skip to content

Add survey event #26455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Aug 29, 2018
Merged

Add survey event #26455

merged 9 commits into from
Aug 29, 2018

Conversation

sandersn
Copy link
Member

@sandersn sandersn commented Aug 14, 2018

This is still a work-in-progress, but I need some guidance. It's based on #26197.

Edit: I moved the event to sendProjectTelemetry, got rid of the url property, and added the test based on @sheetalkamat's in-person review.

@sandersn sandersn requested a review from sheetalkamat August 14, 2018 21:10
1. Move the survey event to sendProjectTelemetry so that it happens on
open instead of on editing tsconfig.
2. Remove URL from the survey type; VS code should control this
information.
3. Add test based on large files event test. I'm not sure it's in the
right place, though.
@sandersn
Copy link
Member Author

sandersn commented Aug 16, 2018

@sheetalkamat the CI failure looks like my new unit tests cause the existing large file tests to crash. Any idea how they could be interfering?

  2) tsserverProjectSystem with large file
       when large file is included by tsconfig:
     TypeError: Cannot read property 'call' of undefined
  
  3) tsserverProjectSystem with large file
       when large file is included by module resolution:
     TypeError: Cannot read property 'call' of undefined

const project = service.configuredProjects.get(tsconfig.path)!;
checkProjectActualFiles(project, [file.path, tsconfig.path]);

host.runQueuedTimeoutCallbacks();
Copy link
Member

Choose a reason for hiding this comment

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

You dont need this since creating project should send the event?

Copy link
Member Author

Choose a reason for hiding this comment

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

Left over from the previous way of raising the event on tsconfig changes.

@@ -9090,6 +9135,75 @@ export const x = 10;`
});
});

describe("tsserverProjectSystem with large file", () => {
Copy link
Member

Choose a reason for hiding this comment

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

Did you paste this by mistake ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh. Of course. Thanks!

@sheetalkamat
Copy link
Member

@sandersn are those tests duplicate of existing tests that you have there by mistake ?

const project = service.configuredProjects.get(tsconfig.path)!;
checkProjectActualFiles(project, [file.path, tsconfig.path]);

verifySurveyReadyEvent();
Copy link
Member

Choose a reason for hiding this comment

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

Few more tests:

  • When tsconfig doesnt contain checkJs
  • When project is closed and recreated, the event is not sent again.
  • when tsconfig file without checkJS, project closed, updated the tsconfig to contain checkJs and reloaded -> Do you expect event in this scenario?

@sandersn
Copy link
Member Author

OK, I think this is in much better shape now. Thanks @sheetalkamat for your help.

Copy link
Member

@sheetalkamat sheetalkamat left a comment

Choose a reason for hiding this comment

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

Except change in one test everything looks good.

const host = createServerHost([file, tsconfig]);
const { session, verifySurveyReadyEvent } = createSessionWithEventHandler(host);
openFilesForSession([file], session);

Copy link
Member

Choose a reason for hiding this comment

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

You want to check verifySurveyReadyEvent(1); here

openFilesForSession([rando], session);
openFilesForSession([file], session);

verifySurveyReadyEvent(1);
Copy link
Member

Choose a reason for hiding this comment

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

And verifySurveyReadyEvent(0) here ?

Copy link
Member Author

@sandersn sandersn Aug 29, 2018

Choose a reason for hiding this comment

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

Well, I only call createSessionWithEventHandler once, so I expect verifySurveyReadyEvent(1), verifySurveyReadyEvent(1) in the case that re-opening the project doesn't fire the survey event twice. It would be 1, then 2, if re-opening the project does fire the survey event twice.

So I think this line of code is already correct.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's because createSessionWithEventHandler creates an array to push events into, so the length of the array never goes down as long as you are working with a verifySurveyReadyEvent from a single call to createSessionWithEventHandler.

@sandersn sandersn merged commit 30f611b into master Aug 29, 2018
@sandersn sandersn deleted the add-survey-event branch August 29, 2018 02:57
@sandersn sandersn mentioned this pull request Feb 8, 2019
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