Import files from folders above: import ..a.b, import ...a.b
Leading dots go up one folder less than their count (.. is one up, ... is two). The language server index and formatter understand them, and a missing file is reported with its real path. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9b496a7b03
commit
910bde692a
11 files changed
+139
-8
No files matched your search
@@ -409,6 +409,10 @@ fn gap(prev: &Piece, cur: &Piece, before_prev: Option<&Piece>, prev_is_prefix: b
|
||||
if prev_is_prefix {
|
||||
return false;
|
||||
}
|
||||
// `import ..a`, `import ...a`: the dots start the path
|
||||
if prev.kind == Kind::Word && pt == "import" && (ct == "." || ct == "..") {
|
||||
return true;
|
||||
}
|
||||
if prev.kind == Kind::Punct {
|
||||
match pt {
|
||||
"(" | "[" | "." | ".." => return false,
|
||||
|
||||
Reference in new issue
Block a user