GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Method override completions · Issue #45670 · microsoft/TypeScript

Method override completions  #45670

New issue
Copy link
New issue
Copy link
Closed
#46370
microsoft/vscode
#136045
microsoft/vscode#136045
Closed
Method override completions #45670
#46370
microsoft/vscode
#136045
Copy link
Assignees
gabritto
Labels
Domain: LS: Completion ListsThe issue relates to showing completion lists in an editorThe issue relates to showing completion lists in an editorExperience EnhancementNoncontroversial enhancementsNoncontroversial enhancementsFix AvailableA PR has been opened for this issueA PR has been opened for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
TypeScript 4.5.0

Description

@mjbvz
Matt Bierner (mjbvz)
opened on Sep 1, 2021
Issue body actions

Suggestion

🔍 Search Terms

  • suggest / suggestion
  • IntelliSense
  • Snippet / snippets
  • Tooling
  • VS Code / vscode

⭐ Suggestion

For the code:

abstract class Base {
    abstract foo(param1: string, param2: boolean): Promise<void>;
}

class Sub extends Base {
    
}

I should be able to type f inside the body of Sub and get a suggestion for foo that fills in the entire signature of the method when accepted:

class Sub extends Base {
    foo(param1: string, param2: boolean): Promise<void> {
        | // cursor ends up here
    }
}

Right now, accepting the suggestion for foo only inserts the text foo. I have to fill out the entire body of the method myself, typically by copy and pasting from the base class

Reacted by Lyu, Wei-Da, Andrew Branch, Daniel Rosenwasser, whzx5byb, Chiri Vulpes, Waseem Dahman and SlurpTheo

Activity

  1. mjbvz commented on Sep 1, 2021

    @mjbvz
    Matt Bierner (mjbvz)
    on Sep 1, 2021
    ContributorAuthor
    More actions

    We should be able to use VS Code's snippet syntax for this style of completion. I originally proposed snippet style completions in #25207. It sounds like we have already have adopted a subset of VS Code's snippet string syntax

    This would need to be an opt-in feature for editors and we would likely need to add a user facing setting to disable these too

  2. andrewbranch commented on Sep 1, 2021

    @andrewbranch
    Andrew Branch (andrewbranch)
    on Sep 1, 2021
    Member
    More actions

    A general question I have about these snippet completions that may insert quite a bit of text is how we want to display them. Xcode has these kinds of method signature completions and it looks like they just truncate, which isn’t too bad:

    image

    It’s somewhat less clear how #40700 should display, for example, which is another use case I’m interested in exploring.

    Reacted by Daniel Rosenwasser
  3. Andrew Branch (andrewbranch)
    added
    Domain: LS: Completion ListsThe issue relates to showing completion lists in an editorThe issue relates to showing completion lists in an editor
    Experience EnhancementNoncontroversial enhancementsNoncontroversial enhancements
    SuggestionAn idea for TypeScriptAn idea for TypeScript
    on Sep 1, 2021
  4. Andrew Branch (andrewbranch)
    assigned
    Gabriela Araujo Britto (gabritto)
    on Sep 1, 2021
  5. Andrew Branch (andrewbranch)
    added this to the TypeScript 4.5.0 milestone on Sep 1, 2021
  6. andrewbranch commented on Sep 1, 2021

    @andrewbranch
    Andrew Branch (andrewbranch)
    on Sep 1, 2021
    Member
    More actions

    I think we can start by using the full method signature text as the label like Xcode does here and see how we like it. Matt Bierner (@mjbvz) pointed out that the Editor > Suggest: Preview setting is particularly useful for longer snippet completions, and we may want to explore enabling it by default, at least for snippet-text completions.

  7. ChiriVulpes commented on Oct 11, 2021

    @ChiriVulpes
    Chiri Vulpes (ChiriVulpes)
    on Oct 11, 2021
    Contributor
    More actions

    I've wanted this one for so long and assumed it was already suggested, but didn't know what to search for. I'm surprised it only got added to the tracker last month — this would be such a huge usability enhancement for implementing abstract classes! It's honestly one of the only reasons why I sometimes miss working on Java projects 😜

    Will this completion automatically propagate visibility modifiers? IE, if the superclass has public/protected, will the completion add the same visibility to the override? Also, will it add the override modifier if the user has the noImplicitOverride flag enabled? Both of those kinds of modifiers being included with these completions would be great.

  8. gabritto commented on Oct 12, 2021

    @gabritto
    Gabriela Araujo Britto (gabritto)
    on Oct 12, 2021
    Member
    More actions

    Will this completion automatically propagate visibility modifiers? IE, if the superclass has public/protected, will the completion add the same visibility to the override? Also, will it add the override modifier if the user has the noImplicitOverride flag enabled? Both of those kinds of modifiers being included with these completions would be great.

    I've been working on implementing this feature, and the override modifier is going to be added if noImplicitOverride is set (modulo possible bugs, of course 😅). About visibility modifiers, I think the suggested method should have them too, but I have yet to test that behavior.
    Glad to hear feedback about this feature 😊

    Reacted by Andrew Branch, Chiri Vulpes and Erik
    Reacted by Chiri Vulpes, Erik and tarnishablec
  9. TypeScript Bot (typescript-bot)
    added
    Fix AvailableA PR has been opened for this issueA PR has been opened for this issue
    on Oct 14, 2021
  10. Matt Bierner (mjbvz)
    closed this as completedin vscode#136045on Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @gabritto
    Gabriela Araujo Britto (gabritto)

Labels

Domain: LS: Completion ListsThe issue relates to showing completion lists in an editorThe issue relates to showing completion lists in an editorExperience EnhancementNoncontroversial enhancementsNoncontroversial enhancementsFix AvailableA PR has been opened for this issueA PR has been opened for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript

Type

No type

Projects

No projects

    Milestone

    • TypeScript 4.5.0

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.