Commit Graph

1132 Commits

Author SHA1 Message Date
Alex Hoppen
55f2df8317 Increase default timeout to 3 minutes
In some cases, when Xcode doesn’t have a module cache for SDK modules, building SwiftPM project in the tests can take longer than 1 minute. Increase the timeout to 2 minutes.
2024-01-22 15:49:50 -08:00
Alex Hoppen
6768cfc432 Merge pull request #1028 from ahoppen/ahoppen/split-windows-command-line
Add logic to split command line arguments on Windows
2024-01-20 15:31:14 -08:00
Alex Hoppen
4666d3ff2a Fix an issue that caused the wrong default toolchain to get selected
A previous commit in this PR changed the way the default toolchain was computed. That commit had a bug that it didn’t prefer the toolchain discovered from `SOURCEKIT_TOOLCHAIN_PATH` and relative to the `sourcekit-lsp` executable over the Xcode default toolchain. To fix that, record the reason why we found a toolchain and use that to prefer those toolchains over the Xcode default toolchain.
2024-01-18 15:25:00 -08:00
Alex Hoppen
6505ec8f7e Make ToolchainRegistry initializer synchronous
This requires a bit of a restructuring of `ToolchainRegistry` because calling `scanForToolchain` on `self` is a suspension point. Instead, we need to implement the entire toolchain discovery in the initializer itself, which really isn’t that bad anyway.

This allows us to make the `SourceKitLSP.run` function synchronous again.

Fixes #1023
rdar://120976054
2024-01-18 15:25:00 -08:00
Alex Hoppen
6a77e3b6cd Don’t store the default toolchain in the ToolchainRegistry
The computation of the default toolchain was a weird mixture of manually setting it and lazy resolving that made it hard to understand where the default toolchain was coming from.

To simplify the logic, always compute the default toolchain from the raw data that we have.
2024-01-18 15:13:17 -08:00
Alex Hoppen
cfea67276d Add logic to split command line arguments on Windows
Previously, we were splitting command line arguments on Windows using the same rules as on Unix, which was incorrect, most importantly because backslashes in the first component of a Windows command line invocation are not escaping anything but interpreted verbatim.

Fixes #1020
rdar://120809063
2024-01-17 22:14:28 -08:00
Alex Hoppen
82b899e0a9 Get compiler arguments for files in the Plugins folder
This uses the new API in SwiftPM introduced by https://github.com/apple/swift-package-manager/pull/6763 to get compiler arguments for a target instead of stitching them together in sourcekit-lsp.

Fixes #664
rdar://102213837
2024-01-17 15:02:51 -08:00
Alex Hoppen
500cb1d6c1 Remove SwiftPMWorkspace._settings
The function forwarded to a public function and there’s no reason for it to exist anymore.
2024-01-17 15:02:33 -08:00
Alex Hoppen
70fdb1a428 Use withTestScratchDir instead of withTemporaryDirectory
`withTestScratchDir` respects the SourceKit-LSP test environment variable to keep temporary files.
2024-01-17 15:02:33 -08:00
Max Desiatov
000a566c19 Fix SwiftPMWorkspace compatibility with targetMap keys (#1025)
`ResolvedTarget` is no longer `Hashable` in SwiftPM, SourceKit-LSP should use `ResolvedTarget.ID` instead. Depends on https://github.com/apple/swift-package-manager/pull/7248.
2024-01-17 12:42:29 -08:00
Alex Hoppen
3e432c495a Merge pull request #965 from joehsieh/cache-diagnostics 2024-01-11 23:41:21 -08:00
Alex Hoppen
403fc5e92f Merge pull request #1021 from ahoppen/ahoppen/retroactive-5.11
Guard usages of `@retroactive` by Swift 5.11, not 5.10
2024-01-11 13:14:21 -08:00
Alex Hoppen
4b32dfe121 Guard usages of @retroactive by Swift 5.11, not 5.10
I incorrectly thought that `@retroactive` gets introduced by Swift 5.10 but it’s only available in Swift 5.11.
2024-01-11 09:41:18 -08:00
Alex Hoppen
1e72500f1a Merge pull request #1017 from ahoppen/ahoppen/secondary-cursor-info-results
Report secondary cursor info results
2024-01-11 09:30:10 -08:00
Alex Hoppen
7572fb96ee Report secondary cursor info results
rdar://119163908
2024-01-10 21:05:31 -08:00
Alex Hoppen
7f59f6f4f0 Merge pull request #1016 from ahoppen/ahoppen/ignore-trigger-from-incomplete-completions
Ignore `triggerFromIncompleteCompletions` when performing code completion
2024-01-10 20:41:03 -08:00
joehsieh
8dcfb30cdb Add cache to avoid requesting diagnostics from sourcekitd frequently
Move the responsibility of sending requests to get diagnostics from SwiftLanguageServer to DiagnosticReportManager

Make buildSettings as part of the key to the cache

Add ReportTask and refine the code

Reset cache for reportTasks if needed

Finetune the wordings and logics

Solve conflicts

Only remove necessary items from cache

Refine the code
2024-01-11 10:36:37 +09:00
Alex Hoppen
53a07b3b9f Ignore triggerFromIncompleteCompletions when performing code completion
See comment in added test case.

rdar://117711597
2024-01-10 16:12:14 -08:00
Alex Hoppen
d55e2a2b88 Merge pull request #1007 from ahoppen/ahoppen/concurrent-map
Add a `concurrentMap` function to `Collection`
2024-01-10 15:52:39 -08:00
Alex Hoppen
e1612d5003 Merge pull request #1018 from ahoppen/ahoppen/toolchain-registry
Migrate `ToolchainRegistry` to be an actor
2024-01-10 15:28:11 -08:00
Alex Hoppen
e8e4fb2106 Merge pull request #1011 from krzyzanowskim/marcin/fix-array-decoding
Fix decoding Array of LSPAnyCodable
2024-01-09 18:13:26 -08:00
Alex Hoppen
6f342e2b82 Remove static shared toolchain registry
Global state is never a good thing and we needed to modify it in tests. The design becomes a lot cleaner if we explicitly pass the toolchain registry around.
2024-01-09 17:17:31 -08:00
Alex Hoppen
3e73f11de0 Migrate ToolchainRegistry to be an actor 2024-01-09 17:17:31 -08:00
Alex Hoppen
7fb81deb23 Merge pull request #1015 from ahoppen/ahoppen/no-rename-failures
Ensure rename tests don’t fail if running with a sourcekitd that doesn’t support rename yet
2024-01-09 15:18:08 -08:00
Alex Hoppen
ca470335e6 Merge pull request #1008 from ahoppen/ahoppen/skd-array-dictionary-from-literal
Support creation of SKDRequest(Dictionary|Array) from literals
2024-01-09 13:26:00 -08:00
Alex Hoppen
03a122dd23 Ensure rename tests don’t fail if running with a sourcekitd that doesn’t support rename yet
Just another case of making sure that sourcekit-lsp’s tests don’t fail after checking out the repo and running its tests using eg. Xcode 15.1 without an open source toolchain snapshot.
2024-01-09 12:05:21 -08:00
Alex Hoppen
a6fe4848b6 Merge pull request #994 from ahoppen/ahoppen/log-clangd-build-server
Log messages from the build server and clangd
2024-01-08 21:38:28 -08:00
Alex Hoppen
a73d0df77b Add a concurrentMap function to Collection
I find this a lot more intuitive to use than `TaskGroup`.
2024-01-08 18:34:24 -08:00
Alex Hoppen
e0fe9d6aa1 Merge pull request #1012 from krzyzanowskim/marcin/semantictokentypes
Refactor SemanticTokenTypes, SemanticTokenModifiers
2024-01-08 18:14:28 -08:00
Alex Hoppen
3991fae867 Define methods on SourceKitD to create arrays and dictionaries instead of using skd postfix syntax 2024-01-08 18:06:31 -08:00
Alex Hoppen
64d73f4c2c Merge pull request #1013 from krzyzanowskim/marcin/deprecated-serversidefiltering
Add deprecated serverSideFiltering for backward compatibility
2024-01-08 18:05:23 -08:00
Alex Hoppen
73ec32537d Merge pull request #1006 from ahoppen/ahoppen/prepare-rename
Support the prepare rename request
2024-01-08 17:03:47 -08:00
Alex Hoppen
2f80ccae3b Merge pull request #1005 from ahoppen/ahoppen/global-rename-review
Address review comments from #993
2024-01-08 16:25:17 -08:00
Marcin Krzyzanowski
72e28b1a6a Indicate failure if array element can't get decoded 2024-01-08 23:59:07 +01:00
Marcin Krzyzanowski
79ca4c0ac6 Remove redundant typealias 2024-01-08 23:51:09 +01:00
Marcin Krzyzanowski
1e799a8cd3 Document deprecated property 2024-01-08 23:44:11 +01:00
Marcin Krzyzanowski
c7b0a68b4f add deprecated serverSideFiltering for backward compatibility 2023-12-28 00:10:27 +01:00
Marcin Krzyzanowski
0797a361d8 Add files to CMake files 2023-12-27 20:23:44 +01:00
Marcin Krzyzanowski
2c616f7838 Refactor SemanticTokenTypes, SemanticTokenModifiers 2023-12-26 22:55:12 +01:00
Marcin Krzyzanowski
6a369f5754 Fix decoding Array of LSPAnyCodable 2023-12-26 00:51:23 +01:00
Alex Hoppen
f901cc9250 Support creation of SKDRequest(Dictionary|Array) from literals
IMO this makes it a lot clearer which keys are present in the request dictionaries because we are no longer mutating them on the fly.
2023-12-22 22:29:11 -08:00
Alex Hoppen
e4c2a3fe32 Merge pull request #1002 from krzyzanowskim/marcin/missing-initializers-2
More public initializers
2023-12-20 14:13:54 -08:00
Alex Hoppen
527600e977 Support the prepare rename request
This allows us to return the current compound decl name when renaming a function, which will get populated as the default value for the text field in which the user enters the new symbol name.

rdar://118995649
2023-12-20 09:43:26 -08:00
Marcin Krzyzanowski
25a1b4543d Convert SourceKitIndexDelegate to be an actor (#1003) 2023-12-19 13:48:07 -08:00
Alex Hoppen
f88c241714 Refactor multi-file rename tests to specify expected renamed source instead of asserting on edits 2023-12-19 10:54:35 -08:00
Alex Hoppen
bda1387a46 Refactor rename to avoid a force unwrap 2023-12-19 10:54:06 -08:00
Alex Hoppen
b381811710 Merge pull request #1000 from ahoppen/ahoppen/wrap-logging-category 2023-12-18 18:04:12 -08:00
Marcin Krzyzanowski
11d6e55f49 Update formatting 2023-12-16 16:18:11 +01:00
Alex Hoppen
f32e7dd51c Merge pull request #999 from ahoppen/ahoppen/folding-range-improvements
Improve code folding
2023-12-15 07:43:49 -08:00
Alex Hoppen
4f5186e1d2 Merge pull request #997 from krzyzanowskim/marcin/missing-initializer-worskapce-folders 2023-12-14 17:16:23 -08:00