posit-dev / posit-dev/positron

Prompt to confirm shutdown or restart when workspace is dirty

Open
#649 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: core
Dominant language
TypeScript
Stars
4.3k
Forks
184
Avg merge
1d 9h
Merged PRs (30d)
195

Description

Shutting down a language runtime is a destructive operation; you lose anything in your environment you haven't saved, as well as any UI that can't survive without a backend (resizable plots, data viewers, etc). However, this operation has no confirmation and also can't be undone, so it's too easy to lose data as things stand today.

There are a few ways we could address this.

  • Always prompt for confirmation before shutting down.
  • Require language runtimes to supply a method that can be used to determine whether the workspace contains unsaved changes. When the user requests shutdown, call this method; without unsaved changes, proceed to shut down; with them, prompt to shut down.
  • As above, but require the language runtime to supply richer data and/or a message to present to the user instead of a boolean dirty/not dirty flag.
  • Add a onShutdownRequested method to language runtimes that gives them a hook to handle shutdown requests before an actual shutdown happens.
  • Do nothing at the Positron level; let language runtimes themselves decide what to do with a shutdown request. The shutdown() method is async, so they can prompt the user if they want to and remain in full control over the experience (so long as they only use the extension API)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the shutdown() method and extension API references mentioned in the issue, then compare the proposed runtime hooks and dirty-state approaches. The issue has no selected approach, named files, tests, or acceptance criteria, so a maintainer decision is needed before a newcomer can identify a concrete implementation or definition of done.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend-api-design, developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.