Commit Graph

1539 Commits

Author SHA1 Message Date
Alex Hoppen
5e803c6b6c Merge pull request #71081 from ahoppen/ahoppen/remove-call-pattern-heuristics
[CodeComplete] Remove code for call pattern heuristics and `ConjunctionElement::mightContainCodeCompletionToken`
2024-01-23 07:38:30 -08:00
Alex Hoppen
2ab9f63810 Merge pull request #71049 from ahoppen/ahoppen/dont-realpath-solver-based-cursor-info
[SourceKit] Don't realpath the primary file path
2024-01-23 07:33:18 -08:00
Alex Hoppen
c8424c1b7a [CodeComplete] Remove code for call pattern heuristics
These options weren’t used anymore, so we can remove them.
2024-01-22 19:57:12 -08:00
Alex Hoppen
8625b3f119 [SourceKit] Don't realpath the primary file path
If the file didn’t exist on disk, `fileSystem->getRealPath` returns an empty string, which means we can’t find the `InputBuffer` and thsu won’t run solver-based cursor info. There’s no reason to realpath `PrimaryInputPath`, `getMemoryBuffer` already does that.

rdar://120737244
2024-01-22 14:36:24 -08:00
Hamish Knight
3f4b45b012 [AST] Remove SerializedLocalDeclContext
It's not clear that its worth keeping this as a
base class for SerializedAbstractClosure and
SerializedTopLevelCodeDecl, most clients are
interested in the concrete kinds, not only whether
the context is serialized.
2024-01-18 12:03:52 +00:00
Allan Shortlidge
064afb9d15 NFC: Ignore deprecation of asl_log in SourceKit.
ASL is deprecated in macOS 10.12. It may be time to transition to os_log now
that deployment targets have been raised to 10.12, but until that project
starts these warnings are just pollution.

Filed rdar://121076739 to track adoption of `os_log()` if appropriate.
2024-01-16 14:21:36 -08:00
Ikko Eltociear Ashimine
a1108fffe9 [SourceKit] fix typo in SwiftEditor.cpp
clearning -> clearing
2024-01-16 03:52:03 +09:00
Sam Kortekaas
1fe5f04574 [SourceKit] Use req options instead of compiler arguments for controlling index-to-store behavior 2024-01-11 17:13:03 +01:00
Ben Barham
f3426eb8a6 [Completion] Use statically-known size for completion ordering
We know the size of these arrays statically, there's no point
calculating them at runtime.

Resolves rdar://119938834.
2024-01-02 17:44:09 -08:00
Saleem Abdulrasool
9b058d8bda SourceKit: remove unncessary link against libcmark-gfm_static
There is no use of cmark in SourceKit, if there is a dependency on it
for a dependent library, we should propagate it through the dependency.
2023-12-21 09:05:44 -08:00
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
9219b0cd71 [SourceKit] Address FIXMEs for the NameMatcher
rdar://118996561
2023-12-11 16:56:01 -08:00
Alex Hoppen
2e806b16e3 [SourceKit] Return operator results from related identifiers request 2023-12-07 13:12:12 -08:00
Alex Hoppen
a24c563d70 [SourceKit] Allow references to non-editable base names to be returned by the related identifiers request
While we don't want to return non-editable base names for Edit-All-In-Scope, we do want to return them if the related identifiers response is used as the input for find-syntactic-rename-ranges.
2023-12-07 13:12:12 -08:00
Alex Hoppen
ddf4a2e3fb [SourceKit] Return the old name from the related identifiers response 2023-12-07 13:12:11 -08:00
Alex Hoppen
143dccbdf5 [SourceKit] Return RenameLocUsage in related identifiers response
This will allow us to get syntactic rename ranges from the locations returned by related identifiers.
2023-12-07 09:04:24 -08:00
Alex Hoppen
847671b6ac [SourceKit] Fix a build failure if SWIFT_BUILD_SWIFT_SYNTAX is not set 2023-12-07 09:03:10 -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
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
d4ee4fa308 [SourceKit] Refactor RelatedIdentsInfo
Remove unnecessary `ArrayRef` wrapping and introduce a struct instead of a `std::pair`.
2023-12-06 14:32:13 -08:00
Doug Gregor
fbd5cb42cd Merge pull request #70247 from DougGregor/body-macro-as-brace-stmt
Macro expansion refactoring for preamble and body macros
2023-12-05 21:47:05 -08:00
Alex Hoppen
db8ca19a24 Merge pull request #70014 from ahoppen/ahoppen/some-any-completion
[CodeCompletion] Add keyword completion for 'some', 'any', 'repeat', and 'each'
2023-12-05 16:24:05 -08:00
Doug Gregor
2b7c70997b Macro expansion refactoring for preamble and body macros 2023-12-05 13:30:35 -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
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
23cde9b2e0 [SourceKit] Move the option to IndexToStore request 2023-10-20 12:55:41 +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
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
0407c3d3b2 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-06 13:34:53 -07:00