-
Notifications
You must be signed in to change notification settings - Fork 82
Integrate the ExP framework #260
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
Conversation
package.json
Outdated
"webpack-cli": "^3.3.11" | ||
}, | ||
"dependencies": { | ||
"fs-extra": "^7.0.1", | ||
"lodash": "^4.17.15", | ||
"minimatch": "^3.0.4", | ||
"vscode-extension-telemetry-wrapper": "^0.7.1" | ||
"vscode-extension-telemetry-wrapper": "^0.7.1", | ||
"vscode-tas-client": "0.0.702" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should actually use version 0.0.659
of vscode-tas-client
for now. 0.0.702
has a bug that I'll resolve later this week.
src/ExpManager.ts
Outdated
return false; | ||
} | ||
|
||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The vscode-tas-client
package will query the treatment assignment service in the background (every 30 minutes), so flight information should never be much staler than the last opened instance of VS Code. If you want to be absolutely sure your extension has up-to-date flight information, you can do this. However, it probably isn't necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So does that mean that we can just call isCachedFlightEnabled()
here, and call isFlightEnabledAsync()
for 1 time in the init
method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't ever need to call isFlightEnabledAsync
unless you want the absolute latest flight information. But I can't think of any scenarios where you would.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Thank you @daytonellwanger.
Another question, is below code needed in the init functions?
const asyncDummyCheck = (arg: any) => {
expService?.isFlightEnabledAsync('dummy').then((v) => { return; }).catch((r) => { return; });
};
expService?.isCachedFlightEnabled('dummy').then(asyncDummyCheck).catch(asyncDummyCheck);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should no longer be needed with the version of the vscode-tas-client
package I mentioned above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Thank you for your help @daytonellwanger. :)
I'll update the code according to the comments.
src/ExperimentationService.ts
Outdated
|
||
export function init(context: vscode.ExtensionContext) { | ||
const extensionName = "vscjava.vscode-java-dependency"; | ||
const extensionVersion = "0.10.1"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better to read this from your package.json
so you don't have to remember to update this when you change the extension version.
src/controllers/projectController.ts
Outdated
@@ -31,10 +32,16 @@ export class ProjectController implements Disposable { | |||
detail: "A project without any build tools", | |||
}]; | |||
if (contextManager.getContextValue(Context.MAVEN_ENABLED)) { | |||
projectKinds.push({ | |||
const isMavenDefault: boolean = await expManager.isFlightEnabled("defaultMaven"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you OK paying the async cost here? Given that this could result in an http request, this could be 1-5 seconds.
src/ExperimentationService.ts
Outdated
} | ||
|
||
export async function init(context: vscode.ExtensionContext): Promise<void> { | ||
const packageJson: {} = await fse.readJSON(context.asAbsolutePath("package.json")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might be able to just do require('package.json')
?
expService = getExperimentationService(extensionName, extensionVersion, | ||
TargetPopulation.Public, new ExperimentationTelemetry(), context.globalState); | ||
|
||
// Due to a bug in the tas-client module, a call to isFlightEnabledAsync is required to begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to drop these dummy checks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh interesting. Maybe we still have another bug to track down. OK, keep these checks for now and I'll look into the issue ASAP, and with the next update to the package, you can remove them.
Hey @daytonellwanger, I have updated the PR. Please take a look when you have time. Thanks a lot. |
src/controllers/projectController.ts
Outdated
@@ -31,10 +32,16 @@ export class ProjectController implements Disposable { | |||
detail: "A project without any build tools", | |||
}]; | |||
if (contextManager.getContextValue(Context.MAVEN_ENABLED)) { | |||
projectKinds.push({ | |||
const isMavenDefault: boolean = await getExpService().isCachedFlightEnabled("defaultMaven"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null check after getExpService
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
No description provided.