Skip to content

Conversation

@Krzysztof-Cieslak
Copy link
Contributor

CC: @hediet

@hediet
Copy link
Member

hediet commented Mar 4, 2024

isAccepting is not a very clear concept, I also don't like that much that it is used as signal to re-fetch the data.
It basically adds a functional dependency where there shouldn't be one.

I think it would be cleaner if accepting the edit would transfer ownership of the command-reference from the inline completion controller to the async accept method (which is then disposed when the accept method finishes).
This could be implemented using ref-counting. Maybe there is even a utility RefCounted for that:

class RefCounted<T : IDisposable> : IDisposable {
  /** Takes over ownership of `value` */
  constructor(public readonly value: T) {}

  /** Creates a new reference to the data. */
  clone(): RefCounted<T> { ... }

  /** Disposes this reference. If it is the last reference, disposes the value. */
  dispose(): void {}
}
@hediet hediet enabled auto-merge (squash) March 7, 2024 14:43
@vscodenpa vscodenpa added this to the March 2024 milestone Mar 7, 2024
@hediet hediet merged commit 78f2051 into microsoft:main Mar 7, 2024
@microsoft microsoft locked and limited conversation to collaborators Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

4 participants