Commit Graph

2259 Commits

Author SHA1 Message Date
Max Desiatov
73be53785c Merge branch 'main' into maxd/support-version-option 2025-01-13 15:17:50 +00:00
Alex Hoppen
81fe78622b Merge pull request #1917 from ahoppen/linkfilelist-set
Change `linkFileList` to be a `Set`
2025-01-10 23:10:55 +01:00
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
13068d5cef Change linkFileList to be a Set 2025-01-10 19:04:39 +01:00
iMostafa
f2978b0491 Adjust tokenRange 2025-01-10 13:26:21 +02:00
Alex Hoppen
7327c09a72 In macro tests, only link against files listed in Objects.LinkFileList
Otherwise we can get a situation where a `.swift` file is removed from swift-syntax, its `.o` file is still in the build directory because the build folder wasn't cleaned and thus we would link against the stale `.o` file.

rdar://142666044
2025-01-10 10:07:34 +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
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
5b9b53104d Use forEachSymbolOccurrence to find parent container symbol
This improves performance when searching for `only` in SourceKit-LSP by ~30%.
2025-01-06 13:07:35 +01:00
Alex Hoppen
970c5a564f Correctly compute container names for extensions 2025-01-06 12:26:55 +01:00
Alex Hoppen
991b8933bc Merge pull request #1907 from ahoppen/remove-unused-method
Remove `SourceKitLSPServer.openGeneratedInterface`
2025-01-04 09:23:40 +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
c214a5fdb1 Merge pull request #1905 from ahoppen/output-mirror
Add option to generate an output mirror file that contains the exact data sent from SourceKit-LSP to the client
2025-01-03 15:11:52 +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
Rintaro Ishizaki
233f2e6f37 Merge pull request #1901 from rintaro/macros-link-cshims
[Test] Link macro binaries to _SwiftSyntaxCShims objects
2025-01-02 15:28:00 -08: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
5330795404 Add option to generate an output mirror file that contains the exact data sent from SourceKit-LSP to the client
This could help us debug low-level issues of SourceKit-LSP to client communication such as https://github.com/swiftlang/sourcekit-lsp/issues/1890.
2025-01-02 19:12:50 +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
a30385afa5 Merge pull request #1904 from ahoppen/log-cancellation
Emit a log message when we receive a cancel request notification
2025-01-02 18:39:53 +01:00
Alex Hoppen
7b43383260 Emit a log message when we receive a cancel request notification 2025-01-02 14:17:23 +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
iMostafa
5caf17c156 Update formatting in tests 2025-01-02 13:27:55 +02:00
Alex Hoppen
ede40883f5 Merge pull request #1898 from Kila2/feature/config-build-settings-timeout
feature support override buildSettingsTimeout by workspace config.json
2025-01-02 09:40:20 +01:00
Alex Hoppen
50793f682f Merge pull request #1895 from Kila2/main
fix ASTBuild command exec failed
2025-01-02 09:39:45 +01:00
Rintaro Ishizaki
6e23a8f0df [Test] Link macro binaries to _SwiftSyntaxCShims objects
`_SwiftSyntaxCShims` objects weren't linked because it was a header-only
library. But since actual code is being added, we need to link it.
2025-01-01 10:07:40 -08:00
iMostafa
fb4ed6510e Support Range when hovering
By getting the token at hovering position, then get the token
position.
2024-12-30 12:26:40 +02:00
lijunliang.9819
cf58f14215 feature support override buildSettingsTimeout by workspace config.json 2024-12-23 11:30:18 +08:00
Alex Hoppen
e93b7ed6bf Merge pull request #1849 from kateinoigakukun/katei/json-schema 2024-12-20 10:01:06 +01:00
lijunliang.9819
4987a40359 fix ASTBuild command exec failed 2024-12-20 16:55:18 +08:00
Alex Hoppen
1cd010db98 Merge pull request #1888 from ahoppen/indexstore-relative-compdb
Interpret the `-index-store-path` relative to the command’s directory
2024-12-13 23:47:50 +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
b07044d25d Interpret the -index-store-path relative to the command’s directory
Fixes #1856
rdar://141004197
2024-12-13 18:35:13 +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
9a1c75e883 Merge pull request #1882 from ahoppen/windows-immediate-exit
Fix an error that causes SourceKit-LSP to exit immediately on Windows
2024-12-12 14:25:00 -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
e6b8e07b86 Fix an error that causes SourceKit-LSP to exit immediately on Windows
For reasons that are completely oblivious to me, `DispatchIO.write`, which is used to write LSP responses to stdout fails with error code 5 on Windows unless we call `AbsolutePath(validating:)` on some URL first.
2024-12-11 10:39:17 -08:00
Alex Hoppen
559f23957e Improve performance of sourceFilesAndDirectories
`SourceFilesAndDirectoriesKey` contained all source files in the project and computing its hash value was pretty expensive. The key didn’t really provide any value here because the only way it changes is if the build targets change and if that’s the case, we already clear `cachedSourceFilesAndDirectories`, so we can just avoid the hash value computation.
2024-12-10 16:26:22 -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
7a06eb0ddf Merge pull request #1858 from ahoppen/symlink-target
Fix background indexing behavior if a source file is included in two targets via a symlink
2024-12-10 15:00:46 -08:00
Alex Hoppen
a087692725 Return compiler arguments for invalid package manifests
Currently, when there‘s a syntax error in a package manifest, we don’t get any build settings from it in SourceKit-LSP and thus loose almost all semantic functionality. If we can’t parse the package manifest, fall back to providing build settings by assuming it has the current Swift tools version.

Currently, when there‘s a syntax error in a package manifest, we don’t get any build settings from it in SourceKit-LSP and thus loose almost all semantic functionality. If we can’t parse the package manifest, fall back to providing build settings by assuming it has the current Swift tools version.

Fixes #1704
rdar://136423767
2024-12-09 15:25:38 -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
247acf6ae7 Merge pull request #1874 from ahoppen/allow-dependency-updates
Allow dependency updates in the `index-build` folder
2024-12-09 14:31:38 -08:00
Alex Hoppen
881f0f55fa Merge pull request #1873 from ahoppen/swiftpm-child-scopes
Create child scopes for SwiftPM operations
2024-12-09 12:17:02 -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