-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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): add internal debugging logging #10438
Conversation
cli/lsp/performance.rs
Outdated
let name = name.as_ref(); | ||
let mut counts = self.counts.lock().unwrap(); | ||
let count = counts.entry(name.to_string()).or_insert(0); | ||
*count += 1; | ||
if self.logging_enabled { |
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.
Ideally this should use the conditional logging provided by the rust log / env_logger crate.
9e436d3
to
08b4a79
Compare
cli/main.rs
Outdated
unwrap_or_exit(tokio_util::run_basic(get_subcommand(flags))); | ||
// when this flag is set to `true`, the process will log specific diagnostic | ||
// debug information, | ||
let lsp_debug_flag = Arc::new(AtomicBool::new(false)); |
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's unfortunate that this lsp_debug_flag
has leaked all the way to top-level of the program and many signatures have to be modified to pass it around.
What if you use lazy_static to have a global Arc<AtomicBool>
in cli/logger.rs
? Then cli/lsp/language_server.rs
could reference that directly without having to pass it around like this. I think practically lsp_debug_flag
is a global anyway.
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.
Yeah, that makes more sense. I will try that.
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
This reverts commit 81f8585.
Ref: #10368
The lsp would respect a setting which will log all the marks and measures to stderr along with their arguments which can be used to investigate certain issues (as well as more easily generate test cases). This requires a client which can pass the configuration option (see: denoland/vscode_deno#406).