Commit Graph

1012 Commits

Author SHA1 Message Date
Ben Barham
333e950df2 Allow workspace options to affect build system search
There were a few places that options only took place *after* determining
a build system, even though we have multiple that impact the search (eg.
`defaultBuildSystem` and `searchPaths`).

Additionally track project root and configuration paths separately, so
that when searching for implicit workspaces we can make sure to skip
creating duplicates.

(cherry picked from commit 0c896696c9)
2025-01-23 15:17:48 -08:00
Alex Hoppen
351a7814c6 Allow injection of build systems into SourceKitLSP
This allows us to clean up the creation of `TestBuildSystem` a little bit because the tests can create `TestBuildSystem` instead of retrieving it from the `BuildSystemManager`.

rdar://142906050
(cherry picked from commit 31b1909ce1)
2025-01-23 15:17:14 -08:00
Alex Hoppen
9e10ece2eb Remove imports of SwiftPM modules that are not strictly necessary
(cherry picked from commit 718c0ee809)
2025-01-23 11:43:18 -08:00
Alex Hoppen
f8002f72fd Support building SourceKit-LSP without a dependency on SwiftPM
(cherry picked from commit 5326852ea8)
2025-01-23 11:43:10 -08:00
Alex Hoppen
c8f8c1e53d Avoid logging options for a workspace twice
We are already logging the options below.

(cherry picked from commit 760be317bc)
2025-01-23 11:42:59 -08:00
Alex Hoppen
2122cd36eb Revert "Merge pull request #1907 from ahoppen/remove-unused-method"
This reverts commit 991b8933bc, reversing
changes made to c214a5fdb1.
2025-01-08 09:43:54 +01:00
Alex Hoppen
c63ccc24d2 Revert "Merge pull request #1887 from ahoppen/generated-interface-reference-document"
This reverts commit f653ef3255, reversing
changes made to 233f2e6f37.
2025-01-08 09:43:07 +01:00
Alex Hoppen
929531e983 Merge remote-tracking branch 'swiftlang/main' into release/6.1 2025-01-08 09:38:42 +01:00
Alex Hoppen
17e2db073c Merge pull request #1909 from ahoppen/cache-container-names
Cache container names in `CheckedIndex`
2025-01-08 09:37:30 +01:00
Alex Hoppen
2a0902bb20 Cache container names in CheckedIndex
It is important that we cache this because we might find a lot of symbols in the same container for eg. workspace symbols (eg. consider many symbols in the same C++ namespace). If we didn't cache this value, then we would need to perform a `primaryDefinitionOrDeclarationOccurrence` lookup for all of these containers, which is expensive.

For example, searching for `only` in SourceKit-LSP’s codebase used to not return results in more than 20s (after which I gave up) and now returns >8000 results in <2s.

rdar://141412138
2025-01-03 16:00:22 +01:00
Alex Hoppen
2f53e7cf16 Remove SourceKitLSPServer.openGeneratedInterface
The method was never called.
2025-01-03 15:09:40 +01:00
Alex Hoppen
f653ef3255 Merge pull request #1887 from ahoppen/generated-interface-reference-document
Support semantic functionality in generated interfaces if the client supports `getReferenceDocument`
2025-01-03 14:35:01 +01:00
Alex Hoppen
8d73731bcb Support semantic functionality in generated interfaces if the client supports getReferenceDocument
This allows us to provide semantic functionality inside the generated interfaces, such as hover or jump-to-definition.

rdar://125663597
2025-01-02 20:29:36 +01:00
Alex Hoppen
320177ff85 Merge pull request #1902 from ahoppen/clear-in-progress-on-queue
Clear `inProgressTextDocumentRequests` on `textDocumentTrackingQueue`
2025-01-02 18:40:11 +01:00
Alex Hoppen
3f085600ef Merge pull request #1903 from ahoppen/macro-highlighting
Add semantic highlighting for macros
2025-01-02 18:40:01 +01:00
Alex Hoppen
4303e44fcb Add semantic highlighting for macros 2025-01-02 13:25:58 +01:00
Alex Hoppen
e59df13bb0 Clear inProgressTextDocumentRequests on textDocumentTrackingQueue
`inProgressTextDocumentRequests` is supposed to only be accessed on `textDocumentTrackingQueue` but we were accessing it outside of that queue. Because of this, we might try to remove requests from `inProgressTextDocumentRequests` before adding them, which would cause them to stay in the list indefinitely.
2025-01-02 13:23:18 +01:00
lijunliang.9819
4987a40359 fix ASTBuild command exec failed 2024-12-20 16:55:18 +08:00
Alex Hoppen
61c3d0c727 Revert "Merge pull request #1886 from ahoppen/sourcekitd-request-diagnostics"
This reverts commit 97711388d0, reversing
changes made to 9a1c75e883.
2024-12-17 16:33:24 +01:00
Alex Hoppen
d8a8e3c312 Merge remote-tracking branch 'swiftlang/main' into release/6.1 2024-12-17 16:32:09 +01:00
Alex Hoppen
a54c709425 When a sourcekitd diagnostics request fails, show the request error as a diagnostic on the source file
The missing diagnostics might be due to an error that the user can fix. Report it to them.

Fixes #1812
rdar://139514623
2024-12-12 16:32:33 -08:00
Alex Hoppen
fd79c3d21d Revert "Merge pull request #1831 from woolsweater/the-trail-is-closed"
This reverts commit 21dfaf0f9c, reversing
changes made to f900b4ef2c.
2024-12-10 10:33:35 -08:00
Alex Hoppen
c3f97b9080 Revert "Merge pull request #1854 from matthewbastien/documentation-language-service"
This reverts commit 9bbb8f3287, reversing
changes made to 21dfaf0f9c.
2024-12-10 10:33:28 -08:00
Alex Hoppen
85828ee0a8 Revert "Merge pull request #1870 from ahoppen/no-escape-open-brace"
This reverts commit 1a708ec596, reversing
changes made to 5183889e7e.
2024-12-10 10:33:14 -08:00
Alex Hoppen
5eb460f148 Fix background indexing behavior if a source file is included in two targets via a symlink
Consider the following scenario: A project has target A containing A.swift an target B containing B.swift. B.swift is a symlink to A.swift. When A.swift is modified, both the dependencies of A and B need to be marked as having an out-of-date preparation status, not just A.
2024-12-09 15:06:39 -08:00
Alex Hoppen
87af5b06f1 Merge pull request #1857 from ahoppen/no-implicit-completion-cancellation 2024-12-07 08:56:38 -08:00
Alex Hoppen
1a708ec596 Merge pull request #1870 from ahoppen/no-escape-open-brace
Don’t escape `{` inside placeholder snippets
2024-12-06 18:25:06 -08:00
Alex Hoppen
5183889e7e Merge pull request #1872 from ahoppen/no-background-indexing-warning
Don’t show warning message when opening projects that don't support background indexing
2024-12-06 18:16:23 -08:00
Alex Hoppen
f59fb2bb2f Merge pull request #1863 from ahoppen/index-schedule-progress
Improve logic for build graph generation status
2024-12-06 13:35:39 -08:00
Alex Hoppen
14264b769b Merge pull request #1871 from ahoppen/settrace-freestanding
Treat `$/setTrace` as a freestanding message
2024-12-06 13:33:10 -08:00
Alex Hoppen
ee1f4b13fc Don’t escape { inside placeholder snippets
When `\{` is included inside an LSP placeholder, in VS Code will insert `\{` verbatim. At least in VS Code, we only need to escape the closing brace.

While at it, also escape `$` and `\` inside placeholders, according to the LSP spec.
2024-12-06 12:26:22 -08:00
Alex Hoppen
f376e669bd Merge pull request #1869 from ahoppen/batch-filedidchange-syntacticindex
Batch updates to the syntactic test index on fileDidChange events
2024-12-06 12:25:16 -08:00
Alex Hoppen
2bf477675e Merge pull request #1868 from ahoppen/only-calls-in-call-hierarchy
Only show call-like occurrences in call hierarchy.
2024-12-06 12:22:13 -08:00
Alex Hoppen
cbd897de03 Don’t show warning message when opening projects that don't support background indexing
Since we enabled background indexing by default, the user is no longer explicitly opting into it. A user might be exclusively working with compilation database projects or BSP server without background indexing support and thus not care that we switched the background indexing default. We shouldn’t bother them with a warning message every time they launch sourcekit-lsp.
2024-12-06 12:12:26 -08:00
Alex Hoppen
697e65acdc Improve logic for build graph generation status
`generateBuildGraph` was named misleadingly because the primary purpose of these tasks was to schedule indexing tasks and generating the build graph was just a necessary step for this. Also update it to take into account that multiple tasks scheduling indexing tasks might be running in parallel.
2024-12-06 09:07:18 -08:00
Alex Hoppen
7c474fdc58 Treat $/setTrace as a freestanding message
`$/setTrace` changes a global configuration setting but it doesn't affect the result of any other request. To avoid blocking other requests on a `$/setTrace` notification the client might send during launch, we treat it as a freestanding message.
Also, we don't do anything with this notification at the moment, so it doesn't matter.
2024-12-06 08:57:27 -08:00
Alex Hoppen
67b98cd7b2 Batch updates to the syntactic test index on fileDidChange events
This is more performant. In particular adding a new task to `indexingQueue` for each file to rescan can hit the quadratic issue in `AsyncQueue` if many files were changed.
2024-12-06 08:24:09 -08:00
Alex Hoppen
751291e14f Only show call-like occurrences in call hierarchy.
`extension MyTask: AnyTask {}` includes an occurrence of `MyTask.cancel` to mark it as an override of `AnyTask.cancel` but we shouldn't show the extension in the call hierarchy.
2024-12-06 08:05:50 -08:00
Alex Hoppen
9bbb8f3287 Merge pull request #1854 from matthewbastien/documentation-language-service
Handle `*.md` and `*.tutorial` files from Swift DocC
2024-12-05 20:35:23 -08:00
Alex Hoppen
21dfaf0f9c Merge pull request #1831 from woolsweater/the-trail-is-closed
Handle new swift-syntax closure expansion behavior
2024-12-05 16:59:51 -08:00
Alex Hoppen
990ec7fc2a Don’t implicitly cancel code completion requests on document edits
As the user types, we filter the code completion results. Cancelling the completion request on every keystroke means that we will never build the initial list of completion results for this code completion session if building that list takes longer than the user's typing cadence (eg. for global completions) and we will thus not show any completions.
2024-12-05 14:43:56 -08:00
Matthew Bastien
debb5dc165 Merge pull request #1852 from matthewbastien/document-symbols
Include parameters in initializer document symbols
2024-12-05 16:48:18 -05:00
Matthew Bastien
b4cf0da663 address review comments 2024-12-05 14:13:23 -05:00
Josh Caswell
60beed85ae Customize closure expansion behavior
This resolves <https://github.com/swiftlang/sourcekit-lsp/issues/1788>,
following the discussion of alternatives on
<https://github.com/swiftlang/sourcekit-lsp/pulls/1789>. The bulk of the
change updates the translation from SourceKit placeholders to LSP
placeholders to handle nesting. The `CodeCompletionSession` also passes
a new custom formatter to the swift-syntax expansion routine, which
disables the transformation to trailing closures.
2024-12-05 08:57:41 -08:00
Matthew Bastien
8fd30908e7 handle *.md and *.tutorial files for Swift DocC 2024-12-05 11:18:49 -05:00
Matthew Bastien
e938dfaa7d include parameters in initializer document symbol 2024-12-04 16:42:04 -05:00
Alex Hoppen
9efa7e8cff Merge pull request #1844 from ahoppen/fully-qualified-names
Fully qualify type names in call hierarchy, type hierarchy and workspace symbols
2024-12-03 14:40:13 -08:00
Alex Hoppen
7a95075fcb Merge pull request #1842 from ahoppen/shutdown-null
Reply with `null` to `shutdown` request
2024-12-03 14:39:22 -08:00
Alex Hoppen
51634d8f08 Merge pull request #1840 from ahoppen/async-queue-quadratic
Fix quadratic performance issue in `AsyncQueue<Serial>`
2024-12-03 14:38:36 -08:00
Alex Hoppen
eb72e10886 Fully qualify type names in call hierarchy, type hierarchy and workspace symbols
Previously, we didn’t take outer types into account or only took one level of container type into account.

Fixes #1673
rdar://136078089
2024-11-22 21:33:26 +01:00