mirror of
https://github.com/oxalica/nil.git
synced 2024-11-22 02:55:39 +03:00
Enforce merging of "use" stmts
This commit is contained in:
parent
bc9dc1546f
commit
675c3ab022
@ -2,7 +2,9 @@ use indexmap::IndexMap;
|
|||||||
use lsp_types::Url;
|
use lsp_types::Url;
|
||||||
use nil::{Change, FileId, FilePos};
|
use nil::{Change, FileId, FilePos};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::{fmt, mem, path::PathBuf, sync::Arc};
|
use std::path::PathBuf;
|
||||||
|
use std::sync::Arc;
|
||||||
|
use std::{fmt, mem};
|
||||||
use text_size::TextSize;
|
use text_size::TextSize;
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
|
1
rustfmt.toml
Normal file
1
rustfmt.toml
Normal file
@ -0,0 +1 @@
|
|||||||
|
imports_granularity = "Module"
|
@ -1,6 +1,7 @@
|
|||||||
use rowan::{TextRange, TextSize};
|
use rowan::{TextRange, TextSize};
|
||||||
use salsa::Durability;
|
use salsa::Durability;
|
||||||
use std::{fmt, sync::Arc};
|
use std::fmt;
|
||||||
|
use std::sync::Arc;
|
||||||
use syntax::Parse;
|
use syntax::Parse;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
|
@ -9,10 +9,8 @@ use rowan::ast::AstNode;
|
|||||||
use rowan::TextRange;
|
use rowan::TextRange;
|
||||||
use smol_str::SmolStr;
|
use smol_str::SmolStr;
|
||||||
use std::str;
|
use std::str;
|
||||||
use syntax::{
|
use syntax::ast::{self, HasBindings, HasStringParts, LiteralKind};
|
||||||
ast::{self, HasBindings, HasStringParts, LiteralKind},
|
use syntax::Parse;
|
||||||
Parse,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub(super) fn lower(parse: InFile<Parse>) -> (Module, ModuleSourceMap) {
|
pub(super) fn lower(parse: InFile<Parse>) -> (Module, ModuleSourceMap) {
|
||||||
let diagnostics = parse
|
let diagnostics = parse
|
||||||
|
@ -4,14 +4,14 @@ mod scope;
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
use crate::{
|
use crate::base::SourceDatabase;
|
||||||
base::SourceDatabase,
|
use crate::{Diagnostic, FileId};
|
||||||
{Diagnostic, FileId},
|
|
||||||
};
|
|
||||||
use la_arena::{Arena, ArenaMap, Idx};
|
use la_arena::{Arena, ArenaMap, Idx};
|
||||||
use ordered_float::OrderedFloat;
|
use ordered_float::OrderedFloat;
|
||||||
use smol_str::SmolStr;
|
use smol_str::SmolStr;
|
||||||
use std::{collections::HashMap, ops, sync::Arc};
|
use std::collections::HashMap;
|
||||||
|
use std::ops;
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub use self::scope::{ModuleScopes, ResolveResult, ScopeData, ScopeId};
|
pub use self::scope::{ModuleScopes, ResolveResult, ScopeData, ScopeId};
|
||||||
pub use syntax::ast::{BinaryOpKind as BinaryOp, UnaryOpKind as UnaryOp};
|
pub use syntax::ast::{BinaryOpKind as BinaryOp, UnaryOpKind as UnaryOp};
|
||||||
|
@ -2,7 +2,9 @@ use super::{BindingKey, BindingValue, Bindings, DefDatabase, Expr, ExprId, Modul
|
|||||||
use crate::{builtin, FileId};
|
use crate::{builtin, FileId};
|
||||||
use la_arena::{Arena, ArenaMap, Idx};
|
use la_arena::{Arena, ArenaMap, Idx};
|
||||||
use smol_str::SmolStr;
|
use smol_str::SmolStr;
|
||||||
use std::{collections::HashMap, iter, ops, sync::Arc};
|
use std::collections::HashMap;
|
||||||
|
use std::sync::Arc;
|
||||||
|
use std::{iter, ops};
|
||||||
|
|
||||||
#[derive(Default, Debug, Clone, PartialEq, Eq)]
|
#[derive(Default, Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct ModuleScopes {
|
pub struct ModuleScopes {
|
||||||
@ -208,10 +210,8 @@ impl ScopeData {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::ScopeKind;
|
use super::ScopeKind;
|
||||||
use crate::{
|
use crate::def::{AstPtr, DefDatabase, ResolveResult, SourceDatabase};
|
||||||
def::{AstPtr, DefDatabase, ResolveResult, SourceDatabase},
|
use crate::tests::TestDB;
|
||||||
tests::TestDB,
|
|
||||||
};
|
|
||||||
use expect_test::{expect, Expect};
|
use expect_test::{expect, Expect};
|
||||||
use rowan::ast::AstNode;
|
use rowan::ast::AstNode;
|
||||||
use syntax::{ast, match_ast};
|
use syntax::{ast, match_ast};
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
use crate::{
|
use crate::def::{AstPtr, DefDatabase};
|
||||||
builtin,
|
use crate::{builtin, FileId};
|
||||||
def::{AstPtr, DefDatabase},
|
|
||||||
FileId,
|
|
||||||
};
|
|
||||||
use rowan::ast::AstNode;
|
use rowan::ast::AstNode;
|
||||||
use smol_str::SmolStr;
|
use smol_str::SmolStr;
|
||||||
use syntax::{ast, match_ast, SyntaxKind, TextRange, TextSize, T};
|
use syntax::{ast, match_ast, SyntaxKind, TextRange, TextSize, T};
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
use super::NavigationTarget;
|
use super::NavigationTarget;
|
||||||
use crate::{
|
use crate::def::{AstPtr, DefDatabase, ResolveResult};
|
||||||
def::{AstPtr, DefDatabase, ResolveResult},
|
use crate::FileId;
|
||||||
FileId,
|
use rowan::ast::AstNode;
|
||||||
};
|
use rowan::TextSize;
|
||||||
use rowan::{ast::AstNode, TextSize};
|
|
||||||
use syntax::{ast, match_ast, SyntaxKind, T};
|
use syntax::{ast, match_ast, SyntaxKind, T};
|
||||||
|
|
||||||
pub(crate) fn goto_definition(
|
pub(crate) fn goto_definition(
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
mod completion;
|
mod completion;
|
||||||
mod goto_definition;
|
mod goto_definition;
|
||||||
|
|
||||||
use crate::{base::SourceDatabaseStorage, def::DefDatabaseStorage, Change, FileId, FilePos};
|
use crate::base::SourceDatabaseStorage;
|
||||||
|
use crate::def::DefDatabaseStorage;
|
||||||
|
use crate::{Change, FileId, FilePos};
|
||||||
use rowan::TextRange;
|
use rowan::TextRange;
|
||||||
use salsa::{Cancelled, Database, Durability, ParallelDatabase};
|
use salsa::{Cancelled, Database, Durability, ParallelDatabase};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
use crate::base::{SourceDatabase, SourceDatabaseStorage};
|
use crate::base::{SourceDatabase, SourceDatabaseStorage};
|
||||||
use crate::def::DefDatabaseStorage;
|
use crate::def::DefDatabaseStorage;
|
||||||
use crate::{Change, FileId};
|
use crate::{Change, FileId};
|
||||||
use rowan::{ast::AstNode, TextSize};
|
use rowan::ast::AstNode;
|
||||||
|
use rowan::TextSize;
|
||||||
use std::ops;
|
use std::ops;
|
||||||
use syntax::{NixLanguage, SyntaxNode};
|
use syntax::{NixLanguage, SyntaxNode};
|
||||||
|
|
||||||
|
@ -1,13 +1,7 @@
|
|||||||
use super::{
|
use crate::SyntaxKind::{self, *};
|
||||||
NixLanguage,
|
use crate::{NixLanguage, SyntaxElementChildren, SyntaxNode, SyntaxToken};
|
||||||
SyntaxKind::{self, *},
|
use rowan::ast::support::{child, children, token};
|
||||||
SyntaxNode, SyntaxToken,
|
use rowan::ast::{AstChildren, AstNode};
|
||||||
};
|
|
||||||
use crate::SyntaxElementChildren;
|
|
||||||
use rowan::ast::{
|
|
||||||
support::{child, children, token},
|
|
||||||
AstChildren, AstNode,
|
|
||||||
};
|
|
||||||
use rowan::NodeOrToken;
|
use rowan::NodeOrToken;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
use crate::SyntaxKind::{self, *};
|
use crate::SyntaxKind::{self, *};
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use regex_automata::{
|
use regex_automata::dfa::{dense, Automaton};
|
||||||
dfa::{dense, Automaton},
|
use regex_automata::nfa::thompson;
|
||||||
nfa::thompson,
|
use regex_automata::SyntaxConfig;
|
||||||
SyntaxConfig,
|
|
||||||
};
|
|
||||||
use rowan::{TextRange, TextSize};
|
use rowan::{TextRange, TextSize};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
|
@ -10,8 +10,7 @@ mod tests;
|
|||||||
|
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
|
|
||||||
pub use rowan;
|
pub use rowan::{self, TextRange, TextSize};
|
||||||
pub use rowan::{TextRange, TextSize};
|
|
||||||
|
|
||||||
pub use self::kind::SyntaxKind;
|
pub use self::kind::SyntaxKind;
|
||||||
pub use self::parser::{parse_file, Parse};
|
pub use self::parser::{parse_file, Parse};
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
use crate::{
|
use crate::ast::SourceFile;
|
||||||
ast::SourceFile,
|
use crate::SyntaxKind::{self, *};
|
||||||
lexer, Error,
|
use crate::{lexer, Error, SyntaxNode};
|
||||||
SyntaxKind::{self, *},
|
use rowan::ast::AstNode;
|
||||||
SyntaxNode,
|
use rowan::{Checkpoint, GreenNode, GreenNodeBuilder, TextSize};
|
||||||
};
|
|
||||||
use rowan::{ast::AstNode, Checkpoint, GreenNode, GreenNodeBuilder, TextSize};
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub struct Parse {
|
pub struct Parse {
|
||||||
|
Loading…
Reference in New Issue
Block a user