You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
'declare method' quick fix for adding a private method #37782
I am the original one complaining about this: what I expect is NOT having 1 code action per visibility, but rather ONE code action (as today) with a tab-stop at the visibility that I can flip the various visibilities. I realise this may need support from VSCode too. Here is how it would work:
you trigger the code action
you get into a mode like snippets where certain places are stops you can cycle through with Tab key
each method or property has a tab stop where you can navigate to and once you are there, be able to select a modifier private, protected, public etc.
Daniel Rosenwasser (@DanielRosenwasser) Is there a way to have a sub action to handle tab-stop? Or need to generate all possible actions for various methods/properties and VSCode should resolve tab-stop? Do I need to close #37806, and revert #36249?
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
Hah, I meant like "I might have an idea of what you mean by tab stops". I think the weird thing is that the rename location already allows you to make something #-private, but it's not clear whether we could make a conditional tabstop location for when the declaration isn't#-private
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.
I noticed this issue. Have you tried checking the error logs or console output? That might help narrow down the root cause. I'd be happy to help investigate if you can share more details about your environment (OS, version, etc.).
Hi! I’m going to implement the “declare method” quick fix and will open a PR from branch feat/37782-declare-method-quick-fix (fork: oppong07/TypeScript). I’ll add tests demonstrating the failing diagnostic and the expected result after applying the fix, and I will link this issue from the PR.
If maintainers prefer this work be submitted to microsoft/typescript-go instead, please let me know.
Branch: https://github.com/oppong07/TypeScript/tree/feat/37782-declare-method-quick-fix
This looks like it's already resolved for the originally-reported case. #37806 (merged 2020-05-06) added the "Declare private method" / "Declare method" quick-fix actions in fixAddMissingMember.ts, and there's a fourslash test (codeFixAddMissingMember18_declarePrivateMethod.ts) covering exactly the repro from this issue:
classA{constructor(){this._foo();}}
Triggering the quick fix on _foo today produces private _foo() { throw new Error("Method not implemented."); }, and _baz(123) from the original repro would work the same way — TS infers private from the leading underscore via startsWithUnderscore().
What's still open is the follow-up scope from later in this thread: a single linked quick-fix with a tab-stop to cycle between private/protected/public (and rename the call site in sync), which needs snippet/tabstop support in the language service — tracked separately in #25207 and still unimplemented. That's a materially bigger change than "add a declare-method codefix," so it's probably worth relabeling or splitting into its own issue so this one can close and new contributors don't duplicate the already-merged #37806 work (as looks like it might be about to happen).
Activity
bpasero commentedon Apr 10, 2020
I am the original one complaining about this: what I expect is NOT having 1 code action per visibility, but rather ONE code action (as today) with a tab-stop at the visibility that I can flip the various visibilities. I realise this may need support from VSCode too. Here is how it would work:
Tabkeyprivate,protected,publicetc.a-tarasyuk commentedon Apr 13, 2020
Daniel Rosenwasser (@DanielRosenwasser) Is there a way to have a sub action to handle
tab-stop? Or need to generate all possible actions for various methods/properties and VSCode should resolvetab-stop? Do I need to close #37806, and revert #36249?DanielRosenwasser commentedon Apr 13, 2020
Could you explain what you mean by
tab-stop? I feel like I have an idea, but I might be out of the loop on something.a-tarasyuk commentedon Apr 13, 2020
Benjamin Pasero (@bpasero)
mjbvz commentedon Apr 13, 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
a-tarasyuk commentedon Apr 14, 2020
Right now I see two ways for this issue
tab-stopfor modifiers after TSServer: snippet completions #25207 will be implementedDaniel Rosenwasser (@DanielRosenwasser) Maybe you have a better idea :)
DanielRosenwasser commentedon Apr 14, 2020
Hah, I meant like "I might have an idea of what you mean by tab stops". I think the weird thing is that the rename location already allows you to make something
#-private, but it's not clear whether we could make a conditional tabstop location for when the declaration isn't#-privatebpasero commentedon May 9, 2020
To demonstrate what I expect to happen, here is what Eclipse does:
Notice how some tab-stops are linked, so renaming the method actually also renames the call!
And what VSCode does:
Paper cuts:
Can we reopen this or reconsider this?
sandersn commentedon 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.
asd34-45 commentedon May 31, 2020
asd34-45 commentedon May 31, 2020
asd34-45 commentedon May 31, 2020
arvind-nikam-halodoc commentedon Mar 10, 2021
It’s fixed i guess.

NsdHSO commentedon Jul 23, 2024
Daniel Rosenwasser (@DanielRosenwasser) is it still open?
kamolovd commentedon Aug 28, 2025
This is my first investment in outsourcing, can I start with this? Matt Bierner (@mjbvz)
tysoncung commentedon Oct 7, 2025
I noticed this issue. Have you tried checking the error logs or console output? That might help narrow down the root cause. I'd be happy to help investigate if you can share more details about your environment (OS, version, etc.).
oppong07 commentedon Jan 4, 2026
Hi! I’m going to implement the “declare method” quick fix and will open a PR from branch feat/37782-declare-method-quick-fix (fork: oppong07/TypeScript). I’ll add tests demonstrating the failing diagnostic and the expected result after applying the fix, and I will link this issue from the PR.
If maintainers prefer this work be submitted to microsoft/typescript-go instead, please let me know.
Branch: https://github.com/oppong07/TypeScript/tree/feat/37782-declare-method-quick-fix
add fourslash test for declare missing method quickfix (microsoft#37782
Add missing diagnostic message for private method quick fix
tejash5489-lang commentedon Aug 15, 2026
This looks like it's already resolved for the originally-reported case. #37806 (merged 2020-05-06) added the "Declare private method" / "Declare method" quick-fix actions in
fixAddMissingMember.ts, and there's a fourslash test (codeFixAddMissingMember18_declarePrivateMethod.ts) covering exactly the repro from this issue:Triggering the quick fix on
_footoday producesprivate _foo() { throw new Error("Method not implemented."); }, and_baz(123)from the original repro would work the same way — TS infersprivatefrom the leading underscore viastartsWithUnderscore().What's still open is the follow-up scope from later in this thread: a single linked quick-fix with a tab-stop to cycle between
private/protected/public(and rename the call site in sync), which needs snippet/tabstop support in the language service — tracked separately in #25207 and still unimplemented. That's a materially bigger change than "add a declare-method codefix," so it's probably worth relabeling or splitting into its own issue so this one can close and new contributors don't duplicate the already-merged #37806 work (as looks like it might be about to happen).LeonxLJX commentedon Sep 1, 2026
I'd like to take this one — I'll follow up with a PR. (claiming via Stella (@LeonxLJX))
LeonxLJX commentedon Sep 1, 2026
Hi! I'd like to add the 'declare method' quick fix. Plan: implement the code fix, add tests. May I be assigned?