Depend on nohash-hasher individually
This commit is contained in:
parent
1d678cf6a0
commit
4a1922fd1a
7
Cargo.lock
generated
7
Cargo.lock
generated
@ -587,6 +587,7 @@ dependencies = [
|
|||||||
"itertools",
|
"itertools",
|
||||||
"la-arena",
|
"la-arena",
|
||||||
"limit",
|
"limit",
|
||||||
|
"nohash-hasher",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"profile",
|
"profile",
|
||||||
"project-model",
|
"project-model",
|
||||||
@ -650,6 +651,7 @@ dependencies = [
|
|||||||
"ide-diagnostics",
|
"ide-diagnostics",
|
||||||
"ide-ssr",
|
"ide-ssr",
|
||||||
"itertools",
|
"itertools",
|
||||||
|
"nohash-hasher",
|
||||||
"oorandom",
|
"oorandom",
|
||||||
"profile",
|
"profile",
|
||||||
"pulldown-cmark",
|
"pulldown-cmark",
|
||||||
@ -719,6 +721,7 @@ dependencies = [
|
|||||||
"limit",
|
"limit",
|
||||||
"line-index",
|
"line-index",
|
||||||
"memchr",
|
"memchr",
|
||||||
|
"nohash-hasher",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"oorandom",
|
"oorandom",
|
||||||
"parser",
|
"parser",
|
||||||
@ -764,6 +767,7 @@ dependencies = [
|
|||||||
"hir",
|
"hir",
|
||||||
"ide-db",
|
"ide-db",
|
||||||
"itertools",
|
"itertools",
|
||||||
|
"nohash-hasher",
|
||||||
"parser",
|
"parser",
|
||||||
"stdx",
|
"stdx",
|
||||||
"syntax",
|
"syntax",
|
||||||
@ -1485,6 +1489,7 @@ dependencies = [
|
|||||||
"mbe",
|
"mbe",
|
||||||
"mimalloc",
|
"mimalloc",
|
||||||
"mio",
|
"mio",
|
||||||
|
"nohash-hasher",
|
||||||
"num_cpus",
|
"num_cpus",
|
||||||
"oorandom",
|
"oorandom",
|
||||||
"parking_lot 0.12.1",
|
"parking_lot 0.12.1",
|
||||||
@ -1708,7 +1713,6 @@ dependencies = [
|
|||||||
"backtrace",
|
"backtrace",
|
||||||
"libc",
|
"libc",
|
||||||
"miow",
|
"miow",
|
||||||
"nohash-hasher",
|
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -2066,6 +2070,7 @@ version = "0.0.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"fst",
|
"fst",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
|
"nohash-hasher",
|
||||||
"paths",
|
"paths",
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
"stdx",
|
"stdx",
|
||||||
|
@ -29,6 +29,7 @@ chalk-derive = "0.89.0"
|
|||||||
la-arena = { version = "0.3.0", path = "../../lib/la-arena" }
|
la-arena = { version = "0.3.0", path = "../../lib/la-arena" }
|
||||||
once_cell = "1.17.0"
|
once_cell = "1.17.0"
|
||||||
triomphe.workspace = true
|
triomphe.workspace = true
|
||||||
|
nohash-hasher.workspace = true
|
||||||
typed-arena = "2.0.1"
|
typed-arena = "2.0.1"
|
||||||
rustc_index = { version = "0.0.20221221", package = "hkalbasi-rustc-ap-rustc_index", default-features = false }
|
rustc_index = { version = "0.0.20221221", package = "hkalbasi-rustc-ap-rustc_index", default-features = false }
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
};
|
};
|
||||||
use hir_def::{db::DefDatabase, ModuleId};
|
use hir_def::{db::DefDatabase, ModuleId};
|
||||||
use hir_expand::db::ExpandDatabase;
|
use hir_expand::db::ExpandDatabase;
|
||||||
|
use nohash_hasher::IntMap;
|
||||||
use rustc_hash::FxHashSet;
|
use rustc_hash::FxHashSet;
|
||||||
use stdx::hash::NoHashHashMap;
|
|
||||||
use syntax::TextRange;
|
use syntax::TextRange;
|
||||||
use test_utils::extract_annotations;
|
use test_utils::extract_annotations;
|
||||||
use triomphe::Arc;
|
use triomphe::Arc;
|
||||||
@ -102,7 +102,7 @@ pub(crate) fn module_for_file(&self, file_id: FileId) -> ModuleId {
|
|||||||
self.module_for_file_opt(file_id).unwrap()
|
self.module_for_file_opt(file_id).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn extract_annotations(&self) -> NoHashHashMap<FileId, Vec<(TextRange, String)>> {
|
pub(crate) fn extract_annotations(&self) -> IntMap<FileId, Vec<(TextRange, String)>> {
|
||||||
let mut files = Vec::new();
|
let mut files = Vec::new();
|
||||||
let crate_graph = self.crate_graph();
|
let crate_graph = self.crate_graph();
|
||||||
for krate in crate_graph.iter() {
|
for krate in crate_graph.iter() {
|
||||||
|
@ -24,6 +24,7 @@ arrayvec = "0.7.2"
|
|||||||
indexmap = "1.9.1"
|
indexmap = "1.9.1"
|
||||||
memchr = "2.5.0"
|
memchr = "2.5.0"
|
||||||
triomphe.workspace = true
|
triomphe.workspace = true
|
||||||
|
nohash-hasher.workspace = true
|
||||||
|
|
||||||
# local deps
|
# local deps
|
||||||
base-db.workspace = true
|
base-db.workspace = true
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
AsAssocItem, DefWithBody, HasAttrs, HasSource, InFile, ModuleSource, Semantics, Visibility,
|
AsAssocItem, DefWithBody, HasAttrs, HasSource, InFile, ModuleSource, Semantics, Visibility,
|
||||||
};
|
};
|
||||||
use memchr::memmem::Finder;
|
use memchr::memmem::Finder;
|
||||||
|
use nohash_hasher::IntMap;
|
||||||
use once_cell::unsync::Lazy;
|
use once_cell::unsync::Lazy;
|
||||||
use parser::SyntaxKind;
|
use parser::SyntaxKind;
|
||||||
use stdx::hash::NoHashHashMap;
|
|
||||||
use syntax::{ast, match_ast, AstNode, TextRange, TextSize};
|
use syntax::{ast, match_ast, AstNode, TextRange, TextSize};
|
||||||
use triomphe::Arc;
|
use triomphe::Arc;
|
||||||
|
|
||||||
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#[derive(Debug, Default, Clone)]
|
#[derive(Debug, Default, Clone)]
|
||||||
pub struct UsageSearchResult {
|
pub struct UsageSearchResult {
|
||||||
pub references: NoHashHashMap<FileId, Vec<FileReference>>,
|
pub references: IntMap<FileId, Vec<FileReference>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UsageSearchResult {
|
impl UsageSearchResult {
|
||||||
@ -50,7 +50,7 @@ pub fn file_ranges(&self) -> impl Iterator<Item = FileRange> + '_ {
|
|||||||
|
|
||||||
impl IntoIterator for UsageSearchResult {
|
impl IntoIterator for UsageSearchResult {
|
||||||
type Item = (FileId, Vec<FileReference>);
|
type Item = (FileId, Vec<FileReference>);
|
||||||
type IntoIter = <NoHashHashMap<FileId, Vec<FileReference>> as IntoIterator>::IntoIter;
|
type IntoIter = <IntMap<FileId, Vec<FileReference>> as IntoIterator>::IntoIter;
|
||||||
|
|
||||||
fn into_iter(self) -> Self::IntoIter {
|
fn into_iter(self) -> Self::IntoIter {
|
||||||
self.references.into_iter()
|
self.references.into_iter()
|
||||||
@ -84,17 +84,17 @@ pub enum ReferenceCategory {
|
|||||||
/// e.g. for things like local variables.
|
/// e.g. for things like local variables.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct SearchScope {
|
pub struct SearchScope {
|
||||||
entries: NoHashHashMap<FileId, Option<TextRange>>,
|
entries: IntMap<FileId, Option<TextRange>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SearchScope {
|
impl SearchScope {
|
||||||
fn new(entries: NoHashHashMap<FileId, Option<TextRange>>) -> SearchScope {
|
fn new(entries: IntMap<FileId, Option<TextRange>>) -> SearchScope {
|
||||||
SearchScope { entries }
|
SearchScope { entries }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Build a search scope spanning the entire crate graph of files.
|
/// Build a search scope spanning the entire crate graph of files.
|
||||||
fn crate_graph(db: &RootDatabase) -> SearchScope {
|
fn crate_graph(db: &RootDatabase) -> SearchScope {
|
||||||
let mut entries = NoHashHashMap::default();
|
let mut entries = IntMap::default();
|
||||||
|
|
||||||
let graph = db.crate_graph();
|
let graph = db.crate_graph();
|
||||||
for krate in graph.iter() {
|
for krate in graph.iter() {
|
||||||
@ -108,7 +108,7 @@ fn crate_graph(db: &RootDatabase) -> SearchScope {
|
|||||||
|
|
||||||
/// Build a search scope spanning all the reverse dependencies of the given crate.
|
/// Build a search scope spanning all the reverse dependencies of the given crate.
|
||||||
fn reverse_dependencies(db: &RootDatabase, of: hir::Crate) -> SearchScope {
|
fn reverse_dependencies(db: &RootDatabase, of: hir::Crate) -> SearchScope {
|
||||||
let mut entries = NoHashHashMap::default();
|
let mut entries = IntMap::default();
|
||||||
for rev_dep in of.transitive_reverse_dependencies(db) {
|
for rev_dep in of.transitive_reverse_dependencies(db) {
|
||||||
let root_file = rev_dep.root_file(db);
|
let root_file = rev_dep.root_file(db);
|
||||||
let source_root_id = db.file_source_root(root_file);
|
let source_root_id = db.file_source_root(root_file);
|
||||||
@ -128,7 +128,7 @@ fn krate(db: &RootDatabase, of: hir::Crate) -> SearchScope {
|
|||||||
|
|
||||||
/// Build a search scope spanning the given module and all its submodules.
|
/// Build a search scope spanning the given module and all its submodules.
|
||||||
fn module_and_children(db: &RootDatabase, module: hir::Module) -> SearchScope {
|
fn module_and_children(db: &RootDatabase, module: hir::Module) -> SearchScope {
|
||||||
let mut entries = NoHashHashMap::default();
|
let mut entries = IntMap::default();
|
||||||
|
|
||||||
let (file_id, range) = {
|
let (file_id, range) = {
|
||||||
let InFile { file_id, value } = module.definition_source(db);
|
let InFile { file_id, value } = module.definition_source(db);
|
||||||
@ -161,7 +161,7 @@ fn module_and_children(db: &RootDatabase, module: hir::Module) -> SearchScope {
|
|||||||
|
|
||||||
/// Build an empty search scope.
|
/// Build an empty search scope.
|
||||||
pub fn empty() -> SearchScope {
|
pub fn empty() -> SearchScope {
|
||||||
SearchScope::new(NoHashHashMap::default())
|
SearchScope::new(IntMap::default())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Build a empty search scope spanning the given file.
|
/// Build a empty search scope spanning the given file.
|
||||||
|
@ -5,16 +5,16 @@
|
|||||||
|
|
||||||
use std::{collections::hash_map::Entry, iter, mem};
|
use std::{collections::hash_map::Entry, iter, mem};
|
||||||
|
|
||||||
|
use crate::SnippetCap;
|
||||||
use base_db::{AnchoredPathBuf, FileId};
|
use base_db::{AnchoredPathBuf, FileId};
|
||||||
use stdx::{hash::NoHashHashMap, never};
|
use nohash_hasher::IntMap;
|
||||||
|
use stdx::never;
|
||||||
use syntax::{algo, ast, ted, AstNode, SyntaxNode, SyntaxNodePtr, TextRange, TextSize};
|
use syntax::{algo, ast, ted, AstNode, SyntaxNode, SyntaxNodePtr, TextRange, TextSize};
|
||||||
use text_edit::{TextEdit, TextEditBuilder};
|
use text_edit::{TextEdit, TextEditBuilder};
|
||||||
|
|
||||||
use crate::SnippetCap;
|
|
||||||
|
|
||||||
#[derive(Default, Debug, Clone)]
|
#[derive(Default, Debug, Clone)]
|
||||||
pub struct SourceChange {
|
pub struct SourceChange {
|
||||||
pub source_file_edits: NoHashHashMap<FileId, TextEdit>,
|
pub source_file_edits: IntMap<FileId, TextEdit>,
|
||||||
pub file_system_edits: Vec<FileSystemEdit>,
|
pub file_system_edits: Vec<FileSystemEdit>,
|
||||||
pub is_snippet: bool,
|
pub is_snippet: bool,
|
||||||
}
|
}
|
||||||
@ -23,7 +23,7 @@ impl SourceChange {
|
|||||||
/// Creates a new SourceChange with the given label
|
/// Creates a new SourceChange with the given label
|
||||||
/// from the edits.
|
/// from the edits.
|
||||||
pub fn from_edits(
|
pub fn from_edits(
|
||||||
source_file_edits: NoHashHashMap<FileId, TextEdit>,
|
source_file_edits: IntMap<FileId, TextEdit>,
|
||||||
file_system_edits: Vec<FileSystemEdit>,
|
file_system_edits: Vec<FileSystemEdit>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
SourceChange { source_file_edits, file_system_edits, is_snippet: false }
|
SourceChange { source_file_edits, file_system_edits, is_snippet: false }
|
||||||
@ -77,8 +77,8 @@ fn extend<T: IntoIterator<Item = FileSystemEdit>>(&mut self, iter: T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<NoHashHashMap<FileId, TextEdit>> for SourceChange {
|
impl From<IntMap<FileId, TextEdit>> for SourceChange {
|
||||||
fn from(source_file_edits: NoHashHashMap<FileId, TextEdit>) -> SourceChange {
|
fn from(source_file_edits: IntMap<FileId, TextEdit>) -> SourceChange {
|
||||||
SourceChange { source_file_edits, file_system_edits: Vec::new(), is_snippet: false }
|
SourceChange { source_file_edits, file_system_edits: Vec::new(), is_snippet: false }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ doctest = false
|
|||||||
cov-mark = "2.0.0-pre.1"
|
cov-mark = "2.0.0-pre.1"
|
||||||
itertools = "0.10.5"
|
itertools = "0.10.5"
|
||||||
triomphe.workspace = true
|
triomphe.workspace = true
|
||||||
|
nohash-hasher.workspace = true
|
||||||
|
|
||||||
# local deps
|
# local deps
|
||||||
hir.workspace = true
|
hir.workspace = true
|
||||||
|
@ -87,8 +87,8 @@
|
|||||||
use crate::{errors::bail, matching::MatchFailureReason};
|
use crate::{errors::bail, matching::MatchFailureReason};
|
||||||
use hir::Semantics;
|
use hir::Semantics;
|
||||||
use ide_db::base_db::{FileId, FilePosition, FileRange};
|
use ide_db::base_db::{FileId, FilePosition, FileRange};
|
||||||
|
use nohash_hasher::IntMap;
|
||||||
use resolving::ResolvedRule;
|
use resolving::ResolvedRule;
|
||||||
use stdx::hash::NoHashHashMap;
|
|
||||||
use syntax::{ast, AstNode, SyntaxNode, TextRange};
|
use syntax::{ast, AstNode, SyntaxNode, TextRange};
|
||||||
use text_edit::TextEdit;
|
use text_edit::TextEdit;
|
||||||
|
|
||||||
@ -168,9 +168,9 @@ pub fn add_rule(&mut self, rule: SsrRule) -> Result<(), SsrError> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Finds matches for all added rules and returns edits for all found matches.
|
/// Finds matches for all added rules and returns edits for all found matches.
|
||||||
pub fn edits(&self) -> NoHashHashMap<FileId, TextEdit> {
|
pub fn edits(&self) -> IntMap<FileId, TextEdit> {
|
||||||
use ide_db::base_db::SourceDatabaseExt;
|
use ide_db::base_db::SourceDatabaseExt;
|
||||||
let mut matches_by_file = NoHashHashMap::default();
|
let mut matches_by_file = IntMap::default();
|
||||||
for m in self.matches().matches {
|
for m in self.matches().matches {
|
||||||
matches_by_file
|
matches_by_file
|
||||||
.entry(m.range.file_id)
|
.entry(m.range.file_id)
|
||||||
|
@ -24,6 +24,7 @@ url = "2.3.1"
|
|||||||
dot = "0.1.4"
|
dot = "0.1.4"
|
||||||
smallvec.workspace = true
|
smallvec.workspace = true
|
||||||
triomphe.workspace = true
|
triomphe.workspace = true
|
||||||
|
nohash-hasher.workspace = true
|
||||||
|
|
||||||
# local deps
|
# local deps
|
||||||
cfg.workspace = true
|
cfg.workspace = true
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
RootDatabase,
|
RootDatabase,
|
||||||
};
|
};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use stdx::hash::NoHashHashMap;
|
use nohash_hasher::IntMap;
|
||||||
use syntax::{
|
use syntax::{
|
||||||
algo::find_node_at_offset,
|
algo::find_node_at_offset,
|
||||||
ast::{self, HasName},
|
ast::{self, HasName},
|
||||||
@ -31,7 +31,7 @@
|
|||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct ReferenceSearchResult {
|
pub struct ReferenceSearchResult {
|
||||||
pub declaration: Option<Declaration>,
|
pub declaration: Option<Declaration>,
|
||||||
pub references: NoHashHashMap<FileId, Vec<(TextRange, Option<ReferenceCategory>)>>,
|
pub references: IntMap<FileId, Vec<(TextRange, Option<ReferenceCategory>)>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
@ -46,6 +46,7 @@ tracing-subscriber = { version = "0.3.16", default-features = false, features =
|
|||||||
tracing-log = "0.1.3"
|
tracing-log = "0.1.3"
|
||||||
tracing-tree = "0.2.1"
|
tracing-tree = "0.2.1"
|
||||||
triomphe.workspace = true
|
triomphe.workspace = true
|
||||||
|
nohash-hasher.workspace = true
|
||||||
always-assert = "0.1.2"
|
always-assert = "0.1.2"
|
||||||
|
|
||||||
# These dependencies are unused, but we pin them to a version here to restrict them for our transitive dependencies
|
# These dependencies are unused, but we pin them to a version here to restrict them for our transitive dependencies
|
||||||
@ -95,7 +96,4 @@ mbe.workspace = true
|
|||||||
[features]
|
[features]
|
||||||
jemalloc = ["jemallocator", "profile/jemalloc"]
|
jemalloc = ["jemallocator", "profile/jemalloc"]
|
||||||
force-always-assert = ["always-assert/force"]
|
force-always-assert = ["always-assert/force"]
|
||||||
in-rust-tree = [
|
in-rust-tree = ["ide/in-rust-tree", "syntax/in-rust-tree"]
|
||||||
"ide/in-rust-tree",
|
|
||||||
"syntax/in-rust-tree",
|
|
||||||
]
|
|
||||||
|
@ -5,12 +5,12 @@
|
|||||||
|
|
||||||
use ide::FileId;
|
use ide::FileId;
|
||||||
use ide_db::FxHashMap;
|
use ide_db::FxHashMap;
|
||||||
use stdx::hash::{NoHashHashMap, NoHashHashSet};
|
use nohash_hasher::{IntMap, IntSet};
|
||||||
use triomphe::Arc;
|
use triomphe::Arc;
|
||||||
|
|
||||||
use crate::lsp_ext;
|
use crate::lsp_ext;
|
||||||
|
|
||||||
pub(crate) type CheckFixes = Arc<NoHashHashMap<usize, NoHashHashMap<FileId, Vec<Fix>>>>;
|
pub(crate) type CheckFixes = Arc<IntMap<usize, IntMap<FileId, Vec<Fix>>>>;
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone)]
|
#[derive(Debug, Default, Clone)]
|
||||||
pub struct DiagnosticsMapConfig {
|
pub struct DiagnosticsMapConfig {
|
||||||
@ -21,12 +21,12 @@ pub struct DiagnosticsMapConfig {
|
|||||||
|
|
||||||
#[derive(Debug, Default, Clone)]
|
#[derive(Debug, Default, Clone)]
|
||||||
pub(crate) struct DiagnosticCollection {
|
pub(crate) struct DiagnosticCollection {
|
||||||
// FIXME: should be NoHashHashMap<FileId, Vec<ra_id::Diagnostic>>
|
// FIXME: should be IntMap<FileId, Vec<ra_id::Diagnostic>>
|
||||||
pub(crate) native: NoHashHashMap<FileId, Vec<lsp_types::Diagnostic>>,
|
pub(crate) native: IntMap<FileId, Vec<lsp_types::Diagnostic>>,
|
||||||
// FIXME: should be Vec<flycheck::Diagnostic>
|
// FIXME: should be Vec<flycheck::Diagnostic>
|
||||||
pub(crate) check: NoHashHashMap<usize, NoHashHashMap<FileId, Vec<lsp_types::Diagnostic>>>,
|
pub(crate) check: IntMap<usize, IntMap<FileId, Vec<lsp_types::Diagnostic>>>,
|
||||||
pub(crate) check_fixes: CheckFixes,
|
pub(crate) check_fixes: CheckFixes,
|
||||||
changes: NoHashHashSet<FileId>,
|
changes: IntSet<FileId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
@ -106,7 +106,7 @@ pub(crate) fn diagnostics_for(
|
|||||||
native.chain(check)
|
native.chain(check)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn take_changes(&mut self) -> Option<NoHashHashSet<FileId>> {
|
pub(crate) fn take_changes(&mut self) -> Option<IntSet<FileId>> {
|
||||||
if self.changes.is_empty() {
|
if self.changes.is_empty() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
@ -10,11 +10,11 @@
|
|||||||
use ide::{Analysis, AnalysisHost, Cancellable, Change, FileId};
|
use ide::{Analysis, AnalysisHost, Cancellable, Change, FileId};
|
||||||
use ide_db::base_db::{CrateId, FileLoader, ProcMacroPaths, SourceDatabase};
|
use ide_db::base_db::{CrateId, FileLoader, ProcMacroPaths, SourceDatabase};
|
||||||
use lsp_types::{SemanticTokens, Url};
|
use lsp_types::{SemanticTokens, Url};
|
||||||
|
use nohash_hasher::IntMap;
|
||||||
use parking_lot::{Mutex, RwLock};
|
use parking_lot::{Mutex, RwLock};
|
||||||
use proc_macro_api::ProcMacroServer;
|
use proc_macro_api::ProcMacroServer;
|
||||||
use project_model::{CargoWorkspace, ProjectWorkspace, Target, WorkspaceBuildScripts};
|
use project_model::{CargoWorkspace, ProjectWorkspace, Target, WorkspaceBuildScripts};
|
||||||
use rustc_hash::FxHashMap;
|
use rustc_hash::FxHashMap;
|
||||||
use stdx::hash::NoHashHashMap;
|
|
||||||
use triomphe::Arc;
|
use triomphe::Arc;
|
||||||
use vfs::AnchoredPathBuf;
|
use vfs::AnchoredPathBuf;
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ pub(crate) struct GlobalState {
|
|||||||
pub(crate) flycheck_sender: Sender<flycheck::Message>,
|
pub(crate) flycheck_sender: Sender<flycheck::Message>,
|
||||||
pub(crate) flycheck_receiver: Receiver<flycheck::Message>,
|
pub(crate) flycheck_receiver: Receiver<flycheck::Message>,
|
||||||
|
|
||||||
pub(crate) vfs: Arc<RwLock<(vfs::Vfs, NoHashHashMap<FileId, LineEndings>)>>,
|
pub(crate) vfs: Arc<RwLock<(vfs::Vfs, IntMap<FileId, LineEndings>)>>,
|
||||||
pub(crate) vfs_config_version: u32,
|
pub(crate) vfs_config_version: u32,
|
||||||
pub(crate) vfs_progress_config_version: u32,
|
pub(crate) vfs_progress_config_version: u32,
|
||||||
pub(crate) vfs_progress_n_total: usize,
|
pub(crate) vfs_progress_n_total: usize,
|
||||||
@ -117,7 +117,7 @@ pub(crate) struct GlobalStateSnapshot {
|
|||||||
pub(crate) check_fixes: CheckFixes,
|
pub(crate) check_fixes: CheckFixes,
|
||||||
mem_docs: MemDocs,
|
mem_docs: MemDocs,
|
||||||
pub(crate) semantic_tokens_cache: Arc<Mutex<FxHashMap<Url, SemanticTokens>>>,
|
pub(crate) semantic_tokens_cache: Arc<Mutex<FxHashMap<Url, SemanticTokens>>>,
|
||||||
vfs: Arc<RwLock<(vfs::Vfs, NoHashHashMap<FileId, LineEndings>)>>,
|
vfs: Arc<RwLock<(vfs::Vfs, IntMap<FileId, LineEndings>)>>,
|
||||||
pub(crate) workspaces: Arc<Vec<ProjectWorkspace>>,
|
pub(crate) workspaces: Arc<Vec<ProjectWorkspace>>,
|
||||||
// used to signal semantic highlighting to fall back to syntax based highlighting until proc-macros have been loaded
|
// used to signal semantic highlighting to fall back to syntax based highlighting until proc-macros have been loaded
|
||||||
pub(crate) proc_macros_loaded: bool,
|
pub(crate) proc_macros_loaded: bool,
|
||||||
@ -170,7 +170,7 @@ pub(crate) fn new(sender: Sender<lsp_server::Message>, config: Config) -> Global
|
|||||||
flycheck_sender,
|
flycheck_sender,
|
||||||
flycheck_receiver,
|
flycheck_receiver,
|
||||||
|
|
||||||
vfs: Arc::new(RwLock::new((vfs::Vfs::default(), NoHashHashMap::default()))),
|
vfs: Arc::new(RwLock::new((vfs::Vfs::default(), IntMap::default()))),
|
||||||
vfs_config_version: 0,
|
vfs_config_version: 0,
|
||||||
vfs_progress_config_version: 0,
|
vfs_progress_config_version: 0,
|
||||||
vfs_progress_n_total: 0,
|
vfs_progress_n_total: 0,
|
||||||
|
@ -15,7 +15,6 @@ doctest = false
|
|||||||
libc = "0.2.135"
|
libc = "0.2.135"
|
||||||
backtrace = { version = "0.3.65", optional = true }
|
backtrace = { version = "0.3.65", optional = true }
|
||||||
always-assert = { version = "0.1.2", features = ["log"] }
|
always-assert = { version = "0.1.2", features = ["log"] }
|
||||||
nohash-hasher.workspace = true
|
|
||||||
# Think twice before adding anything here
|
# Think twice before adding anything here
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
//! Re-exports from [`nohash_hasher`].
|
|
||||||
|
|
||||||
pub use nohash_hasher::IntMap as NoHashHashMap;
|
|
||||||
pub use nohash_hasher::IntSet as NoHashHashSet;
|
|
||||||
pub use nohash_hasher::IsEnabled;
|
|
@ -7,7 +7,6 @@
|
|||||||
use std::{cmp::Ordering, ops, time::Instant};
|
use std::{cmp::Ordering, ops, time::Instant};
|
||||||
|
|
||||||
mod macros;
|
mod macros;
|
||||||
pub mod hash;
|
|
||||||
pub mod process;
|
pub mod process;
|
||||||
pub mod panic_context;
|
pub mod panic_context;
|
||||||
pub mod non_empty_vec;
|
pub mod non_empty_vec;
|
||||||
|
@ -15,6 +15,7 @@ doctest = false
|
|||||||
rustc-hash = "1.1.0"
|
rustc-hash = "1.1.0"
|
||||||
fst = "0.4.7"
|
fst = "0.4.7"
|
||||||
indexmap = "1.9.1"
|
indexmap = "1.9.1"
|
||||||
|
nohash-hasher.workspace = true
|
||||||
|
|
||||||
paths.workspace = true
|
paths.workspace = true
|
||||||
stdx.workspace = true
|
stdx.workspace = true
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
use fst::{IntoStreamer, Streamer};
|
use fst::{IntoStreamer, Streamer};
|
||||||
|
use nohash_hasher::IntMap;
|
||||||
use rustc_hash::FxHashMap;
|
use rustc_hash::FxHashMap;
|
||||||
use stdx::hash::NoHashHashMap;
|
|
||||||
|
|
||||||
use crate::{AnchoredPath, FileId, Vfs, VfsPath};
|
use crate::{AnchoredPath, FileId, Vfs, VfsPath};
|
||||||
|
|
||||||
@ -14,7 +14,7 @@
|
|||||||
#[derive(Default, Clone, Eq, PartialEq)]
|
#[derive(Default, Clone, Eq, PartialEq)]
|
||||||
pub struct FileSet {
|
pub struct FileSet {
|
||||||
files: FxHashMap<VfsPath, FileId>,
|
files: FxHashMap<VfsPath, FileId>,
|
||||||
paths: NoHashHashMap<FileId, VfsPath>,
|
paths: IntMap<FileId, VfsPath>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FileSet {
|
impl FileSet {
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
pub struct FileId(pub u32);
|
pub struct FileId(pub u32);
|
||||||
|
|
||||||
/// safe because `FileId` is a newtype of `u32`
|
/// safe because `FileId` is a newtype of `u32`
|
||||||
impl stdx::hash::IsEnabled for FileId {}
|
impl nohash_hasher::IsEnabled for FileId {}
|
||||||
|
|
||||||
/// Storage for all files read by rust-analyzer.
|
/// Storage for all files read by rust-analyzer.
|
||||||
///
|
///
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
use nohash_hasher::IntMap as NoHashHashMap;
|
use nohash_hasher::IntMap;
|
||||||
|
|
||||||
pub use text_size::{TextRange, TextSize};
|
pub use text_size::{TextRange, TextSize};
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ pub struct LineIndex {
|
|||||||
/// Offset the beginning of each line, zero-based.
|
/// Offset the beginning of each line, zero-based.
|
||||||
newlines: Vec<TextSize>,
|
newlines: Vec<TextSize>,
|
||||||
/// List of non-ASCII characters on each line.
|
/// List of non-ASCII characters on each line.
|
||||||
line_wide_chars: NoHashHashMap<u32, Vec<WideChar>>,
|
line_wide_chars: IntMap<u32, Vec<WideChar>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Line/Column information in native, utf8 format.
|
/// Line/Column information in native, utf8 format.
|
||||||
@ -80,7 +80,7 @@ fn wide_len(&self, enc: WideEncoding) -> usize {
|
|||||||
impl LineIndex {
|
impl LineIndex {
|
||||||
/// Returns a `LineIndex` for the `text`.
|
/// Returns a `LineIndex` for the `text`.
|
||||||
pub fn new(text: &str) -> LineIndex {
|
pub fn new(text: &str) -> LineIndex {
|
||||||
let mut line_wide_chars = NoHashHashMap::default();
|
let mut line_wide_chars = IntMap::default();
|
||||||
let mut wide_chars = Vec::new();
|
let mut wide_chars = Vec::new();
|
||||||
|
|
||||||
let mut newlines = Vec::with_capacity(16);
|
let mut newlines = Vec::with_capacity(16);
|
||||||
|
Loading…
Reference in New Issue
Block a user