Commit Graph

782 Commits

Author SHA1 Message Date
Alex Hoppen
8ac1beec86 Merge pull request #1899 from iMostfa/feat/support-range-in-hover
feat: Support range in `textDocument/hover`
2025-01-10 21:57:15 +01:00
Alex Hoppen
194d340c6b Merge pull request #1914 from ahoppen/retry-updating-headerh
Retry updating `Header.h` in `testBackgroundIndexingReindexesHeader`
2025-01-10 09:28:36 +01:00
Alex Hoppen
d566e2b690 Retry updating Header.h in testBackgroundIndexingReindexesHeader
This fixes a nondeterministic test failure on Windows.
2025-01-09 22:52:45 +01:00
Alex Hoppen
48389c75a2 Merge pull request #1912 from ahoppen/reduce-swiftpm-dependency
Support building SourceKit-LSP without a dependency on SwiftPM
2025-01-09 13:10:44 +01:00
iMostafa
a1a8755a1a Update tests and formatting 2025-01-09 01:30:12 +02:00
Alex Hoppen
5326852ea8 Support building SourceKit-LSP without a dependency on SwiftPM 2025-01-08 13:13:31 +01:00
Alex Hoppen
718c0ee809 Remove imports of SwiftPM modules that are not strictly necessary 2025-01-08 12:43:43 +01:00
Alex Hoppen
970c5a564f Correctly compute container names for extensions 2025-01-06 12:26:55 +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
iMostafa
5caf17c156 Update formatting in tests 2025-01-02 13:27:55 +02:00
Alex Hoppen
e93b7ed6bf Merge pull request #1849 from kateinoigakukun/katei/json-schema 2024-12-20 10:01:06 +01:00
Alex Hoppen
97711388d0 Merge pull request #1886 from ahoppen/sourcekitd-request-diagnostics
When a sourcekitd diagnostics request fails, show the request error as a diagnostic on the source file
2024-12-13 19:42:05 +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
e0901f0600 Merge pull request #1880 from ahoppen/normalize-drive-letter
Normalize Windows drive letter to be uppercase
2024-12-12 10:45:59 -08:00
Alex Hoppen
03d58e8415 Normalize Windows drive letter to be uppercase
VS Code spells file paths with a lowercase drive letter, while the rest of Windows APIs use an uppercase drive letter. Normalize the drive letter spelling to be uppercase.

Fixes #1855
rdar://141001203
2024-12-10 16:16:27 -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
Yuta Saito
7597945e38 Use an enum for backgroundPreparationMode in the configuration file instead of a string 2024-12-09 02:12:12 +09: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
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
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
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
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
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
9446520653 fix copyright header 2024-12-05 11:27:57 -05: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
c85dd7c5e4 Merge pull request #1843 from ahoppen/empty-path-crash
Don’t crash when opening a file with an empty path
2024-12-03 14:39:55 -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
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
Alex Hoppen
14b8588221 Don’t crash when opening a file with an empty path
Fixes #1739
rdar://137886470
2024-11-22 15:59:07 +01:00
Alex Hoppen
e073a01bbc Reply with null to shutdown request
The LSP spec says the result of `shutdown` is `null`, not an empty object.

Fixes #1733
rdar://137886488
2024-11-22 15:52:27 +01:00
MahdiBM
a2eb7b9b2c Handle on-type formatting requests 2024-11-21 16:07:22 +03:30
Alex Hoppen
a8643915ab Merge pull request #1832 from ahoppen/reduce-absolute-path 2024-11-19 07:07:05 -08:00
Alex Hoppen
be546308ca Use URL in many cases where we used AbsolutePath
We made quite a few fixes recently to make sure that path handling works correctly using `URL` on Windows. Use `URL` in most places to have a single type that represents file paths instead of sometimes using `AbsolutePath`.

While doing so, also remove usages of `TSCBasic.FileSystem` an `InMemoryFileSystem`. The pattern of using `InMemoryFileSystem` for tests was never consistently used and it was a little confusing that some types took a `FileSystem` parameter while other always assumed to work on the local file system.
2024-11-18 18:19:48 -08:00
Alex Hoppen
c0c0f1f0a6 Skip tests that use background indexing when running tests with a Swift 5.10 toolchain
https://github.com/swiftlang/sourcekit-lsp/pull/1714 changed the background preparation mode to `enabled` but a Swift 5.10 toolchain does not support `--experimental-prepare-for-indexing`. Thus, these tests fail. Skip tests that rely on background indexing when testing SourceKit-LSP with a Swift 5.10 host toolchain.
2024-11-18 15:28:34 -08:00
Alex Hoppen
bce09932ed Merge pull request #1714 from ahoppen/background-indexing-on 2024-11-16 21:58:12 -08:00
Alex Hoppen
a2bf9549fa Restrict directories that we search for MyDependency.swift in tests
It appears that moving the index-build directory to be a subdirectory of `.build` caused some file in the index-build directory to exceed the `MAX_PATH` length on the SourceKit-LSP PR testing job (but not the swift PR job because that has a shorter job name). Because of https://github.com/swiftlang/swift-foundation/issues/1049, we would stop directory iteration at that file exceeding `MAX_PATH` and never find `MyDependency.swift`, causing these tests to fail.
2024-11-16 09:01:54 -08:00
Alex Hoppen
84fc3fec1a Enable background indexing by default 2024-11-15 16:58:40 -08:00
Alex Hoppen
c23b4ff776 Merge pull request #1803 from ahoppen/indexbuild-subfolder
Make `.index-build` a subdirectory of `.build`
2024-11-14 12:54:20 -08:00
Alex Hoppen
63eca88398 Enable SwiftPM-based tests on Windows 2024-11-14 08:43:42 -08:00
Alex Hoppen
9c84a344c8 Merge pull request #1817 from ahoppen/bsp-review 2024-11-14 08:10:02 -08:00
Alex Hoppen
714e520110 Merge pull request #1820 from ahoppen/wait-for-diags 2024-11-14 08:09:46 -08:00