Alex Hoppen
e8d148ab86
[build] Move addition of SWIFT_BUILD_SWIFT_SYNTAX preprocessor flag to top-level CMakeLists.txt
2023-12-12 12:58:15 -08:00
Alex Hoppen
e26c76dbd4
[SourceKit] Migrate getNotableRegions to new NameMatcher in swift-syntax
2023-12-12 12:58:15 -08:00
Alex Hoppen
a5530ce9b6
[SourceKit] Factor out some more bridging code to run the NameMatcher from swift-syntax
2023-12-12 12:58:15 -08:00
Alex Hoppen
32e366a98a
[SourceKit] Migrate renameAvailabilityInfo to use the SwiftSyntax NameMatcher
...
The `NameMatcher` implemented in swift-syntax as slightly different semantics because it consideres `(callable.|callAsFunction)(x: 78)` as a reference to `callAsFunction` instead of a call with argument labels `(x: 78)`, which means that one test needs to be updated.
2023-12-12 12:49:16 -08:00
Alex Hoppen
9219b0cd71
[SourceKit] Address FIXMEs for the NameMatcher
...
rdar://118996561
2023-12-11 16:56:01 -08:00
Alex Hoppen
516836cb98
[SourceKit] Don't handle labels when renaming operators
...
This allows us to at least rename the base of operators. The labels don’t matter too much since they only occur on the function definition.
2023-12-07 13:12:12 -08:00
Alex Hoppen
222739a71d
Merge pull request #70255 from ahoppen/ahoppen/rename-refactoring
...
[Rename] Collection of improvements to make syntactic rename easier to read
2023-12-06 19:46:01 -08:00
Alex Hoppen
d53e1b99f8
[SourceKit] Change RenameRangeCollector::startSourceEntity to use early returns
2023-12-06 14:33:14 -08:00
Alex Hoppen
e538a5ed61
[SourceKit] Merge RenameLoc and RenameLocation
...
It’s easier to understand the code if we don’t have these two nearly, but not quite, identical types.
2023-12-06 14:33:14 -08:00
Alex Hoppen
5cae50a1a6
[SourceKit] Refactor addSyntacticRenameRanges
...
Refactor `addSyntacticRenameRanges`, adding comments to make it easier to follow and remove its dependency on the `IsFunctionLike` parameter in `RenameLoc`.
2023-12-06 14:31:47 -08:00
Alex Hoppen
c8a87f091e
[build] Only link swiftIDEUtilsBridging when SWIFT_BUILD_SWIFT_SYNTAX is set
...
https://github.com/apple/swift/pull/70174 change swift-refactor and sourcekitd to not use `NameMatcher` from swift-syntax but it did not remove the link dependency from swiftRefactoring on `swiftIDEUtilsBridging` if `SWIFT_BUILD_SWIFT_SYNTAX` is false. Do so now.
2023-12-06 09:32:47 -08: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
cc858ab253
Merge pull request #70008 from ahoppen/ahoppen/name-matcher-in-swift
...
Share implementation of local rename and related identifiers + implement `NameMatcher` in Swift
2023-11-30 09:37:53 -08:00
Alex Hoppen
bc5cc43a06
Don’t include <vector> in IDEBridging.h
2023-11-28 14:04:37 -08:00
Doug Gregor
36a2dcd927
Implement function body macros
...
Function body macros allow one to introduce a function body for a
particular function, either providing a body for a function that
doesn't have one, or wholesale replacing the body of a function that
was written with a new one.
2023-11-27 17:04:55 -08:00
Alex Hoppen
f408619ddc
Address Hamish’s review comments
2023-11-27 14:17:04 -08:00
Alex Hoppen
d224549030
[SourceKit] Don’t use C++ to Swift interop to run NameMatcher
2023-11-20 11:30:18 -08:00
Alex Hoppen
8fd025625b
[SourceKit] Use NameMatcher that is rewritten in Swift for syntactic rename
2023-11-17 09:30: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
33e9c30ede
[SourceKit] Unify boolean values in ResolvedLoc into a ResolvedLocContext
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
ec267e2c08
[SourceKit] Hide RenameRangeDetailCollector as an implementation detail
...
The usage becomes a lot clearer if there’s just a top-level function that returns the details for the syntactic rename ranges.
2023-11-16 16:05:08 -08:00
Alex Hoppen
a0313e3005
[SourceKit] Merge Renamer and RenameRangeDetailCollector
...
With `TextReplacementsRenamer` gone, `RenameRangeDetailCollector` was the only remaining subclass of `Renamer`.
2023-11-16 16:05:08 -08:00
Alex Hoppen
bfad46d524
[SourceKit] Remove the -syntactic-rename option from swift-refactor
...
With the local refactoring being removed, all production refactoring paths return a set of ranges to rename and don’t apply edits to the file. Thus, the `syntactic-rename` action also doesn’t make sense anymore.
2023-11-16 16:05:08 -08:00
Alex Hoppen
5d7200a0a1
[SourceKit] Remove the local rename refactoring action
...
Local refactoring should go through the `find-local-rename-ranges` request.
2023-11-16 16:05:08 -08:00
Alex Hoppen
8208c23850
[SourceKit] Remove ResolvedLoc.Node
...
We can’t represent the parent node when rewriting `NameMatcher` using swift-syntax. Replace it by two boolean fields `IsComment` and `IsInStringLiteral` that can be bridged.
2023-11-16 16:05:08 -08:00
Alex Hoppen
ba06b5c075
[SourceKit] Replace UnresolvedLoc by SourceLoc
...
`UnresolvedLoc` was just a wrapper around `SourceLoc` and isn’t needed anymore.
2023-11-16 16:05:08 -08:00
Alex Hoppen
b3ab9bffd5
[SourceKit] Remove UnresolvedLoc.ResolveArgLocs
...
AFAICT we can just infer whether to resolve arguments based on the presence of arguments. We don’t need the information to be passed in.
2023-11-16 16:05:07 -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
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
698397c309
[Refactoring] Expose findLocalRenameLocs in Refactoring.h
2023-11-16 16:05:07 -08:00
Alex Hoppen
e3264d9e1d
[SourceKit] Remove Implementation abstraction layer in FindRenameRangesAnnotatingConsumer
2023-11-10 11:41:01 -08:00
Alex Hoppen
55b3404660
[Refactoring] Move syntactic rename to its own file
2023-09-26 20:14:22 -07:00
Alex Hoppen
dd6ddde384
[Refactoring] Move some more code from RefactoringActions.h to a .cpp file
2023-09-13 12:52:02 -07:00
Alex Hoppen
33b72bdde4
[Refactoring] Add guards around header files in lib/Refactoring
2023-09-11 19:09:56 -07:00
Alex Hoppen
755655ac00
[Refactoring] Move FindRenameRangesAnnotatingConsumer to its own file
2023-09-11 19:06:24 -07:00
Alex Hoppen
cf71a105f2
[Refactoring] Move async refactorings into their own files
2023-09-11 19:05:00 -07:00
Alex Hoppen
3074dbe5c5
[Refactoring] Move LocalRename to its own file
2023-09-11 17:14:29 -07:00
Alex Hoppen
c05c573a04
[Refactoring] Move ExpandMacro and InlineMacro to their own file
2023-09-11 17:01:58 -07:00
Alex Hoppen
10b9daf2b5
[Refactoring] Split ConvertToComputedProperty to its own file
2023-09-11 16:59:27 -07:00
Alex Hoppen
00eaf741ff
[Refactoring] Move TrailingClosure to its own file
2023-09-11 16:57:26 -07:00
Alex Hoppen
c7120f466e
[Refactoring] Move SimplifyNumberLiteral to its own file
2023-09-11 16:55:53 -07:00
Alex Hoppen
5dc7a79a57
[Refactoring] Move ConvertToDoCatch to its own file
2023-09-11 16:54:32 -07:00
Alex Hoppen
1be0c50acf
[Refactoring] Move AddExplicitCodableImplementation to its own file
2023-09-11 16:53:00 -07:00
Alex Hoppen
fdf2586600
[Refactoring] Move AddEquatableConformance to its own file
2023-09-11 16:51:10 -07:00
Alex Hoppen
a48d0f2579
[Refactoring] Move MemberwiseInitLocalRefactoring to its own file
2023-09-11 16:45:31 -07:00
Alex Hoppen
7e87813345
[Refactoring] Move LocalizeString to its own file
2023-09-11 16:43:59 -07:00
Alex Hoppen
94ab95e8c8
[Refactoring] Move ExpandSwitchCases and ExpandDefault to their own file
2023-09-11 16:42:29 -07:00
Alex Hoppen
ef4ee95e24
[Refactoring] Move FillProtocolStubs to its own file
2023-09-11 16:38:01 -07:00