Skip to content

Commit

Permalink
compiler: Use --assume-main-file-path as relative path for imports
Browse files Browse the repository at this point in the history
This PR fixes an issue with IDE integration where the compiler would use
the relative path of the temporary file for imports, rather than the
main file path specified.
  • Loading branch information
alec3660 authored and alimpfard committed Jan 1, 2025
1 parent f8e7568 commit 2f484d9
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions selfhost/compiler.jakt
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,7 @@ class Compiler {
}

public fn find_in_search_paths(this, anon path: Path, relative_import: bool = false, parent_path_count: usize = 0) throws -> Path? {
let current_file_path = match relative_import {
true => .current_file_path()
false => .assume_main_file_path ?? .current_file_path()
}
let current_file_path = .assume_main_file_path ?? .current_file_path()
if current_file_path.has_value() {
mut candidate_path = current_file_path!.absolute().parent()
if relative_import and parent_path_count > 0 {
Expand Down

0 comments on commit 2f484d9

Please sign in to comment.