mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-13 06:20:23 -06:00
fix(49548): show completions after keywords in block (#49600)
This commit is contained in:
parent
7eddb3a122
commit
c01afb5ef3
@ -4094,6 +4094,10 @@ namespace ts.Completions {
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.Identifier: {
|
||||
const originalKeywordKind = (location as Identifier).originalKeywordKind;
|
||||
if (originalKeywordKind && isKeyword(originalKeywordKind)) {
|
||||
return undefined;
|
||||
}
|
||||
// class c { public prop = c| }
|
||||
if (isPropertyDeclaration(location.parent) && location.parent.initializer === location) {
|
||||
return undefined;
|
||||
|
||||
50
tests/cases/fourslash/completionsAfterKeywordsInBlock.ts
Normal file
50
tests/cases/fourslash/completionsAfterKeywordsInBlock.ts
Normal file
@ -0,0 +1,50 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////class C1 {
|
||||
//// method(map: Map<string, string>, key: string, defaultValue: string) {
|
||||
//// try {
|
||||
//// return map.get(key)!;
|
||||
//// }
|
||||
//// catch {
|
||||
//// return default/*1*/
|
||||
//// }
|
||||
//// }
|
||||
////}
|
||||
////class C2 {
|
||||
//// method(map: Map<string, string>, key: string, defaultValue: string) {
|
||||
//// if (map.has(key)) {
|
||||
//// return map.get(key)!;
|
||||
//// }
|
||||
//// else {
|
||||
//// return default/*2*/
|
||||
//// }
|
||||
//// }
|
||||
////}
|
||||
////class C3 {
|
||||
//// method(map: Map<string, string>, key: string, returnValue: string) {
|
||||
//// try {
|
||||
//// return map.get(key)!;
|
||||
//// }
|
||||
//// catch {
|
||||
//// return return/*3*/
|
||||
//// }
|
||||
//// }
|
||||
////}
|
||||
////class C4 {
|
||||
//// method(map: Map<string, string>, key: string, returnValue: string) {
|
||||
//// if (map.has(key)) {
|
||||
//// return map.get(key)!;
|
||||
//// }
|
||||
//// else {
|
||||
//// return return/*4*/
|
||||
//// }
|
||||
//// }
|
||||
////}
|
||||
|
||||
verify.completions({
|
||||
marker: ["1", "2"],
|
||||
includes: [{ name: "defaultValue", sortText: completion.SortText.LocationPriority }]
|
||||
}, {
|
||||
marker: ["3", "4"],
|
||||
includes: [{ name: "returnValue", sortText: completion.SortText.LocationPriority }]
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user