-
Notifications
You must be signed in to change notification settings - Fork 46.4k
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
Feat:-Added open in editor to appear by default #26949
Merged
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
81ecab9
Added open in editor to appear by default
Biki-das a883d43
Changed default option to Vscode
Biki-das f9c745b
Url path suggestion
Biki-das cf2b03e
Removed useEffect and UI changes
Biki-das fbf83da
Added margin and tests initialised
58e2099
Added process.env
023c766
Prettier
7c361a4
Tests updated
34114ca
Revert test changes
Biki-das de9e2c4
Moved the vs file path above the function
Biki-das File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Removed useEffect and UI changes
- Loading branch information
commit cf2b03e32f7e7f4ed8fff94eddbc5ec7bea4f33e
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
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -88,21 +88,13 @@ export default function ComponentsSettings(_: {}): React.Node { | |||||||||
|
||||||||||
const [openInEditorURLPreset, setOpenInEditorURLPreset] = useLocalStorage< | ||||||||||
'vscode' | 'custom', | ||||||||||
>(LOCAL_STORAGE_OPEN_IN_EDITOR_URL_PRESET, 'vscode'); | ||||||||||
>(LOCAL_STORAGE_OPEN_IN_EDITOR_URL_PRESET, 'custom'); | ||||||||||
|
||||||||||
const [openInEditorURL, setOpenInEditorURL] = useLocalStorage<string>( | ||||||||||
LOCAL_STORAGE_OPEN_IN_EDITOR_URL, | ||||||||||
getDefaultOpenInEditorURL(), | ||||||||||
); | ||||||||||
|
||||||||||
useEffect(() => { | ||||||||||
if (openInEditorURLPreset === 'vscode') { | ||||||||||
setOpenInEditorURL('vscode://file/{path}:{line}'); | ||||||||||
} else { | ||||||||||
setOpenInEditorURL('custom link'); | ||||||||||
} | ||||||||||
}, [openInEditorURLPreset, setOpenInEditorURL]); | ||||||||||
|
||||||||||
const [componentFilters, setComponentFilters] = useState< | ||||||||||
Array<ComponentFilter>, | ||||||||||
>(() => [...store.componentFilters]); | ||||||||||
|
@@ -298,21 +290,31 @@ export default function ComponentsSettings(_: {}): React.Node { | |||||||||
<select | ||||||||||
className={styles.Select} | ||||||||||
value={openInEditorURLPreset} | ||||||||||
onChange={({currentTarget}) => | ||||||||||
setOpenInEditorURLPreset(currentTarget.value) | ||||||||||
}> | ||||||||||
onChange={({currentTarget}) => { | ||||||||||
const selectedValue = currentTarget.value; | ||||||||||
setOpenInEditorURLPreset(selectedValue); | ||||||||||
if (selectedValue === 'vscode') { | ||||||||||
setOpenInEditorURL('vscode://file/{path}:{line}'); | ||||||||||
} else if (selectedValue === 'custom') { | ||||||||||
setOpenInEditorURL(''); | ||||||||||
} | ||||||||||
}}> | ||||||||||
<option value="vscode">VS Code</option> | ||||||||||
<option value="custom">Custom</option> | ||||||||||
</select> | ||||||||||
<input | ||||||||||
className={styles.Input} | ||||||||||
type="text" | ||||||||||
placeholder={process.env.EDITOR_URL ?? 'vscode://file/{path}:{line}'} | ||||||||||
value={openInEditorURL} | ||||||||||
onChange={event => { | ||||||||||
setOpenInEditorURL(event.target.value); | ||||||||||
}} | ||||||||||
/> | ||||||||||
{openInEditorURLPreset === 'custom' && ( | ||||||||||
<input | ||||||||||
className={styles.Input} | ||||||||||
type="text" | ||||||||||
placeholder={ | ||||||||||
process.env.EDITOR_URL ? 'vscode://file/{path}:{line}' : '' | ||||||||||
} | ||||||||||
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.
Suggested change
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. Or |
||||||||||
value={openInEditorURL} | ||||||||||
onChange={event => { | ||||||||||
setOpenInEditorURL(event.target.value); | ||||||||||
}} | ||||||||||
/> | ||||||||||
)} | ||||||||||
</label> | ||||||||||
|
||||||||||
<div className={styles.Header}>Hide components where...</div> | ||||||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can you please move 'vscode://file/{path}:{line}' to a constant somewhere at the top?