microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
101.08k stars 12.49k forks source link

`completionInfo` command ignoring whitespace generating suggestions #54600

Open timursaurus opened 1 year ago

timursaurus commented 1 year ago

Bug Report

Found while fixing VSCode suggestions: https://github.com/microsoft/TypeScript/issues/54627

🔎 Search Terms

completion, completionInfo, dot notation

⏯ Playground Link

Playground link with relevant code

💻 Code

interface Test {
    '': 'whitespace',
    '  whitespace at the start' : "not working",
    ' ': 'whitespace',
    "WHITESPACE caps in the end ": 'should work'
}
const test = {} as Test
// The dot notation does not suggest empty string properties:
test. // <--
Screenshot 2023-06-11 at 00 54 12

However, suggestions work inside an object:

image

🙁 Actual behavior

Accessed with dot notation:

image

Accessed inside an object:

Screenshot 2023-06-11 at 01 02 47

completionInfo - ts command id https://github.com/microsoft/TypeScript/blob/main/src/services/completions.ts

🙂 Expected behavior

Responses should be the same

timursaurus commented 1 year ago

Enclosing all properties with double quotes that contain whitespace like here would be ideal, i think

Screenshot 2023-06-11 at 01 02 47

It would also be beneficial to vscode, there would be no need of this: https://github.com/microsoft/vscode/pull/184813/files#diff-538486fb97b1468cfba2687ad235dc1002a37be24f0aecbcf20eb34a44466d05R95

timursaurus commented 4 months ago

@RyanCavanaugh Hey! Is anybody working on this? I'd love to jump on getting it resolved. Any hints of what to look for? I believe src/services/completions.ts would be a good place to start?