mirror of
https://github.com/apple/sourcekit-lsp.git
synced 2026-03-02 18:23:24 +01:00
Address review comments to #1302
This commit is contained in:
@@ -26,8 +26,8 @@ This is the easy case since only the file itself is affected.
|
||||
|
||||
## Compiler settings (`compile_commands.json` / `Package.swift`)
|
||||
|
||||
Ideally, we would considered like a file change for all files whose compile commands have changed, if they changed in a meaningful way (ie. in a way that would also trigger re-compilation in an incremental build). Non-meaningful changes would be:
|
||||
- If compiler arguments, like include paths are shuffled around. We could have a really quick check for compiler arguments equality by comparing them unordered. Any really compiler argument change will most likely do more than rearranging the arguments.
|
||||
Ideally, we would like to consider a file as changed when its compile commands have changed, if they changed in a meaningful way (ie. in a way that would also trigger re-compilation in an incremental build). Non-meaningful changes would be:
|
||||
- If compiler arguments that aren't order dependent are shuffled around. We could have a really quick check for compiler arguments equality by comparing them unordered. Any real compiler argument change will most likely do more than rearranging the arguments.
|
||||
- The addition of a new Swift file to a target is equivalent to that file being modified and shouldn’t trigger a re-index of the entire target.
|
||||
|
||||
At the moment, unit files don’t include information about the compiler arguments with which they were created, so it’s impossible to know whether the compiler arguments have changed when a project is opened. Thus, for now, we don’t re-index any files on compiler settings changing.
|
||||
|
||||
@@ -118,7 +118,7 @@ public final class CheckedIndex {
|
||||
|
||||
/// Returns all the files that (transitively) include the header file at the given path.
|
||||
///
|
||||
/// If `crossLanguage` is set to `true`, Swift files that import a header will through a module will also be reported.
|
||||
/// If `crossLanguage` is set to `true`, Swift files that import a header through a module will also be reported.
|
||||
public func mainFilesContainingFile(uri: DocumentURI, crossLanguage: Bool = false) -> [DocumentURI] {
|
||||
return index.mainFilesContainingFile(path: uri.pseudoPath, crossLanguage: crossLanguage).compactMap {
|
||||
let url = URL(fileURLWithPath: $0)
|
||||
|
||||
Reference in New Issue
Block a user