Skip to content

Commit

Permalink
Dismantle crate::lang::inspect module
Browse files Browse the repository at this point in the history
commit-id:ac76a216
  • Loading branch information
mkaput committed Jan 16, 2025
1 parent f8c54f4 commit ac179a4
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/ide/code_actions/add_missing_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ use lsp_types::{CodeAction, CodeActionKind, Range, TextEdit, Url, WorkspaceEdit}
use tracing::debug;

use crate::lang::db::{AnalysisDatabase, LsSemanticGroup, LsSyntaxGroup};
use crate::lang::inspect::methods::find_methods_for_type;
use crate::lang::lsp::{LsProtoGroup, ToLsp};
use crate::lang::methods::find_methods_for_type;

/// Create a Quick Fix code action to add a missing trait given a `CannotCallMethod` diagnostic.
pub fn add_missing_trait(db: &AnalysisDatabase, node: &SyntaxNode, uri: Url) -> Vec<CodeAction> {
Expand Down
2 changes: 1 addition & 1 deletion src/ide/completion/completions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ use lsp_types::{CompletionItem, CompletionItemKind, InsertTextFormat, Position,
use tracing::debug;

use crate::lang::db::{AnalysisDatabase, LsSemanticGroup};
use crate::lang::inspect::methods::find_methods_for_type;
use crate::lang::lsp::ToLsp;
use crate::lang::methods::find_methods_for_type;

pub fn generic_completions(
db: &AnalysisDatabase,
Expand Down
2 changes: 1 addition & 1 deletion src/ide/hover/render/definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use lsp_types::Hover;
use crate::ide::hover::markdown_contents;
use crate::ide::hover::render::markdown::{RULE, fenced_code_block};
use crate::lang::db::AnalysisDatabase;
use crate::lang::inspect::defs::SymbolDef;
use crate::lang::defs::SymbolDef;
use crate::lang::lsp::ToLsp;

/// Get declaration and documentation "definition" of an item referred by the given identifier.
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions src/ide/introspection/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//! Various CairoLS features facilitating introspection of source code analysis state.
pub mod crates;
1 change: 1 addition & 0 deletions src/ide/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ pub mod code_actions;
pub mod completion;
pub mod formatter;
pub mod hover;
pub mod introspection;
pub mod macros;
pub mod navigation;
pub mod semantic_highlighting;
2 changes: 1 addition & 1 deletion src/ide/navigation/goto_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use cairo_lang_utils::Upcast;
use lsp_types::{GotoDefinitionParams, GotoDefinitionResponse, Location};

use crate::lang::db::{AnalysisDatabase, LsSyntaxGroup};
use crate::lang::inspect::defs::SymbolDef;
use crate::lang::defs::SymbolDef;
use crate::lang::lsp::{LsProtoGroup, ToCairo, ToLsp};

/// Get the definition location of a symbol at a given text document position.
Expand Down
2 changes: 1 addition & 1 deletion src/ide/navigation/references.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use itertools::Itertools;
use lsp_types::{Location, ReferenceParams};

use crate::lang::db::{AnalysisDatabase, LsSyntaxGroup};
use crate::lang::inspect::defs::SymbolDef;
use crate::lang::defs::SymbolDef;
use crate::lang::lsp::{LsProtoGroup, ToCairo, ToLsp};

pub fn references(params: ReferenceParams, db: &AnalysisDatabase) -> Option<Vec<Location>> {
Expand Down
4 changes: 2 additions & 2 deletions src/lang/inspect/defs.rs → src/lang/defs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ use smol_str::SmolStr;
use tracing::error;

use crate::lang::db::{AnalysisDatabase, LsSemanticGroup, LsSyntaxGroup};
use crate::lang::inspect::usages::FindUsages;
use crate::lang::inspect::usages::search_scope::SearchScope;
use crate::lang::usages::FindUsages;
use crate::lang::usages::search_scope::SearchScope;

/// Keeps information about the symbol that is being searched for/inspected.
///
Expand Down
6 changes: 0 additions & 6 deletions src/lang/inspect/mod.rs

This file was deleted.

File renamed without changes.
4 changes: 3 additions & 1 deletion src/lang/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
pub mod db;
pub mod defs;
pub mod diagnostics;
pub mod inspect;
pub mod lsp;
pub mod methods;
pub mod proc_macros;
pub mod usages;
2 changes: 1 addition & 1 deletion src/lang/inspect/usages/mod.rs → src/lang/usages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use memchr::memmem::Finder;
use smol_str::format_smolstr;

use crate::lang::db::{AnalysisDatabase, LsSyntaxGroup};
use crate::lang::inspect::defs::SymbolDef;
use crate::lang::defs::SymbolDef;

pub mod search_scope;

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/server/routing/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use crate::server::client::{Notifier, Requester};
use crate::server::commands::ServerCommands;
use crate::state::{State, StateSnapshot};
use crate::toolchain::info::toolchain_info;
use crate::{Backend, ide, lang};
use crate::{Backend, ide};

/// A request handler that needs mutable access to the session.
/// This will block the main message receiver loop, meaning that no
Expand Down Expand Up @@ -345,7 +345,7 @@ impl BackgroundDocumentRequestHandler for ViewAnalyzedCrates {
_notifier: Notifier,
_params: (),
) -> LSPResult<String> {
Ok(lang::inspect::crates::inspect_analyzed_crates(&snapshot.db))
Ok(ide::introspection::crates::inspect_analyzed_crates(&snapshot.db))
}
}

Expand Down

0 comments on commit ac179a4

Please sign in to comment.