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

feat(lsp): add internal debugging logging #10438

Merged
merged 7 commits into from
May 11, 2021
Merged

Conversation

kitsonk
Copy link
Contributor

@kitsonk kitsonk commented Apr 30, 2021

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).

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 {
Copy link
Member

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.

@kitsonk kitsonk force-pushed the feat_lsp_debug branch 3 times, most recently from 9e436d3 to 08b4a79 Compare May 7, 2021 11:21
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));
Copy link
Member

@ry ry May 7, 2021

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.

Copy link
Contributor Author

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.

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

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

LGTM

@kitsonk kitsonk merged commit 81f8585 into denoland:main May 11, 2021
@kitsonk kitsonk deleted the feat_lsp_debug branch May 11, 2021 04:54
ry added a commit to ry/deno that referenced this pull request May 12, 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.

None yet

2 participants