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

Minor connections refactor #3178

Merged
merged 3 commits into from
Apr 21, 2021
Merged

Minor connections refactor #3178

merged 3 commits into from
Apr 21, 2021

Conversation

code-asher
Copy link
Member

More details in the commit messages.

@code-asher code-asher requested a review from a team as a code owner April 20, 2021 22:28
Copy link
Contributor

@jsjoeio jsjoeio left a comment

Choose a reason for hiding this comment

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

This is awesome! Love the code comments too ♥️

P.S. - was this the thing we were discussing where I said I would learn from the code and write a test?

lib/vscode/src/vs/server/node/connection.ts Show resolved Hide resolved
lib/vscode/src/vs/server/node/protocol.ts Show resolved Hide resolved
@code-asher
Copy link
Member Author

Fixed up the double/single quote errors.

Nope, this is mostly just to set the stage so when it happens again we'll have some better logs to figure out what's going on.

@@ -27,7 +27,7 @@ export abstract class Connection {
) {
this.logger = logger.named(
this.name,
field("token", this.protocol.options.reconnectionToken),
field('token', this.protocol.options.reconnectionToken),
Copy link
Contributor

Choose a reason for hiding this comment

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

what's the difference between " and ' in JavaScript/TypeScript?

Copy link
Member Author

@code-asher code-asher Apr 21, 2021

Choose a reason for hiding this comment

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

None but VS Code's linting rules enforce ' for "unlocalized" strings (well technically externalized strings) so the only time they are allowed is in calls like:

localize('projectQuickPick.help', "TypeScript help")

Copy link
Contributor

Choose a reason for hiding this comment

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

ah very interesting pattern, so they're using something that extracts all "-quoted strings into resource bundles?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think they might be doing something like that, although if they can already detect and report to the dev when a string should be using " or ' I'm not sure why they can't just use that knowledge to extract it and don't bother the dev. 😛

@jsjoeio jsjoeio added this to the v3.9.4 milestone Apr 21, 2021
@jsjoeio
Copy link
Contributor

jsjoeio commented Apr 21, 2021

Nice work! Merge whenever 🚢

- Move destroy logic into the class itself
- Improve logging a bit
- Remove the record option; we should always do this when using
  permessage-deflate.
- Let debug port be null (it can be null in the message args).
- Add setSocket so we don't have to initiate a connection to set it.
- Move inflate bytes logic into the class itself.
- Moved everything I could into the class itself.
- Improve the logging situation a bit.
- Switch some trace logs to debug.
- Get debug port from message arguments.
zlib errors can cause the protocol handshake to not reject (until the
timeout).
@code-asher code-asher merged commit b9c80b8 into coder:main Apr 21, 2021
@code-asher code-asher deleted the connections branch April 21, 2021 17:22
@jsjoeio jsjoeio added the chore Related to maintenance or clean up label May 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Related to maintenance or clean up
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants