Skip to content

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

Merged
Henning Dieterichs (hediet) merged 2 commits into
microsoft:mainfrom
githubnext:inline-edit-finalize-accepting
Mar 7, 2024
Merged

Henning Dieterichs (hediet) merged 2 commits into
microsoft:mainfrom
githubnext:inline-edit-finalize-accepting

Conversation

@Krzysztof-Cieslak

Copy link
Copy Markdown
Contributor

@hediet

Henning Dieterichs (hediet) commented Mar 4, 2024 •

Copy link
Copy Markdown
Member

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
Henning Dieterichs (hediet) enabled auto-merge (squash) March 7, 2024 14:43
@vscodenpa VS Code Bot (vscodenpa) added this to the March 2024 milestone Mar 7, 2024
@hediet
Henning Dieterichs (hediet) merged commit 78f2051 into microsoft:main Mar 7, 2024
@microsoft 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