Skip to content

Add context menu item to open file in your preferred editor in the changes tab - #4030

Merged
niik merged 17 commits into
masterfrom
open-in-your-text-editor
Mar 22, 2018
Merged

niik merged 17 commits into
masterfrom
open-in-your-text-editor

Conversation

@iAmWillShepherd

@iAmWillShepherd iAmWillShepherd commented Feb 16, 2018 •

Copy link
Copy Markdown
Contributor

Fixes issue #4028

Before

2018-02-16_12-08-31 789

After

2018-02-16_12-11-15 254

@iAmWillShepherd iAmWillShepherd added the ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Feb 16, 2018
@tierninho

tierninho commented Feb 16, 2018 •

Copy link
Copy Markdown
Contributor

After testing this, I noticed one small issue:

If I were to look immediately at the context window, the change does not register in the UI (it does register in the back end as the correct editor opens). In this instance, I had changed it to Sublime. Sublime opened as intended, but the UI was lagging and still referenced Atom. Eventually Desktop catches up and there is no issue.

screen shot 2018-02-16 at 1 32 59 pm

1.0.14-beta5

@iAmWillShepherd

iAmWillShepherd commented Feb 16, 2018 •

Copy link
Copy Markdown
Contributor Author

Yep, I was able to reproduce by doing the following:

  1. Open context-menu (Atom is there for me)
  2. Change the External Editor in Preferences (Visual Studio)
  3. Open context-menu (Atom is still there)
  4. Click History tab then go back to Changes tab
  5. Open context-menu (Visual Studio Code correctly displayed)

@nerdneha and I found the following when investigating together:

It seems this is caused by the ChangesList component is not re-rendering the ChangedFile component on state change but it seems to happen after window resize, etc. (so maybe it's not emitting the update right away).

By comparison: RepositoriesList component DOES re-render the RepositoryListItem component on state change. They're hooked up through different sub-components (FilterList vs. List) but it's hard to see how/why they're getting rendered differently.

Any ideas @desktop/core ?

Invalidation props determine whether a list should re-render. Instead of relying on React's automagical updates, adding this key to the invalidationProps object ensures the list is re-rendered as soon as the parent's props change.
@iAmWillShepherd

iAmWillShepherd commented Feb 21, 2018 •

Copy link
Copy Markdown
Contributor Author

@tierninho I just address the issue you mentioned. 🔢

@tierninho

Copy link
Copy Markdown
Contributor

@iAmWillShepherd thanks for the repro steps. I pulled down the latest changes, but it's still behaving the same way for me

@iAmWillShepherd

iAmWillShepherd commented Feb 22, 2018 •

Copy link
Copy Markdown
Contributor Author

@tierninho Here's the behavior I see...

2018-02-22 14 58 58

@agisilaos

Copy link
Copy Markdown
Member

@tierninho Did you run yarn build:dev after pulling the latest changes? That was my case after checking PR's or when I made changes and I couldn't find them applied in the application.

@tierninho

Copy link
Copy Markdown
Contributor

@iAmWillShepherd works for me now

@niik niik self-assigned this Mar 1, 2018
Comment thread app/src/ui/changes/changed-file.tsx Outdated

/**
* Called to open a file using the user's configured applications
* * @param path The path of the file relative to the root of the repository

This comment was marked as spam.

Comment thread app/src/ui/changes/changed-file.tsx Outdated
readonly availableWidth: number
readonly onIgnore: (pattern: string) => void

/** The current external editor's name selected by the user */

This comment was marked as spam.

Comment thread app/src/ui/changes/changes-list.tsx Outdated
const filesDescription = `${fileCount} changed ${filesPlural}`
const anyFilesSelected =
fileCount > 0 && this.includeAllValue !== CheckboxValue.Off
const invalidationProps = {

This comment was marked as spam.

Comment thread app/src/ui/changes/sidebar.tsx Outdated

/**
* Called to open a file using the user's configured applications
* * @param path The path of the file relative to the root of the repository

This comment was marked as spam.

Comment thread app/src/ui/changes/sidebar.tsx Outdated
readonly gitHubUserStore: GitHubUserStore
readonly askForConfirmationOnDiscardChanges: boolean
readonly accounts: ReadonlyArray<Account>
/** The current external editor's name selected by the user */

This comment was marked as spam.

Comment thread app/src/ui/repository.tsx Outdated

/**
* Called to open a file using the user's configured applications
* * @param path The path of the file relative to the root of the repository

This comment was marked as spam.

Comment thread app/src/ui/repository.tsx Outdated
readonly askForConfirmationOnDiscardChanges: boolean
readonly accounts: ReadonlyArray<Account>

/** The current external editor's name selected by the user */

This comment was marked as spam.

Comment thread app/src/ui/changes/changes-list.tsx Outdated
*/
readonly coAuthors: ReadonlyArray<IAuthor>

/** The current external editor's name selected by the user */

This comment was marked as spam.

Comment thread app/src/ui/changes/changes-list.tsx Outdated

/**
* Called to open a file using the user's configured applications
* * @param path The path of the file relative to the root of the repository

This comment was marked as spam.

Comment thread app/src/ui/changes/changed-file.tsx Outdated
readonly externalEditorLabel?: string

/**
* Called to open a file using the user's configured applications

This comment was marked as spam.

@iAmWillShepherd

Copy link
Copy Markdown
Contributor Author

🔢

@niik
niik merged commit e32b3db into master Mar 22, 2018
@niik
niik deleted the open-in-your-text-editor branch March 22, 2018 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants