change comments to English

This commit is contained in:
2026-03-24 13:40:29 +00:00
parent 66f34eeb58
commit 912b9b0075
8 changed files with 61 additions and 62 deletions
+2 -2
View File
@@ -24,7 +24,7 @@ impl tower_lsp::LanguageServer for Backend {
tower_lsp::lsp_types::TextDocumentSyncKind::FULL,
),
),
// Declaramos capacidades desde já para evitar churn posterior.
// Declare capabilities up front to avoid later churn.
definition_provider: Some(tower_lsp::lsp_types::OneOf::Left(true)),
document_symbol_provider: Some(tower_lsp::lsp_types::OneOf::Left(true)),
workspace_symbol_provider: Some(tower_lsp::lsp_types::OneOf::Left(true)),
@@ -40,7 +40,7 @@ impl tower_lsp::LanguageServer for Backend {
tower_lsp::lsp_types::SemanticTokensServerCapabilities::SemanticTokensOptions(
tower_lsp::lsp_types::SemanticTokensOptions {
legend: tower_lsp::lsp_types::SemanticTokensLegend {
// preenchido no PR-12
// filled in PR-12
token_types: vec![],
token_modifiers: vec![],
},
+14 -14
View File
@@ -2,10 +2,10 @@ use tokio_util::sync::CancellationToken;
use crate::analysis_db::SharedDb;
/// Solicita rebuild do projeto (coarse). Cancela rebuild anterior se em progresso.
/// Implementação inicial: apenas cria task e retorna.
/// Requests a project rebuild (coarse). Cancels the previous rebuild if in progress.
/// Initial implementation: only spawns a task and returns.
pub async fn request_rebuild(db: SharedDb) {
// 1) lock curto: cancelar token anterior e instalar token novo
// 1) short lock: cancel previous token and install a new one
let new_token = CancellationToken::new();
{
let mut guard = db.write().await;
@@ -15,33 +15,33 @@ pub async fn request_rebuild(db: SharedDb) {
guard.active_rebuild = Some(new_token.clone());
}
// 2) spawn task: roda análise fora do lock
// 2) spawn task: run analysis outside the lock
tokio::spawn(async move {
// Ponto seguro: checar antes de começar
// Safe point: check before starting
if new_token.is_cancelled() { return; }
// TODO(PR-03/04/05):
// - Clonar snapshot de FileDB
// - Clone FileDB snapshot
// - Parsing
// - Binding/Resolver
// - Typecheck
// - Coleta de diagnostics
// - Collect diagnostics
// Ponto seguro: após parsing
// Safe point: after parsing
if new_token.is_cancelled() { return; }
// Ponto seguro: após resolver
// Safe point: after resolving
if new_token.is_cancelled() { return; }
// Ponto seguro: após typecheck
// Safe point: after typecheck
if new_token.is_cancelled() { return; }
// 3) lock curto: se token não cancelado, swap estado + revision++
// 3) short lock: if token not cancelled, swap state + revision++
if !new_token.is_cancelled() {
let mut guard = db.write().await;
// TODO: checar se o token ainda é o ativo quando tivermos um identificador estável
// TODO: check if the token is still the active one when we have a stable identifier
if !new_token.is_cancelled() {
// TODO: aplicar resultados reais de análise quando disponíveis
// TODO: apply real analysis results when available
guard.revision = guard.revision.saturating_add(1);
// Nota: não limpamos `active_rebuild` aqui para evitar interferir num rebuild mais novo
// Note: we don't clear `active_rebuild` here to avoid interfering with a newer rebuild
}
}
});