Open stephencelis opened 9 months ago
/cc @xedin
Please let me know if I'm missing something in the project's result builder that could address these usability issues.
This seems to be an order of operation of builder type checking vs. macro expansion. If I explicitly add : Reducer
(in addition to the @Reducer
macro) this restores the above action:
autocomplete and others, though there are complex situations, like Reduce { state, action in … }
blocks in which state.
and switch action { case .
do not autocomplete till generics are qualified, e.g., Reduce<State, Action> { state, action in
Description
I have a project with a decently complex builder that works with objects that can be configured with key paths but am finding that only the first builder expression can autocomplete correctly. In general autocomplete is struggling with these expressions.
Steps to reproduce
Clone https://github.com/pointfreeco/swift-composable-architecture
Check out the
case-key-paths
branch (HEAD at63ed79606882de385e22afcdf847e46277142b07
at the time of submitting this issue)Open ComposableArchitecture.xcworkspace
Select "CaseStudies (SwiftUI)" build scheme
Build
Navigate to https://github.com/pointfreeco/swift-composable-architecture/blob/63ed79606882de385e22afcdf847e46277142b07/Examples/CaseStudies/SwiftUICaseStudies/01-GettingStarted-Composition-TwoCounters.swift#L25
Autocomplete
action: \.
from line 25, note:Autocomplete
action: \.
from line 28, note:Bonus bug:
Autocomplete
state: \.
from either and neither completes correctly:Scope
has two initializer overloads ofstate:
for two different kinds of key paths, butState
only qualifies for one in this case, yet it's choosing the wrong overload to complete from.Expected behavior
I expect autocomplete to work.
Environment