question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'declare method' quick fix for adding a private method

See original GitHub issue

From https://github.com/microsoft/vscode/issues/94118

TypeScript Version: 3.9.0-dev.20200330

Search terms

  • quick fix
  • declare method
  • private

Repro For ts file:

index.ts

class Bar {
    bar() {
         this._baz(123)
    }
}
  1. Trigger quick fixes on _baz

Feature request: https://github.com/microsoft/TypeScript/issues/36249 added a quick fix for adding private properties. However there is no quick fix for adding a private method

Playground Link:

Related Issues:

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
sandersncommented, May 11, 2020

Yeah, #37806 partially fixes this but doesn’t address the full issue. I’ll re-open that so we can unify the two fixes when post-codefix rename locations are available.

1reaction
mjbvzcommented, Apr 14, 2020

Tabstops are from VS Code’s snippets: https://code.visualstudio.com/docs/editor/userdefinedsnippets#_tabstops

There is no concept of tabstops in the TS Server api today since it only talks about text. I’ve opened #25207 which proposes adding the idea of snippets to typescript

Read more comments on GitHub >

github_iconTop Results From Across the Web

Private Methods in Python - GeeksforGeeks
Private methods are those methods that should neither be accessed outside the class nor by any base class. In Python, there is no...
Read more >
Quick Fix - Eclipse Help
Quick Fix · Create new method for references to methods that can not be resolved · Rename to a similar method for references...
Read more >
Best way to define private methods for a class in Objective-C
In some cases, you will need to declare the method in the class continuation (e.g. if using the selector between the class continuation...
Read more >
Unit Test Private Methods in Java - Baeldung
Hence, when we feel like we need to test a private method, what we should really do is fix the underlying design problem...
Read more >
Generate a method - Visual Studio (Windows) | Microsoft Learn
Why: You could declare the method and parameters before using it, however this feature will generate the declaration automatically. How-to.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found