Use the build folder as an underlay of the index build folder
The current design for indexing makes the index build completely independent of the “real” build. We need do decide whether we want to continue using the build folder as an underlay for the index build folder. This could solve problems where the index build fails to build one of the modules / whatever. Tricky questions are:
- The user might specify additional build parameters like -Xswiftc or environment variables that modify the evaluation of Package.swift on the command line, which means that the build folder uses a different configuration than the index build folder
- The user might not even build into .build (by specifying --scratch-dir) which means that we don’t even know where the build folder is, in general.
rdar://127476264
If the user adds build arguments in VSCode I pass these onto SourceKit-LSP already.
I'd have to double check scratch folder though. Is it possible to pass this onto SKLSP
Even if the index build remains independent, it would be useful if the default location was inside .build, as it would generally be picked up by existing .gitignore rules.
Eg default to something like .build/index/ instead of .index-build.
I've turned this setting on for the vscode extension in various projects and then wondered why git is telling me I have 2000+ changes all of a sudden...