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

Create platform directory structure #9439

Merged
merged 19 commits into from
Mar 22, 2022
Merged

Create platform directory structure #9439

merged 19 commits into from
Mar 22, 2022

Conversation

rchiodo
Copy link
Contributor

@rchiodo rchiodo commented Mar 21, 2022

Fixes #8981

Did a bunch of stuff:

  • Renamed 'client' directory to 'platform' and moved some stuff out of the 'client/datascience' directory into their respective root locations.
  • Move telemetry code into its own folder. This was in multiple spots. Consolidated it to a root folder
  • Create a serviceRegistry.ts hierarchy. All root folders (will) have a serviceRegistry.ts. This is where injectable classes are added to the main DI container.
  • Create a single extension.ts at the 'src' folder level. It simply creates the container and registers everything.

@rchiodo rchiodo requested a review from a team as a code owner March 21, 2022 23:16
@@ -140,7 +140,7 @@
],
"env": {
"VSC_JUPYTER_FORCE_LOGGING": "1",
"VSC_JUPYTER_CI_TEST_GREP": "", // Leave as `VSCode Notebook` to run only Notebook tests.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops. Didn't mean to change this

@codecov-commenter
Copy link

codecov-commenter commented Mar 21, 2022

Codecov Report

Merging #9439 (ab43307) into main (7b5cd3c) will decrease coverage by 0%.
The diff coverage is 74%.

❗ Current head ab43307 differs from pull request most recent head 06016b9. Consider uploading reports for the commit 06016b9 to get more accurate results

@@          Coverage Diff           @@
##            main   #9439    +/-   ##
======================================
- Coverage     74%     73%    -1%     
======================================
  Files        219     228     +9     
  Lines      10939   10500   -439     
  Branches    1571    1538    -33     
======================================
- Hits        8127    7700   -427     
+ Misses      2185    2174    -11     
+ Partials     627     626     -1     
Impacted Files Coverage Δ
...rm/activation/migrateDataScienceSettingsService.ts 83% <ø> (ø)
src/platform/activation/serviceRegistry.ts 100% <ø> (ø)
src/platform/activation/types.ts 100% <ø> (ø)
src/platform/api.ts 57% <ø> (ø)
src/platform/api/serviceRegistry.ts 100% <ø> (ø)
src/platform/api/types.ts 100% <ø> (ø)
src/platform/common/application/activeResource.ts 72% <ø> (ø)
...tform/common/application/applicationEnvironment.ts 50% <ø> (ø)
...rc/platform/common/application/applicationShell.ts 26% <0%> (ø)
src/platform/common/application/clipboard.ts 42% <ø> (ø)
... and 348 more

@@ -108,7 +109,7 @@ export function formatStreamText(str: string): string {
export function appendLineFeed(arr: string[], modifier?: (s: string) => string) {
return arr.map((s: string, i: number) => {
const out = modifier ? modifier(s) : s;
return i === arr.length - 1 ? `${out}` : `${out}\n`;
return i === arr.length - 1 ? `${out}` : `${out}${os.EOL}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure this is correct. I remember Jupyter used just \n (line feeds).
E.g. if we have some multi-line code in a non-python kernel, then it could crash (I know R kernel doesn't support CRLF & we had to ensure we didn't use that else the execution would just crash)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll make it only used for export.

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 we can't change even for export, sas we'd end up with crlf in ipynb, and this isn't going to work when anyone execute these cells for R or the like.

out of curiosity, what prompted the change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Export tests were failing and the output made them look the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ipynb already remove any \r\n in them. However export generates python files which assumes the same EOL as the OS. The tests actually verify this is the case.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh this is export ipynb to py. i thought it was the other way around.

@@ -8,7 +8,7 @@ type identifier<T> = string | symbol | Newable<T> | Abstract<T>;

@injectable()
export class ServiceManager implements IServiceManager {
constructor(private container: Container) {}
constructor(public readonly container: Container) {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we create a property with a simple getter that has a decorator to ensure this gets accessed only during tests.
I.e. use the @testOnlyMethod decorator that Ian added.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not required, i think its a good practice

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. Didn't realize we had a testOnlyDecorator.

Copy link
Member

@IanMatthewHuff IanMatthewHuff Mar 22, 2022

Choose a reason for hiding this comment

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

Yeah, I added it for the WebViewHost I think if you want to see it used. Do wonder about the best was to sometimes use these decorators, like I'm not sure how you would be expected to know that we added one? Util stuff just kinda hide out of the way sometimes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FYI, the decorator doesn't work on a getter. Throws an error. I had to change this to a function getContainer

Copy link
Contributor

@DonJayamanne DonJayamanne left a comment

Choose a reason for hiding this comment

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

Looks good,
didn't review the tests, eyes & figures started hurting,

@IanMatthewHuff
Copy link
Member

@rchiodo Nice work! I 100% say would not change this now (or ever maybe), but just something that I like is if the ordering lines up for the functions.

For example there is registerPlatformTypes and processRegisterTypes. I would slightly prefer having them both follow the same ordering like registerPlatformTypes and registerProcessTypes. Or switch to platformRegisterTypes and processRegisterTypes. Just makes them easier to find searching if they follow the same format.

@rchiodo rchiodo merged commit 46f103d into main Mar 22, 2022
@rchiodo rchiodo deleted the rchiodo/platform_directory branch March 22, 2022 22:01
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.

Refactor extension initialization code into an 'Extension' subfolder off of src
4 participants