Skip to content
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

Do not report config file errors if the file opened isn't from configured project and that project doesn't have the config errors #18959

Merged
merged 7 commits into from
Oct 12, 2017

Conversation

sheetalkamat
Copy link
Member

Fixes #16635

@sheetalkamat
Copy link
Member Author

@mhegazy or @andy-ms can you please take a look

@@ -255,6 +255,17 @@ namespace ts.projectSystem {
return events;
}

getEventsWithName<T extends server.ProjectServiceEvent>(eventName: T["eventName"]): ReadonlyArray<T> {
let events: T[];
removeWhere(this.events, event => {
Copy link

Choose a reason for hiding this comment

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

Use filterMutate instead of removeWhere (#19082). But does this function need to mutate this.events?

Copy link
Member Author

@sheetalkamat sheetalkamat Oct 10, 2017

Choose a reason for hiding this comment

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

Yes getEvent was written such that the already queried events would be removed. (and was written such that there will be only expected events present) getEventsWithName does same thing just ensures that we filter the list for only events asked

serverEventManager.checkEventCountOfType("configFileDiag", 1);
for (const event of serverEventManager.events) {
if (event.eventName === "configFileDiag") {
assert.equal(event.data.configFileName, configFile.path);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is a bit confusion for the API users. it would make more sense to not send this error event at all, unless this file is part of the project.

}

hasZeroEvent<T extends server.ProjectServiceEvent>(eventName: T["eventName"]) {
const eventCount = countWhere(this.events, event => event.eventName === eventName);
Copy link

Choose a reason for hiding this comment

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

Instead of getting a count, just loop through all events and assert that event.eventName !== eventName.

@sheetalkamat
Copy link
Member Author

ping @mhegazy and/or @andy-ms

@sheetalkamat sheetalkamat merged commit 6e5a4a9 into master Oct 12, 2017
@sheetalkamat sheetalkamat deleted the configFileDiag branch October 12, 2017 15:56
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
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.

2 participants