vscode: Editor hover does not use reference file encoding until it is opened at least once

  • VSCode Version: 1.46.1
  • OS Version: macOS 10.15.5

Steps to Reproduce:

Update: Following is reproduction with TypeScript for the sake of minimal setup. But I can confirm that it is at least also reproducible with PHP and Intelephense. My assumption is - it is reproducible regardless of the language.

  1. Create empty directory
  2. Open it in VSCode and configure your workspace settings like so (this will ensure that VSCode has to be certain about the encoding of the files):
{
  "files.encoding": "windows1251",
  "files.autoGuessEncoding": false
}
  1. Create 2 files with windows-1251 encoding (you can do it through VSCode, doesn’t matter)
// foo.ts

/**
 * Возвращает фуу
 */
export function foo(): string {
  return "foo";
}
// test.ts

import { foo } from "./foo";

foo();
  1. Close both files/editors (this is important!)
  2. Close VSCode
  3. Open VSCode
  4. Open test.ts
  5. Hover over foo()
  6. Observe encoding issues
  7. Open foo.ts (I assume at this step it actually checks encoding of the file and that’s why it starts working)
  8. Go back to test.ts
  9. Hover over foo()
  10. Observe correctly rendered text

Does this issue occur when all extensions are disabled?: Yes

Screenshot 2020-06-25 at 10 05 09

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 15 (12 by maintainers)

Most upvoted comments

When deciding to implement features / fix bugs, we consider:

  • What is the impact?

  • How many people are impacted?

    Unknown but likely not very many since we have not see prior issues?

  • How difficult would it be to fix?

    It seems very difficult to fix.

  • How difficult is the current workaround?

    Switch to unicode. Some workflows may require different encodings, but again we have not seen a large number of people reporting this problem so I’m not sure how many workflows have this issue