Commit Graph

8 Commits

Author SHA1 Message Date
David Goldman
bcfadd4c58 Fix code completion in header files (#426)
Previously, header files would have their compiler flags inferred
from source files which include them. However, code completion
didn't work properly since the file path in the arguments was
incorrect, pointing to the source file instead of the header file.

This also includes support for source files which include other source files, although that's not a common use case.
2021-09-09 12:36:44 -04:00
David Goldman
cf19900d84 Swap BuildSystem to remove build settings method (#183)
Remove `settings(for:)` from the BuildSystem API in favor of the change callback

- With the `settings(for:)` method removed, we instead block on a
  callback from the `BuildSystemManager` which itself handles
  the primary build system callback in conjunction with the fallback
  system

- We queue up notifications / requests that reference documents
  until we receive the callback.

- Remove language from FileBuildSettings as it is no longer needed,
  Swift-specific working dir fixes are now in SwiftCompileCommand

- registerForChangeNotifications should inform its delegate
  asynchronously instead of immediately
2020-06-01 13:20:15 -04:00
Kanglei Fang
3a9f27b7eb Move logic to FileBuildSettings 2020-04-06 17:14:01 -07:00
Ben Langmuir
cffced1844 Thread Language through FileBuildSettings NFC
Will make it easier to work with cached settings.
2020-02-05 21:53:52 -08:00
David Goldman
e5caf44fda Add a BuildSystemDelegate which supports notifications for build settings changes
Introduce a `BuildSystemDelegate` to handle notifications from the build system

* `SourceKitServer` is the main delegate to process these notifications
* Currently limited to changes in `FileBuildSettings`
* Delegate informs the `BuildSystem` of files to watch via `registerChangeWatching(for: URL)` and `unregisterChangeWatching(for: URL)`
* In the future we could have more integration for handling changes in dependencies

Handling changes in `FileBuildSettings`

* `SourceKitServer` sends notifications to the internal LSPs informing them of any opened documents that have changes in their compiler flags
    * For clangd, we send a notification to update the compilation database
    * For SourceKit/sourcekitd we must close and reopen the file to force a new AST with the new compiler flags
2019-09-06 17:44:36 -04:00
Richard Howell
f6045fcfdc remove toolchain from FileBuildSettings 2019-08-15 10:53:14 -07:00
David Goldman
6c93c92f4d Allow multiple Xcode toolchains in the registry
1) Toolchain ID is no longer unique; XcodeDefault toolchains may be
   registered multiple times as long as their path is different
   (e.g. different Xcode versions). At the moment no other toolchain
   may be duplicated.
2) `BuildSystem` specifies a `Toolchain` directly instead of a
   Toolchain identifier.
3) New methods to access Toolchains in the registry:
   - All toolchain(s) with the given identifier
   - Toolchain (if any) for the given path
2019-01-22 14:12:50 -05:00
Ben Langmuir
64ba25db5a [build-system] Move FileBuildSettings to its own file NFC 2018-12-03 22:08:56 -08:00