Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected dialog box shown after renaming a binary file #13829

Open
pisv opened this issue Jun 19, 2024 · 2 comments
Open

Unexpected dialog box shown after renaming a binary file #13829

pisv opened this issue Jun 19, 2024 · 2 comments

Comments

@pisv
Copy link
Contributor

pisv commented Jun 19, 2024

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

  • Operating System: macOS Ventura, also confirmed on Windows 11 Pro, both Browser/Electron
  • Theia Version: 1.50, current master
@pisv
Copy link
Contributor Author

pisv commented Jun 19, 2024

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:

} catch (e) {
if (e instanceof TextFileOperationError && e.textFileOperationResult === TextFileOperationResult.FILE_IS_BINARY) {
if (await this.shouldOpenAsText(nls.localize('theia/filesystem/fileResource/binaryTitle', 'The file is either binary or uses an unsupported text encoding.'))) {

@pisv
Copy link
Contributor Author

pisv commented Jun 19, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant