Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitda413d6

Browse files
author
Andy
authored
Remove unnecessary filtering of tsx completions (microsoft#24004)
1 parent11e3e24 commitda413d6

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

‎src/harness/fourslash.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ namespace FourSlash {
899899
}
900900
else{
901901
constfound=actualByName.get(exclude.name);
902-
if(found.source===exclude.source){
902+
if(found&&found.source===exclude.source){
903903
this.raiseError(`Did not expect to get a completion named${exclude.name} with source${exclude.source}`);
904904
}
905905
}

‎src/services/completions.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -972,12 +972,8 @@ namespace ts.Completions {
972972
}
973973
elseif(isRightOfOpenTag){
974974
consttagSymbols=Debug.assertEachDefined(typeChecker.getJsxIntrinsicTagNamesAt(location),"getJsxIntrinsicTagNames() should all be defined");
975-
if(tryGetGlobalSymbols()){
976-
symbols=tagSymbols.concat(symbols.filter(s=>!!(s.flags&(SymbolFlags.Value|SymbolFlags.Alias))));
977-
}
978-
else{
979-
symbols=tagSymbols;
980-
}
975+
tryGetGlobalSymbols();
976+
symbols=tagSymbols.concat(symbols);
981977
completionKind=CompletionKind.MemberLike;
982978
}
983979
elseif(isStartingCloseTag){
@@ -1298,7 +1294,7 @@ namespace ts.Completions {
12981294
constexportedSymbols=typeChecker.getExportsOfModule(symbol);
12991295
// If the exported symbols contains type,
13001296
// symbol can be referenced at locations where type is allowed
1301-
returnforEach(exportedSymbols,symbolCanBeReferencedAtTypeLocation);
1297+
returnexportedSymbols.some(symbolCanBeReferencedAtTypeLocation);
13021298
}
13031299
}
13041300

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
//@noLib: true
4+
//@nolib: true
5+
//@jsx: preserve
6+
7+
//@Filename: /a.tsx
8+
////export type Bar = 0;
9+
////export default function Foo() {};
10+
11+
//@Filename: /b.tsx
12+
////<Fo/**/ />;
13+
14+
verify.completions({
15+
marker:"",
16+
includes:{name:"Foo",source:"/a.tsx",hasAction:true},
17+
excludes:"Bar",
18+
preferences:{
19+
includeCompletionsForModuleExports:true,
20+
},
21+
});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp