Skip to content

TypeScript intellisense: Suggest to prepend "this." if I typed the name of a class member #41668

@Duckers

Description

@Duckers

Apologies if this is the wrong repo for Intellisense suggestions, if so, please redirect me.

  • VSCode Version: 1.19.1
  • OS Version: MacOS 10.13

A very common scenario when writing TypeScript (coming from C#) is that I forget to prepend this. when I want to reference a member of the current class. My muscle memory also relies a lot on the intellisense to complete the names of members. This very often results in the code completer completing an identifier with a very unlikely option from the global namespace, instead of simply prepending this. to refer to a local member.

Example:

import { Post } from 'Server/Boost/Post'

export default class PostComponent {
    Options = {} as Post.Post

    get hasImage() {
        return Opt<caret here, pressing enter>
    }
}

This ends up completing as HTMLOptionElement or something similar, when this.Options would have been a much more probable intention.

Metadata

Metadata

Assignees

Labels

feature-requestRequest for new features or functionalityjavascriptJavaScript support issuesupstreamIssue identified as 'upstream' component related (exists outside of VS Code)verifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions