chore(vscode): add some debug logs

This commit is contained in:
Boshen 2024-01-06 20:31:42 +08:00
parent 42e7557f63
commit 0c5645097d
No known key found for this signature in database
GPG key ID: 9C7A8C8AB22BEBD1
2 changed files with 15 additions and 4 deletions

View file

@ -1,3 +1,4 @@
use log::debug;
use std::{
fs,
path::{Path, PathBuf},
@ -291,6 +292,7 @@ impl IsolatedLintHandler {
let not_supported_yet =
source_type.as_ref().is_err_and(|_| !LINT_PARTIAL_LOADER_EXT.contains(&ext));
if not_supported_yet {
debug!("extension {ext} not supported yet.");
return None;
}
let source_type = source_type.unwrap_or_default();
@ -325,6 +327,8 @@ impl IsolatedLintHandler {
let (source_text, source_type) = Self::may_need_extract_js_content(&source_text, ext)
.unwrap_or((&source_text, source_type));
debug!("lint {path:?}");
let allocator = Allocator::default();
let ret = Parser::new(&allocator, source_text, source_type)
.allow_return_outside_function(true)

View file

@ -191,10 +191,11 @@ impl LanguageServer for Backend {
if run_level < SyntheticRunLevel::OnSave {
return;
}
if self.is_ignored(&params.text_document.uri).await {
let uri = params.text_document.uri;
if self.is_ignored(&uri).await {
return;
}
self.handle_file_update(params.text_document.uri, None, None).await;
self.handle_file_update(uri, None, None).await;
}
/// When the document changed, it may not be written to disk, so we should
@ -205,7 +206,9 @@ impl LanguageServer for Backend {
return;
}
if self.is_ignored(&params.text_document.uri).await {
let uri = &params.text_document.uri;
if self.is_ignored(uri).await {
return;
return;
}
let content = params.content_changes.first().map(|c| c.text.clone());
@ -361,7 +364,11 @@ impl Backend {
return false;
};
let path = PathBuf::from(uri.path());
gitignore_globs.matched_path_or_any_parents(&path, path.is_dir()).is_ignore()
let ignored = gitignore_globs.matched_path_or_any_parents(&path, path.is_dir()).is_ignore();
if ignored {
debug!("ignored: {uri}");
}
ignored
}
}