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

fix: Use connected connection model options VSCODE-234 #255

Conversation

Anemy
Copy link
Member

@Anemy Anemy commented Feb 9, 2021

VSCODE-234

This PR updates how we fetch connection details to pass to playgrounds, so that we take the options which were used when connecting. This should fix #249 since now we'll use the options with directionConnection set: https://github.com/mongodb-js/connection-model/blob/master/lib/connect.js#L228 Alternatively we could set directConnection manually, or set it in connection options in connection-model.

This PR also adds a check so that we only run a playground when the connected connection's id matches the connection id passed when running the playground.

The way we're handling these ssl files, and connection options is a bit confusing. I think we can clear it up a bit in future, especially once we upgrade to 4.0. We can remove sslKey from our model and avoid any ssl file reading. I also think how we're deriving these connection options from the data service post connection is a bit error prone. I think some better defaults on the connection model or how its originally parsed could clear it up a bit. Not for this PR though.

  • Ran playground vs ssl connection.
  • Ran playground vs connection which needs direct connection defaulted to true to connect

@Anemy Anemy requested a review from alenakhineika February 9, 2021 13:53
}

this._activeConnectionCodeLensProvider?.refresh();
const connectionDetails = dataService.getConnectionOptions();
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like connectionDetails name is confusing because we get connectionOptions from dataservice. Probably should be renamed in the dataservice since it includes options and URL and not just options.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed. I think this is a bit of a hack in general. Will be nice to update to new driver and clean up some of this.

);

return resolve(undefined);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@alenakhineika
Copy link
Contributor

alenakhineika commented Feb 9, 2021

Great refactoring of the playground controller! It will definitely ensure that playgrounds are running on the proper connection. Does this fix also address the directConnection issue?

@Anemy
Copy link
Member Author

Anemy commented Feb 9, 2021

@alenakhineika Here are the connection options being used to connect on the language server now (ssh tunnel connection):
Screen Shot 2021-02-09 at 7 52 11 PM

@Anemy Anemy merged commit 9cd5c36 into master Feb 9, 2021
@Anemy Anemy deleted the VSCODE-234/use-connection-options-from-data-service-for-playgrounds branch February 9, 2021 18:57
@Anemy Anemy mentioned this pull request Feb 10, 2021
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.

Playground tries to use local network name when executing queries
2 participants