-
Notifications
You must be signed in to change notification settings - Fork 734
feat(amazonq): add button to view diff in IDE #5338
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "type": "Feature", | ||
| "description": "Add buttons to code blocks to view and accept diffs." | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /*! | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| /** | ||
| * Converts an array of key-value pairs into a Map object. | ||
| * | ||
| * @param {[unknown, unknown][]} arr - An array of tuples, where each tuple represents a key-value pair. | ||
| * @returns {Map<unknown, unknown>} A new Map object created from the input array. | ||
| * If the conversion fails, an empty Map is returned. | ||
| * | ||
| * @example | ||
| * const array = [['key1', 'value1'], ['key2', 'value2']]; | ||
| * const map = tryNewMap(array); | ||
| * // map is now a Map object with entries: { 'key1' => 'value1', 'key2' => 'value2' } | ||
| */ | ||
| export function tryNewMap(arr: [unknown, unknown][]) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like it should live in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. amazon/util doesn't look like the place for this. And, the docstring is still way too long and over-explains what could be stated as "tries to create map from x, else returns an empty map". Also that pattern is easily generalized as |
||
| try { | ||
| return new Map(arr) | ||
| } catch (error) { | ||
| return new Map() | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
private readonly uri: ...is typically preferred. But dont bother changing in this PR