jmrog / vscode-nuget-package-manager

An extension for Visual Studio Code that lets you easily add or remove .NET Core 1.1+ package references to/from your project's .csproj file using Code's Command Palette.
MIT License
34 stars 17 forks source link

Use extensions API to update open .csproj files #4

Closed jmrog closed 6 years ago

jmrog commented 7 years ago

Right now, the extension writes to the .csproj file and, if it is currently open in the editor, leaves it to the editor itself to refresh and reflect the changes. This seems to happen sometimes, but not other times (sometimes the editor does not reflect the file changes). It is probably more correct, and also more reliable, to use some aspect of the vscode workspace API to either apply edits or insure that the editor refreshes.

jmrog commented 7 years ago

Note this bit from the API documentation:

The workspace offers support for listening to fs events and for finding files. Both perform well and run outside the editor-process so that they should be always used instead of nodejs-equivalents.

Marking as a bug due to the final clause there.

jmrog commented 7 years ago

Actually, there appears to be no method provided in the VS Code extensions API to refresh an open file. See the issue here: https://github.com/Microsoft/vscode/issues/7532

Removing "bug" label for this reason.

jmrog commented 7 years ago

It also appears to turn out that the editor is supposed to refresh (after a small delay) in response to filesystem changes. Apparently there are a few cases where it does not, and these are bugs. A few such cases are mentioned here: https://github.com/Microsoft/vscode/issues/22266

Marking as blocked for now; will revisit later.

jmrog commented 6 years ago

Closing due to the fact that Microsoft/vscode#22266 is now closed. The update should now happen automatically.