-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Depends on #1940 ## Checklist - [x] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [-] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [-] I have not broken the cheatsheet
- Loading branch information
Showing
32 changed files
with
1,113 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Disposable } from "../ide/types/ide.types"; | ||
|
||
/** | ||
* Construct a disposable that disposes multiple disposables at once. This is | ||
* useful for managing the lifetime of multiple disposables that are created | ||
* together. It ensures that if one of the disposables throws an error during | ||
* disposal, the rest of the disposables will still be disposed. | ||
*/ | ||
export function disposableFrom(...disposables: Disposable[]): Disposable { | ||
return { | ||
dispose(): void { | ||
disposables.forEach(({ dispose }) => { | ||
try { | ||
dispose(); | ||
} catch (e) { | ||
// just log, but don't throw; some of the VSCode disposables misbehave, | ||
// and we don't want that to prevent us from disposing the rest of the | ||
// disposables | ||
console.error(e); | ||
} | ||
}); | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.