eclipse-theia / theia

Eclipse Theia is a cloud & desktop IDE framework implemented in TypeScript.
http://theia-ide.org
Eclipse Public License 2.0
19.29k stars 2.45k forks source link

Unexpected dialog box shown after renaming a binary file #13829

Open pisv opened 2 weeks ago

pisv commented 2 weeks ago

Bug Description:

After a binary file is renamed, a dialog box 'The file is either binary or uses an unsupported text encoding' appears out of the blue, if typescript-language-features is active:

Screenshot

Steps to Reproduce:

  1. Make sure that typescript-language-features is active, e.g. by opening a .ts file.
  2. Rename a binary file in Theia, such as a .jpg file.

The dialog box is opened immediately after the file is successfully renamed. Nothing happens after choosing either 'Yes' or 'No' in the dialog.

Additional Information

pisv commented 2 weeks ago

After the file is renamed, vscode.workspace.openTextDocument is called as a result of a call to UpdateImportsOnFileRenameHandler.getJsTsFileBeingMoved in typescript-language-features.

This eventually triggers the following code in Theia, which shows the dialog box:

https://github.com/eclipse-theia/theia/blob/d6be64bba4c048f9bc75f9ccdd4880585902086a/packages/filesystem/src/browser/file-resource.ts#L185-L187

pisv commented 2 weeks ago

In VS Code, the call to vscode.workspace.openTextDocument just throws an error in this case.