Commit Graph

391 Commits

Author SHA1 Message Date
Alex Hoppen
fbb77c6ce4 Don’t report empty folding ranges 2023-12-13 16:38:08 -08:00
Alex Hoppen
2bae1f0d75 Improve folding of calls that span multiple lines 2023-12-13 16:34:07 -08:00
Alex Hoppen
796138be5e Support folding of switch cases 2023-12-13 16:14:04 -08:00
Alex Hoppen
cc4cfac73b Support folding of collection literals 2023-12-13 16:10:14 -08:00
Alex Hoppen
fc3c51989f Consider trivia symetrically when folding braced blocks 2023-12-13 16:05:38 -08:00
Alex Hoppen
c8b2f76adc Move FoldingRange to its own file
No code change here.
2023-12-13 16:00:35 -08:00
Alex Hoppen
d931806c69 Merge pull request #988 from z2oh/configure-workspace-type
Allow configuring workspace type via flag
2023-12-12 10:50:52 -08:00
Alex Hoppen
ce9fdf9258 Merge pull request #990 from ahoppen/ahoppen/rename
Implement local rename within the current file
2023-12-11 19:39:35 -08:00
Jeremy Day
c31417ac92 Fix formatting 2023-12-11 14:05:04 -08:00
Alex Hoppen
6b5842f0a2 Send source text for find-syntactic-rename-ranges 2023-12-09 08:35:14 -08:00
Alex Hoppen
777f1dc463 Add support for rename within the current file
rdar://117822427
2023-12-09 08:35:13 -08:00
Alex Hoppen
8857a08940 Parse information from related identiers that is needed to perform local rename 2023-12-09 08:34:41 -08:00
Alex Hoppen
8acc5bd999 Factor related identifiers request into a separate file
This allows use to re-use related identifiers when implementing rename
2023-12-09 08:34:40 -08:00
Jeremy Day
c006421667 Switch to more descriptive case names 2023-12-08 15:23:03 -08:00
Jeremy Day
3278ff0612 Enable per-workspace configuration of default workspace type 2023-12-08 11:06:11 -08:00
Alex Hoppen
96905aaf16 Add a request to get all tests within a file 2023-12-06 17:40:21 -08:00
Alex Hoppen
446f9280da Add a request to list all the tests within the current workspace
Fixes #611
rdar://98710526
2023-12-06 17:40:21 -08:00
Alex Hoppen
17eca18f47 Merge pull request #989 from ahoppen/ahoppen/dont-use-local-loc-for-c-definition
Don’t use the best local declaration when jumping to definition of a C function
2023-12-06 17:38:58 -08:00
Alex Hoppen
2d01d5d146 Merge pull request #983 from ahoppen/ahoppen/parameter-highlighting
Add semantic highlighting for function parameter labels
2023-12-06 14:25:24 -08:00
Alex Hoppen
4077ce360d Don’t use the best local declaration when jumping to definition of a C function
For non-Swift symbols, we need to perform an index lookup because the best local declaration will point to a header file but jump-to-definition should prefer the implementation (there's the declaration request to jump to the function's declaration).

rdar://119243893
2023-12-06 11:08:44 -08:00
Jeremy Day
cafc63ea98 Add --workspace-type flag 2023-12-06 10:29:19 -08:00
Alex Hoppen
742455833b Add semantic highlighting for function parameter labels 2023-12-06 10:02:39 -08:00
Alex Hoppen
ed410e6503 Merge pull request #977 from ahoppen/ahoppen/jump-to-override
Show overriden functions when performing jump-to-definition on a dynamic call
2023-12-05 16:18:46 -08:00
Alex Hoppen
f293741dca Merge pull request #981 from ahoppen/ahoppen/never-error-for-diagnostics-request
Never return error for diagnostics request
2023-12-05 10:03:45 -08:00
Alex Hoppen
c7bd8c9e8f Consider all symbol replies from clangd dynamic 2023-12-04 18:49:36 -08:00
Marcin Krzyzanowski
b7cc49bcfa Decode RegistrationOptions (#980) 2023-11-30 00:46:03 -08:00
Alex Hoppen
84fdea9e05 Filter overrides in DefinitionRequest by receiver types 2023-11-29 09:03:36 -08:00
Alex Hoppen
1ffa825b3f Remove extractIndexedOccurences
`extractIndexedOccurences` mostly dealt with how to create a fallback value and we didn’t support fallback values in 3/4 cases. Remove it, simplifying the callers of `extractIndexedOccurances` along the way.
2023-11-29 09:02:19 -08:00
Alex Hoppen
4052465905 Show overriden functions when performing jump-to-definition on a dynamic call
Fixes #809
rdar://114864256
2023-11-29 09:02:02 -08:00
Alex Hoppen
49d4db32d3 Merge pull request #974 from ahoppen/ahoppen/build-settings-for-workspace-folder
Add support for different arguments per workspace
2023-11-28 18:57:40 -08:00
Alex Hoppen
33f4612243 Add support for different arguments per workspace
Fixes #663
rdar://101815704
2023-11-28 11:19:09 -08:00
Alex Hoppen
4c8aea29c3 Never return error for diagnostics request
VS Code does not request diagnostics again for a document if the diagnostics request failed. Since sourcekit-lsp usually recovers from failures (e.g. after sourcekitd crashes), this is undesirable. Instead of returning an error, return empty results.
2023-11-27 19:39:22 -08:00
Alex Hoppen
b85f3afc10 Report MARK comments in the document symbols request
Fixes #963
rdar://117811210
2023-11-27 15:55:50 -08:00
Alex Hoppen
9595498dae Don’t include local variables in document symbols
Fixes #962
rdar://117810784
2023-11-27 15:38:36 -08:00
Alex Hoppen
e6cf72317d Merge pull request #975 from ahoppen/ahoppen/normalize-identifier-start
Support cursor info-based requests when cursor is placed at the end of an identifier
2023-11-27 15:36:19 -08:00
Alex Hoppen
9aee36b0ee Merge pull request #972 from ahoppen/ahoppen/cancel-on-subsequent-request
Don't cancel cursor info and related identifiers requests on subsequent requests
2023-11-27 14:04:43 -08:00
Alex Hoppen
f5e26e4b95 Support cursor info-based requests when cursor is placed at the end of an identifier
VS Code considers the position after an identifier as part of an identifier. Ie. if you have `let foo| = 1`, then it considers the cursor to be positioned at the identifier. This scenario is hit, when selecting an identifier by double-clicking it and then eg. performing jump-to-definition. In that case VS Code will send the position after the identifier.
`sourcekitd`, on the other hand, does not consider the position after the identifier as part of the identifier.
To bridge the gap here, normalize any positions inside, or directly after, an identifier to the identifier's start.

Fixes #820
rdar://115557453
2023-11-23 20:22:05 -08:00
Alex Hoppen
2aedb85a1f Don't cancel cursor info and related identifiers requests on subsequent requests
SourceKit-LSP supports explicit cancellation and thus we don’t need to do the implicit cancellation of cursor info and related identifiers on subsequent requests.
2023-11-21 17:45:10 -08:00
Alex Hoppen
d2e79c8128 Add @retroactive annotations 2023-11-21 17:40:17 -08:00
joehsieh
a095810af8 Implement an initializer of CodeAction with the FixIt from swift-syntax
Finetune the code

Finetune the code

Finetune the code

Update the code per comments

Use location marker instead of hard coded indexes

Update the test to align the code convention

Rename a variable

Correct unit tests

Format the code

Update Package.swift
2023-11-08 18:09:38 +09:00
Saleem Abdulrasool
8f53d08b50 build: correct dependencies
The changes in #945 changed the dependencies but did not correct them in
the CMakeLists.txt resulting in a broken build.  Resynchronise the
dependencies across Package.swift and CMake.
2023-11-01 11:12:08 -07:00
Alex Hoppen
3ba15e1997 Merge pull request #955 from ahoppen/ahoppen/format
Format sources with swift-format
2023-10-31 21:48:03 -07:00
Alex Hoppen
ac3eb32e65 Format sources with swift-format 2023-10-31 19:30:31 -07:00
Alex Hoppen
d4f304ebcc Uppercase first letter of diagnostics
sourcekitd returns diagnostics with the first letter lowercase. Xcode, for example, shows the messages with the first letter uppercases. I think that looks nicer and we should also uppercase the first letter in sourcekit-lsp.
2023-10-31 19:28:04 -07:00
Alex Hoppen
e0173c8740 Merge pull request #956 from ahoppen/ahoppen/dont-log-error-for-unknown-notifications
Reduce logging level for unknown notifications or requests
2023-10-31 17:05:43 -07:00
Alex Hoppen
9a87691853 Merge pull request #945 from ahoppen/ahoppen/language-server-protocol-dependency-free
Make the `LanguageServerProtocol` module dependency-free
2023-10-31 16:02:50 -07:00
Alex Hoppen
9919d038ee Merge pull request #947 from ahoppen/ahoppen/skip-semantic-tokens-tests
Skip semantic tokens tests if sourcekitd doesn't support the semantic tokens request
2023-10-31 15:09:27 -07:00
Alex Hoppen
aa70fc0e8d Make the LanguageServerProtocol module dependency-free
Shuffle a few types around so that the `LanguageServerProtocol` has no more dependencies.

Fixes #938
rdar://117565087
2023-10-31 13:22:38 -07:00
Alex Hoppen
35c52c7590 Allow creation of TaskMetadata for all known notification and request types
Previously, we would sometimes log errors for example for the `setTrace` notification sent by VS Code. To avoid those logs, add cases for all known requests and notifications to the `TaskMetadata` initializers.
2023-10-31 09:12:24 -07:00
Alex Hoppen
1a23153fd5 When sourcekitd crashes, log the file contents with which it crashed and the request
This should make it a lot easier to reproduce sourcekitd crashes.
2023-10-31 08:30:54 -07:00