Commit Graph

23 Commits

Author SHA1 Message Date
Saleem Abdulrasool
7d1bcee1b0 explicitly import TSCBasic types
Explicitly import interfaces from TSCBasic which now allows us to
identify all the swift-tools-support-core interfaces which are in
use in SourceKit-LSP.
2022-09-10 12:53:30 -07:00
David Goldman
472a06c88a Support index store path remappings (#562)
This allows sourcekit-lsp to make use of the path remappings recently added to
the index store and IndexStoreDB to remap remote paths into local paths
when loading index data locally.

These remappings can be provided via the `-index-prefix-map` command line flag to sourcekit-lsp or via the `BuildSystem` integration point.
2022-06-09 10:45:52 -04:00
Alex Hoppen
d02d3914c5 Query build system of workspaces to determine best workspace to open a file in
This sets the stage for multi-workspace support. Everything should be handled internally, we are just missing the API to actually open multiple workspaces at this point.
2022-05-04 14:48:31 +02:00
Ben Langmuir
3927e639be Revert "Support opening multiple workspaces in a single sourcekit-lsp instance" 2022-05-03 13:47:19 -07:00
Alex Hoppen
f91564a75f Query build system of workspaces to determine best workspace to open a file in
This sets the stage for multi-workspace support. Everything should be handled internally, we are just missing the API to actually open multiple workspaces at this point.
2022-05-02 09:31:07 +02:00
Alex Hoppen
9a5b1e81ef Reload Swift Package when new file creation is indicated by DidChangeWatchedFileNotification
Implement rudementary support for `DidChangeWatchedFileNotification` for SwiftPM projects: When a file is added, reload the Swift package to compute build settings for it.

This enables proper semantic functionality added to the project after the LSP server was started.

Resolves SR-15633
2022-01-19 11:20:10 +01: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
Ben Langmuir
a679d4553d [buildsystem] Standardize call between register and settings query NFC
In preparation for injecting doing more during registration, pass
through the same parameters (add language) so that we can call settings
as necessary.
2020-02-05 21:53:52 -08:00
Ben Langmuir
47d92d89f9 Remove unused toolchain lookup function NFC
We want to be able to lookup the toolchain by file eventually, but it's
currently dead code.
2020-02-05 21:53:52 -08:00
Ben Langmuir
8a88e9d5f2 [gardening] Changes per review
* Rename Extensions.swift
* Move import where it is used
2019-11-20 09:41:48 -08:00
Alex Hoppen
5c839f8640 Add support for non-URL URIs
According to the LSP specification, arbitrary URIs can be used as
document identifiers. Instead of internally assuming that all URIs are
URLs, use a DocumentURI enum to represent URIs. These can either be file
URLs or other URIs whose value as treated as an opaque string.
2019-11-20 09:41:48 -08:00
Richard Howell
26d3fca5dd use LSPResult instead of optionals 2019-10-04 15:14:04 -07:00
Richard Howell
0f6f260701 add interface for fetching output paths 2019-10-04 14:51:26 -07:00
Richard Howell
315070d6f7 add inteface to fetch build target sources 2019-10-04 14:50:46 -07:00
Richard Howell
e3fce37388 use LSPResult instead of optional 2019-10-01 14:33:06 -07:00
Richard Howell
81c50db7e1 add the workspace/buildTargets request 2019-09-25 14:16:30 -07: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
Ben Langmuir
e1fa70d086 Update SPM -> TSC module name prefixes 2019-09-03 08:29:19 -07:00
Richard Howell
1f57193cf4 add toolchain interface to BuildServer 2019-08-15 11:04:54 -07:00
Ben Langmuir
7f74d4a25f [build-system] Fold ExternalWorkspace into BuildSystem
Simplifies clients to only need to care about one thing, and makes it
easier for BuildSystems to grow new functionality.
2018-12-03 22:54:35 -08:00
Ben Langmuir
63b9b3dbaf [build-system] Rename BuildSettingsProvider->BuildSystem and fix method name
I intend to fold more things than file-settings into here, so use a more
generic name. Also drop an unnecessary word from the method name.
2018-12-03 22:30:18 -08:00
Ben Langmuir
64ba25db5a [build-system] Move FileBuildSettings to its own file NFC 2018-12-03 22:08:56 -08:00
Ben Langmuir
aabf57a252 Import SourceKit-LSP sources 2018-11-13 15:50:48 -08:00