alefragnani / vscode-read-only-indicator

Read-Only Indicator Extension for Visual Studio Code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] - Indicator fails to refresh to RW after Overwrite command

JohnLukeBentley opened this issue · comments

Great extension! I've just downloaded it and it mostly works beyond expecations (in that it not only indicates but also sets). The bug ....

Steps to reproduce

  • In Visual Studio Code set a file to [RO]
  • Edit file.
  • Attemp to save. As expected we get a messagebox: "Failed to save ... [Overwrite] [Save As ...] [Discard]"
  • Click on [Overwrite]
  • In Windows Explorer > Right Click on File > Properties ... > General > Read-only. Observe the flag is cleared (as expected)
  • In Visual Studio Code observe the Read-Only Indicator is [RO]. It should be [RW]. Switching to another file and back to the original refreshes the Read-Only Indicator, and it now reads [RW].

Probable fix: Fire a refresh command after an [Overwrite] Click.

Environment

  • Extension version: 3.4.0
  • VSCode version: 1.50.1
  • OS version: Windows 10 (Windows_NT x64 10.0.19041)

Edit 01: "refresh even" to "refresh command".

Hi @JohnLukeBentley ,

Thank you, I'm glad you like the extension 👍.

About the issue, I wouldn't say it's a bug, as the extension's readme describes that the status is updated only when you open a file. But it also don't say it updates when you switch files, so... But I totally agree that Overwriting the file as you described, could update the status as well, just like the extension's commands.

I'm not sure there is an API for the overwrite option, but I remember seeing something fired AfterSaving, and it would work as well.

Thanks for reporting/suggesting

Certainly if you had in mind when you wrote ...

It adds an area in the status bar, indicating if the file is read-only or writeable. It will be automatically updated, every time you open any file.

... that the status indicator only updates on open file then, yes, it's working as you expect and not a bug in that sense.

In any case I'm glad you value the report. I'm not accross the API to make a specific suggestion but if it has an AfterSaving event, as you suggest, that does sound promising.

Good luck!