Apple - Reinstalling XCode
The App Store actually recognizes the Install Xcode.app file in the Applications folder. So, in order to reinstall, just run Install Xcode again from the Applications folder. But, if you wish to redownload from the App Store, just delete the application from the Applications folder, empty your trash, and relaunch the App Store if it's open.
try this in terminal:
xcode-select --install
it brings up and downloads developer tools for you
This does not answer the question above, but I thought I would keep it here in case somebody who've got here by a search, would find it helpful. This advice deals with command line tools problems and not the XCode application.
To reinstall xcode command line tools
on macOS, simply run the following commands in your terminal:
sudo rm -rf $(xcode-select -print-path)
xcode-select --install
Unfortunately, it happens quite often when other command line tools are unable to find xcode or CLT, reinstalling it as shown above, helps.