Skip to content

Tabs get replaced by four spaces in IntelliSense quick info box (for JSDoc comments in JavaScript and TypeScript) #2209

@vscode-triage-bot

Description

@vscode-triage-bot
  • VSCode Version: 1.43.2
  • OS Version: Windows 10 Pro

Steps to Reproduce:

  1. In a JavaScript file paste the following code:
    /**
     * ```
     * 1234567890
     * 		90
     * 123	890
     * ```
     */
    function bar() {}
    Note that there are three tabs in the code.
  2. Hover over bar() and have a closer look at the displayed IntelliSense quick info tooltip. Each tab, either at the beginning or in the middle of a line, has been replaced by four spaces. There is a surplus space at the beginning of the second line in the text displayed in the quick info box. This is due to a whitespace bug in TypeScript's JSDoc parser. I have fixed this bug. If you use my TypeScript version the surplus space is gone.

I have reported this bug previously in combination with the whitespace bugs from TypeScript. The issue got moved to the TypeScript repo. However, this time I made sure this is a VS Code bug. I'll explain how to verify it.

By modifying the file extensions/typescript-language-features/src/features/hover.ts you can add a debug output to the quickinfo tooltip, which displays the text returned by TypeScript's quickinfo command. For the above example, it will display the second line of the following as output:

                        ┌─┬──────────┬─ TypeScript preserved the tabs
"```\r\n1234567890\r\n \t\t90\r\n123\t890\r\n```"
                      └─ this is the surplus space from the mentioned TypeScript bug,
                         which will be missing, if you use my fix

As you can see TypeScript preserved the tabs. The replacement must take place somewhere in the VS Code code.

The expected behavior would be, of course, that tabs are preserved and set to a width of four (like in VS Code's Markdown preview).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions