-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
feat(lsp): upgrade check on init and notification #21105
feat(lsp): upgrade check on init and notification #21105
Conversation
cli/tools/upgrade.rs
Outdated
pub async fn check_for_upgrades_for_lsp( | ||
http_client: Arc<HttpClient>, | ||
) -> Result<Option<(String, bool)>, AnyError> { | ||
let is_canary = version::is_canary(); | ||
let latest_version; | ||
let mut is_upgrade; | ||
if is_canary { |
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 seems to be checking for new version unconditionally - we should reuse logic from check_for_upgrades
that checks for DENO_NO_UPDATE_CHECK
as well as checks only once every few hours. That will also allow us to unit test this functionality.
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 env var check is at the call site. We can't reuse the cooldown logic because we have to know if there is or isn't an update available every time the LSP is connected to so that status shown in the extension is accurate.
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.
Okay, but can we do it in a task that doesn't block the LSP from starting up? It appears currently this is done serially and the LSP waits for the update check to finish.
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 appears currently this is done serially and the LSP waits for the update check to finish.
Nope it's done in the initialized
notification handler and outside of the LS lock. initialized
is responseless, the client will treat the server as ready after just sending it.
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.
Maybe it would be good to update or add a test that uses a url on the test server that will cause a hang for say 20 seconds? Then the test could assert it took less than 20 seconds? It would help in case there's ever a regression.
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.
Seems like it's really complicated to embed test URLs in the LSP without a public API (e.g. NPM_CONFIG_REGISTRY
). The LSP test harness for some reason (sometimes?) spawns a server with the non-test binary so conditional compilation is weird. Doesn't seem worth it
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 LSP test harness for some reason (sometimes?) spawns a server with the non-test binary so conditional compilation is weird.
Were you running cargo build
after making changes to the test server?
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.
Were you running
cargo build
after making changes to the test server?
I don't thinks so. Maybe it would work if I built test_util
most recently with cargo test test_util
, but... yeah. I think in the future we can make more of the language server centre unit testable.
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 believe this will output when the repl doesn't have internet connection, but otherwise it's looking good.
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!
Coupled with denoland/vscode_deno#988.
There's not much to unit test and an integration test isn't feasible. You can manually test by rolling back the version in
cli/Cargo.toml
, building, launching post-patch vscode_deno against that binary and clicking the status bar.