Commit Graph

2340 Commits

Author SHA1 Message Date
Hamish Knight
73c6dcb551 [cmake] Fix LLDB for ASTGen
Add the swiftmodule paths for ASTGen via
`-add_ast_path` to the public linker flags such
that downstream linking picks them up, allowing
LLDB to load them when debugging. Also switch
SwiftCompilerModules to using public linker
flags instead of adding the linker flags in
`_add_swift_runtime_link_flags`.
2023-12-05 12:43:25 +00:00
Alex Hoppen
a710111001 [SourceKit] Support building sourcekitd without building swift-syntax
This allows building sourcekitd and swift-refactor with `SWIFT_BUILD_SWIFT_SYNTAX=NO`. In these builds, the `relatedidents` and `find-syntactic-rename-ranges` requests will always return an error.
2023-12-04 19:14:01 -08:00
Alex Hoppen
9cb2a248c6 [CodeCompletion] Add keyword completion for 'some', 'any', 'repeat', and 'each'
The implementation is not 100% perfect but I don’t think it’s worth putting too much effort into it passing more information down in the parser if 'repeat' and 'each' are valid if we are going to remove the current parser anyway.

rdar://95725895
2023-12-04 15:20:05 -08:00
Alex Hoppen
f408619ddc Address Hamish’s review comments 2023-11-27 14:17:04 -08:00
Alex Hoppen
1047328b63 [SourceKit] Lowercase members of ResolvedLoc
This type will get exposed to Swift and the members should be lowercase so that they read nicely in Swift.
2023-11-16 16:05:08 -08:00
Alex Hoppen
899368037c [SourceKit] Return results from rename using return values instead of consumers
This makes it a lot easier to follow the code.
2023-11-16 16:05:08 -08:00
Alex Hoppen
d9eef8c229 [SourceKit] Remove IsNonProtocolType parameter from rename locations
The parameter was never checked anywhere.
2023-11-16 16:05:07 -08:00
Alex Hoppen
d095d0a186 [SourceKit] Remove newName from RenameLoc
We should (and do) have one new name for the entire rename operation, not a separate new name for different positions at which the renamed symbol occurs.
2023-11-16 16:05:07 -08:00
Alex Hoppen
bc3c8fc47a [SourceKit] In related identifiers, directly construct an array of ranges instead of putting them in an array first
After implementing related identifiers in terms of rename, this step seems to no longer be necessary.
2023-11-16 16:05:07 -08:00
Alex Hoppen
ada3076628 [SourceKit] Share implemention of local rename and related idents
Local rename and related identifiers were sufficiently similar that we can implement related identifiers in terms of local rename.
2023-11-16 16:05:07 -08:00
Alex Hoppen
9ccb2ef65c Merge pull request #69784 from ahoppen/ahoppen/remove-syntacticrename
Remove the `source.request.syntacticrename` request
2023-11-14 14:14:07 -08:00
Doug Gregor
89bda715ce Merge pull request #69840 from DougGregor/macro-role-metaprogramming
[Macros] Macro-metaprogram macro roles
2023-11-14 11:51:50 -08:00
Doug Gregor
ffa5ba7ce3 More macro metaprogramming for macro roles 2023-11-14 09:20:15 -08:00
Doug Gregor
b53026d8d4 [Macros] Macro-metaprogram macro roles
Introduce X-macros for the various macro roles, and use them to
macro-metaprogram a lot of boilerplate involved with introducing new
macro roles.
2023-11-13 22:37:54 -08:00
Alex Hoppen
b598baf7f8 Merge pull request #69783 from ahoppen/ahoppen/rename-cleanup-1
Remove two pImpl abstraction layers in rename
2023-11-13 14:58:05 -08:00
Alex Hoppen
4c1d875cf8 Remove the syntacticrename request
`source.request.find-syntactic-rename-ranges` should be used instead.
2023-11-10 11:46:47 -08:00
Alex Hoppen
e6deb0b84b [SourceKit] Remove pImpl abstraction pattern for RequestRenameRangeConsumer 2023-11-10 11:41:01 -08:00
Alex Hoppen
d5edf34d7f Merge pull request #69573 from tristanlabelle/lsp-no-memmap
Avoid memory mapping source files opened by SourceKit
2023-11-02 08:37:20 -07:00
Tristan Labelle
fb8c4182d3 Avoid memory mapping source files opened by SourceKit. 2023-11-01 11:33:33 -04:00
Alex Hoppen
fdc8e7d387 Merge pull request #69294 from ahoppen/ahoppen/semantic-tokens
[SourceKit] Add a request to get the semantic tokens of a file
2023-10-24 08:07:41 -07:00
Alex Hoppen
2507e0e9ee [SourceKit] Support getting semantic tokens for macro expansion buffers 2023-10-23 11:06:49 -07:00
Alex Hoppen
4bc03f8392 [SourceKit] Add a request to get the semantic tokens of a file
We need this request for semantic highlighting in LSP. Previously, we were getting the semantic tokens using a 0,0 edit after a document update notification but that will no longer be possible if we open the documents in syntactic only mode.
2023-10-20 10:38:08 -07:00
Simon Barinka
baec9f5855 [SourceKit] Fix formatting 2023-10-20 12:59:54 +02:00
Simon Barinka
23cde9b2e0 [SourceKit] Move the option to IndexToStore request 2023-10-20 12:55:41 +02:00
Simon Barinka
3bcfc3b5a7 [SourceKit] Update docs 2023-10-09 21:25:54 +02:00
Simon Barinka
ae570850e0 [SourceKit] Fix formatting 2023-10-09 21:16:13 +02:00
Simon Barinka
b13a7f5829 [SourceKit] Add option to index local symbols to IndexSource request
Adds optional `key.should_index_locals` flag to the SourceKit `source.request.indexsource` request.
If true, the response includes symbol info for both locals and globals.
2023-10-09 20:59:43 +02:00
swift-ci
c746bf7e51 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-08 10:54:42 -07:00
Saleem Abdulrasool
a2cc0d0468 Merge pull request #68780 from hjyamauchi/sourcekitclangdep
Fix the clang dependency of sourcekit libraries.
2023-10-08 10:41:57 -07:00
swift-ci
292463868e Merge remote-tracking branch 'origin/main' into rebranch 2023-10-02 17:14:15 -07:00
Rintaro Ishizaki
d2eaa84088 Merge pull request #68807 from rintaro/sourcekit-framework-rpath-rdar115976985
[SourceKit] Fix RPATH to lib/swift/host in SourceKit frameworks
2023-10-02 16:57:18 -07:00
Ben Barham
119d08c6d1 Merge remote-tracking branch 'origin/main' into 20230929-merge-rebranch
Conflicts:
  - `CMakeLists.txt` caused by the extra `-D` added in rebranch to
    reduce the number of deprecation warnings.
  - `lib/Frontend/PrintingDiagnosticConsumer.cpp` caused by the removal
    of one of the `#if SWIFT_SWIFT_PARSER` on rebranch (probably should
    have been done on main).
2023-09-29 09:50:50 -07:00
Hiroshi Yamauchi
71d8118af9 Fix the clang dependency of sourcekit libraries.
Because swift_swap_compiler_if_needed updates the compiler ID to
Clang, we need to account for it when deciding to add a dependency on
clang. Otherwise, the sourcekit build could fail due to the clang
executable not having been built there yet.
2023-09-27 14:15:12 -07:00
Rintaro Ishizaki
88ec86f36f [SourceKit] Fix RPATH to lib/swift/host in SourceKit frameworks
Relative path calculation to lib/swift/host was not correct.

rdar://115976985
2023-09-27 13:29:48 -07:00
Ben Barham
041691184c [CMake] Replace early swift-syntax with FetchContent
Use FetchContent to include swift-syntax directly in swift. This can be
thought of as an `add_subdirectory` for a directory outside the root.

The default build directory will be `_deps/swiftsyntax-subbuild/`, though
the modules and shared libraries will be built in `lib/swift/host` by
passing down `SWIFT_HOST_LIBRARIES_DEST_DIR` to avoid copying them as we
were doing previously.
2023-09-18 14:44:10 -07:00
swift-ci
17a5d30d54 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-15 16:14:15 -07:00
Hamish Knight
746128c7aa Use StringMap in EditorDiagConsumer
As noted by the comment, storing a `StringRef` is
indeed brittle. Update to use a StringMap.

rdar://111589090
2023-09-15 18:27:49 +01:00
swift-ci
d1abca98df Merge remote-tracking branch 'origin/main' into rebranch 2023-09-07 08:14:37 -07:00
Saleem Abdulrasool
b6764c3f01 Merge pull request #68258 from compnerd/how-do-you-do
build: adjust the build to support non-Apple environments
2023-09-07 08:11:37 -07:00
swift-ci
0407c3d3b2 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-06 13:34:53 -07:00
Saleem Abdulrasool
00d4879c84 build: adjust the build to support non-Apple environments
Account for import libraries and the associated layout difference on
platforms (e.g. DLLs are placed in `bin`).  This is required to enable
building the macro path on Windows.
2023-09-06 12:45:58 -07:00
Allan Shortlidge
0dd8f4c492 AST: Introduce abstraction for extension/type decl inheritance clauses.
Wrap the `InheritedEntry` array available on both `ExtensionDecl` and
`TypeDecl` in a new `InheritedTypes` class. This class will provide shared
conveniences for working with inherited type clauses. NFC.
2023-09-06 10:41:57 -07:00
swift-ci
f560dc5cd2 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-05 13:34:36 -07:00
Rintaro Ishizaki
8a2aeb9590 Merge pull request #68273 from rintaro/sourcekit-host-rpath
[SourceKit] RPATH 'lib/swift/host' should be added without BOOTSTRAPPING
2023-09-05 13:14:41 -07:00
swift-ci
e279a465ca Merge remote-tracking branch 'origin/main' into rebranch 2023-09-03 15:53:40 -07:00
Saleem Abdulrasool
6b50edc6f7 SourceKit: handle Windows paths for request options
Windows paths involve a `:`.  Ideally, we would just use `;` as the
separator rather than `:`, but for now just limit the split count to 2.
2023-09-03 10:32:08 -07:00
Rintaro Ishizaki
537f3180c5 [SourceKit] RPATH 'lib/swift/host' should be added without BOOTSTRAPPING
as long as the Swift parser integration is enabled.
Also, remove redundant RPATH additions.
2023-09-01 11:21:09 -07:00
swift-ci
97970caeac Merge remote-tracking branch 'origin/main' into rebranch 2023-08-30 20:55:33 -07:00
Rintaro Ishizaki
9d78971b9b [CMake][SourceKit] Add RPATH to 'lib/swift/host'
RPATH to 'lib/swift/host' was missing in Darwin platform.
2023-08-30 11:56:00 -07:00
swift-ci
484684f0dd Merge remote-tracking branch 'origin/main' into rebranch 2023-08-29 17:55:14 -07:00