zabel-xyz / local-history

local-history for vscode
MIT License
228 stars 36 forks source link

Unable to restore when local-history.path is set outside workspace with absolute #85

Open michaellopez opened 5 years ago

michaellopez commented 5 years ago

Hi,

Thanks for the extension. It has saved me more than once.

I am currently trying to save the history in my home folder (like many others #43 #80). They all seem happy with it. I am too, except that I cannot use the "Restore" option. I get the following error whenever I right-click in the tree and click "Restore"

image

As you can see, the final path for the file is missing the leading /. I tracked it down to https://github.com/zabel-xyz/local-history/blob/master/src/history.controller.ts#L420 that returns a path without the leading /. So either we need to use an approach like p.dir.replace(settings.historyPath, '') or set root = '/' here

I'll gladly send PR if I can receive guidance on how to solve the problem.

My settings are:

  "local-history.dateLocale": "sv-SE",
  "local-history.absolute": true,
  "local-history.maxDisplay": 20,
  "local-history.path": "/Users/michael/.vscode-history",
  "local-history.saveDelay": 5,
  "local-history.treeLocation": "localHistory",
zabel-xyz commented 5 years ago

I am doing some fixes in restore features, so I'll test with your exemple...

michaellopez commented 5 years ago

@zabel-xyz great, let me know if I can help

liangjiancang commented 4 years ago

Same problem. I think you should offer an option:

@zabel-xyz

ctf0 commented 4 years ago

have same issue but without the absolute option + i cant view any file history in the tree panel

i think atm it checks for bath, and if yes it doesnt save under the workspace anymore.

willzhqiang commented 4 years ago

Even with the latest version, the bug still exists. Please have a look at this bug, @zabel-xyz .