Skip to content

Inline Edit - make sure we finalize accepting before requesting new edit #206525

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

Merged
merged 2 commits into from
Mar 7, 2024

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants