# code/editor/edit-session (zidane-ui/code/editor)

Import: `import { … } from 'zidane-ui/code/editor'`. Source: [ui/src/code/editor/edit-session.ts](https://github.com/Tahul/zidane/blob/main/ui/src/code/editor/edit-session.ts).

## Functions

### `editSessionKey`

Function.

The retained-session key of one draft generation of a file.

```ts
function editSessionKey(cwd: string, path: string, generation: number): string
```

**Parameters**

- `cwd` (`string`): The folder.
- `path` (`string`): The file, relative to it.
- `generation` (`number`): Bumped whenever the path's draft is reset.

**Returns** `string`

Source: [ui/src/code/editor/edit-session.ts:20](https://github.com/Tahul/zidane/blob/main/ui/src/code/editor/edit-session.ts#L20)

### `forgetEditSession`

Function.

Drop a retained session. Safe to call while it is still active: the clear is deferred until it is dormant.

```ts
function forgetEditSession(key: string): void
```

**Parameters**

- `key` (`string`): Its key ([`editSessionKey`](https://zidane.si/docs/reference/ui-code-editor-edit-session.md#editSessionKey)).

Source: [ui/src/code/editor/edit-session.ts:29](https://github.com/Tahul/zidane/blob/main/ui/src/code/editor/edit-session.ts#L29)
