Commit Graph

12 Commits

Author SHA1 Message Date
Tim Kientzle
1098054291 Merge branch 'main' into tbkka-assertions2 2024-06-18 17:52:00 -07:00
Alex Hoppen
155773c38e Fix renaming enum case parameters with unnamed associated arguments
We treated enum case parameters the same way as function parameters and weren’t considering that they can be unlabeled. That caused us to insert eg. `_ ` in front of the case’s type, producing `case myCase(_ String)`, which is invalid. When we are inside an enum case parameter and the parameter label is empty, treat it the same as a function call, which will leave the label untouched if it isn’t modified and insert a label including a colon if a new label is introduced.

https://github.com/apple/sourcekit-lsp/issues/1228
2024-06-11 19:18:59 -07:00
Tim Kientzle
1d961ba22d Add #include "swift/Basic/Assertions.h" to a lot of source files
Although I don't plan to bring over new assertions wholesale
into the current qualification branch, it's entirely possible
that various minor changes in main will use the new assertions;
having this basic support in the release branch will simplify that.
(This is why I'm adding the includes as a separate pass from
rewriting the individual assertions)
2024-06-05 19:37:30 -07:00
Alex Hoppen
63aeedecbd [SourceKit] Only report textual results inside comments and strings from syntactic rename ranges 2024-02-29 15:37:29 -08:00
Ben Barham
ef8825bfe6 Migrate llvm::Optional to std::optional
LLVM has removed llvm::Optional, move over to std::optional. Also
clang-format to fix up all the renamed #includes.
2024-02-21 11:20:06 -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
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
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
33e9c30ede [SourceKit] Unify boolean values in ResolvedLoc into a ResolvedLocContext 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