Skip to content
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

File / folder history support #305

Closed
Yanpas opened this issue Jul 26, 2018 · 15 comments
Closed

File / folder history support #305

Yanpas opened this issue Jul 26, 2018 · 15 comments

Comments

@Yanpas
Copy link
Contributor

Yanpas commented Jul 26, 2018

There is git history extension. It would be nice to have something similar for SVN.
I see it as HTML page with list of revisions with messages and dates. After clicking on list item you can see files changed and diff each file with previous revision or open it.
image

Alternatively it may be implmented as a second list-view in VCS pane . Mad skillz :D
image

@JohnstonCode
Copy link
Owner

@Yanpas I think implementing it in a list-view would get cramped. It would be a lot of work to implement it. I am currently working on the list-view stuff for incoming changes.

It can be added the pile of features requested. Not sure when/if it will ever be done tho.

@Yanpas
Copy link
Contributor Author

Yanpas commented Jul 26, 2018

I don't have expirience in web and currently don't have much time. Maybe I'll open PR later.

GitHistory is implemented using react (jsx + tsx), not sure if we need react as a dependency, may be plain html will be enough.

@JohnstonCode
Copy link
Owner

Yeah, time is always an issue. Think the use of React is to ease the burden of all the events it has to manage.

@Yanpas
Copy link
Contributor Author

Yanpas commented Aug 10, 2018

@JohnstonCode , I've started implementing this feature in my branch https://github.com/Yanpas/svn-scm/tree/history

Currently I'm facing this issue. All svn-functions are async and called after events occurence from the event-loop. Message-passing between webview and extension process is done by onDidReceiveMessage and postMessage. The first one receives a callback as an argument and calls it each time there is a new message.
The execution of my async-callback stops after first await. How can I deal with it? Is there a way to push my Promise to global event-loop? I've only found dispatchEvent function, but I'm not sure if it is available in extension's process and deals with Promises.

@JohnstonCode
Copy link
Owner

@Yanpas can you give me some idea of what you are trying to do so i can better assist you? Like an example of a problem you are trying to solve.

@Yanpas
Copy link
Contributor Author

Yanpas commented Aug 10, 2018

I'm implementing a webview similar to "Git history" one. This view and extension may be represented as a web frontend and backend. The frontend needs to obtain the history of commits to display it and to obtain details of each commit. Now I am trying to send a list of commits to the webview. I may send it all at once, but it may be too expensive, so there should be some paging.

@Yanpas
Copy link
Contributor Author

Yanpas commented Aug 10, 2018

After searching across github repositories I found only one soultion: executeCommand. This command should be private (not available in command palette). 🤔

@edgardmessias
Copy link
Contributor

@edgardmessias
Copy link
Contributor

VSCode to Webview: webview.postMessage({ command: 'xxxx' }) -> window.addEventListener('message', event => {})

Webview to VSCode: acquireVsCodeApi().postMessage({command: 'yyyy'}) -> webview.onDidReceiveMessage(message => {})

@Yanpas
Copy link
Contributor Author

Yanpas commented Aug 10, 2018

Thanks for assistance! My question was how to pass async callback to onDidReceiveMessage. Instead of async callback , I call executeCommand inside callback which solved my problem.

@edgardmessias
Copy link
Contributor

Two way. Like:
In VSCode:

webview.onDidReceiveMessage(message => {
  asyncTask.then(result =>  {
    webview.postMessage({ command: 'xxxx', result: result })
  })
})

In webview use only the window.addEventListener

@Yanpas
Copy link
Contributor Author

Yanpas commented Aug 10, 2018

then just returns new Promise, which won't be resolved in the event loop. AFAIK await is just syntatic sugar around Promise.

@Yanpas
Copy link
Contributor Author

Yanpas commented Oct 26, 2018

I was using gitlens for some time and it feels much more handy than git-history extension. I think I'll start over with something similar.

@JohnstonCode
Copy link
Owner

@Yanpas can this be closed now?

@Yanpas
Copy link
Contributor Author

Yanpas commented Dec 21, 2018

Yep

@Yanpas Yanpas closed this as completed Dec 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants