-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Refactor Request
to make it resilience.
#428
base: main
Are you sure you want to change the base?
Conversation
Thanks for the review tips. |
Can you please include the script used to generate |
Sure. |
It seems Circle CI was trying to build target |
Oh, the config file is in version 2 format. |
I realized what's wrong with this PR. It does not contain a config file for Circle CI. |
782383e
to
1fa4d6a
Compare
…ionedExpectedFilename`.
65aa43f
to
05e45a8
Compare
Request
to make it resilience.Request
to make it resilience.
I am not realize #274 has a similar solution until it is closed. I think my current solution for strong typed keys has some room to improve, compareing with solution from @norio-nomura . I'm planning to seperate this PR to several small PRs. The first part will be introduction of a redesigned I will keep this PR open to track what's left to working on. |
Motivation
We can find out some undocumented parameters / requests from SourceKit source code. Since they are not documented, those parameters of request may change over time. It will be great if we can support those parameters and evolve our requests to adjust SourceKit protocol changes over time without break current code. But we can not reach this target in current enum Request model.
Enum case can not overload and do not support default value for its associated values. That means if we add a parameter to a enum item, all projects rely on SourceKittenFramework should add the parameter in their code. That will also be verbose if we have to explicitly set all parameters even when we do not need to set it.
What does this PR do?
Request
a struct. It can also be a class, but not enum. Because enum associated value can not have default value. If we want to add a new parameter for a request, we have to break the API. By makingRequest
a struct (or class), we can add static function which has the same name and parameters of previous enum item to keep the expressionRequest.editorOpen(file: file).send()
works without caller change their code. After this PR, we can add / remove parameters for a request while keep our API unchanged. We need to introduce new static function to expose new parameters and mark old static function deprecated.SourceKitDef.swift
which is generated by Sourcery with data fromProtocolUIDs.def
at$(swift-root)/tools/SourceKit/include/SourceKit/Core/ProtocolUIDs.def
.RequestBuilder
to helpSourceKittenFramework
users to build custom SourceKit request.EditorOpenInterface
,ModuleGroups
andProtocolVersion
three kinds of request.overwrite
to parameter of functioncompareJSONString
to make update fixture easier.