gioboa / jira-plugin

Jira plugin for VsCode
https://marketplace.visualstudio.com/items?itemName=gioboa.jira-plugin
MIT License
266 stars 41 forks source link

feat: vscode confirm exit when counting time #125

Closed gustavo-nakabayashi closed 5 years ago

gustavo-nakabayashi commented 5 years ago

Is your feature request related to a problem? Please describe. Closing VSCode when working on an issue throws the time away.

Describe the solution you'd like VSCode asks if you really want to close it with an ongoing timer.

Describe alternatives you've considered When reopening VSCode the time is not lost, it is reloaded in some sort of cache Closing VSCode automatically submits issue time

gioboa commented 5 years ago

Hi @gustavobcampos, if you close VsCode before submit the worklog, there is a mechanism to retrieve the previous working time. Did it works in you scenario? I will check if there is the possibility to prevent VsCode for exit. :+1:

UPDATE

Did you see this behavior in other extensions? If you try to close VsCode with unsaved files a dialog appear and ask to save/close the files, but this dialog under the hood use a private event. :cry:

gustavo-nakabayashi commented 5 years ago

"if you close VsCode before submit the worklog, there is a mechanism to retrieve the previous working time." I tested this and it did not work, when I reopened VSCode no working issue was set, is there a setting that I'm missing?

gioboa commented 5 years ago

No the plugin do it automatically. If we implement the dialog before vscode close we can solve the problem without restore any previous pending worklog. We kill two birds with one stone.:+1:

gioboa commented 5 years ago

I studied VsCode code and all the events (onClose etc. etc.) unfortunately are private and the others dispose methods are call too late. I tested my implementation for retrieve the last not stopped work issue and it works. The plugin every minute, if there is a current working issue started, it write in the private VsCode memory and then at startup resume it. here the code I decided to save every minute for performance reason.

gustavo-nakabayashi commented 5 years ago

I retested the feature that saves time on VSCode close, and it works sometimes, I decreased the time which the plugin saves the working issue, and it worked seemed to help a little, but still bugs sometimes.

I also asked a friend to test on his Notebook and it did not work too. I don't know if it's something related to our SO (we both have Ubuntu 18.04), but when we reopen VSCode the plugin loses track of the previously set project, and not only the issue time.

I would really appreciate if you could fix this, I'm a Product Owner and I am implement this plugin in my company, but I'm afraid that Devs forget to submit the issue before closing VSCode and losing this data.

Thank you very much, this extension is being very helpful for me!

gioboa commented 5 years ago

the plugin loses track of the previously set project, and not only the issue time.

Working project is saved in setting.json file ( under .vscode folder ). When you open a project / folder the plugin read the config from this file and use general settings as fallback. Saving working issue evrey 1 min maybe can be replace with other logics.

UPDATE

There is also another constraint. If the stored working issue is not in current working list, the restore will be rejected. here the code

I decreased the time which the plugin saves the working issue

This timer param is hard coded to 1 min. A dialog notify you a retrieved pending working issue. screen Here an alpha version with timer setted to 5 sec. --- file removed --- Can you test it and give me a feedback? :smile:

gioboa commented 5 years ago

Notice: this issue has been closed because it has been inactive for more than 7 days. You may reopen this issue if it has been closed in error.