Commit Graph

7 Commits

Author SHA1 Message Date
Max Desiatov
d6ae933591 6.2: Fix semantic tokens out-of-sync in neovim after changes on disk (#2224)
Cherry-pick of #2223, merged as 45534b0b90
**Explanation**: When neovim detects a change of the document on-disk (eg. caused by git operations). It closes the document and re-opens it with the same document version but different contents. We didn’t clear the swift-syntax tree of a document when it was closed, so we re-used the old syntax tree for the re-opened document. Ensure we clear the syntax tree when the document is closed so we build a new tree when it is re-opened.
**Scope**: Limited to `closeDocument` notification.
**Risk**: Low due to limited scope, additional testing, and small size of the change.
**Testing**: Added an additional automated test case.
**Issue**: rdar://157046766
**Reviewer**: @bnbarham
2025-07-30 05:47:37 -07:00
Alex Hoppen
d8aeeaffe6 Only pass key and not value to LRUCache.removeAll(where:)
The value isn’t needed here and the calls become cleaner if only the key is passed.
2025-04-23 18:54:45 +02:00
Matthew Bastien
2ae2e709b3 add LRUCache struct to SKUtilities 2025-04-17 13:46:01 -04:00
Alex Hoppen
90c124c369 Expand trailing closures of code completion items
Editors other than Xcode don’t have a notion of editor placeholders or their expansion, so we can’t produce results with editor placeholders and expect the user to expand them while completing the function arguments.

Instead, expand all trailing closure placeholders when producing the code completion results.

The generated expansion is currently not formatted with respect to the file’s indentaiton. Since we don’t want to launch `swift-format` for every completion item, this formatting will need to be done using `BasicFormat` which needs to infer the file’s indentation. Doing so will be non-trivial work on its own and will be done in a follow-up PR.

rdar://121130170
2024-02-24 17:58:32 -08:00
Dmitrii Valuev
eae3d0ae0e Fix parseIncrementally API incompatible changes 2023-10-12 17:18:26 +03:00
Alex Hoppen
d0fc00ce98 Format using swift-format
Add `.swift-format` to the repo and format the repo with `swift-format`.

This commit does not add any automation to enforce formatting of sourcekit-lsp in CI. The goal of this commit is to get the majority of source changes out of the way so that the diff of actually enforcing formatting will have fewer changes or conflicts.
2023-10-10 13:44:47 -07:00
Alex Hoppen
88cd743b79 Introduce SyntaxTreeManager that keeps track of the SwiftSyntax trees for documents
This allows us to use Swift concurrency to await the computation of the SwiftSyntax tree for a given document instead of having to poll for its creation.
2023-10-06 14:25:06 -07:00