Skip to content

Commit

Permalink
Fix more generally for dotted expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey committed Jan 4, 2022
1 parent 09062c9 commit f158365
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/services/symbolDisplay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,15 @@ namespace ts.SymbolDisplay {
case SyntaxKind.JsxOpeningElement:
case SyntaxKind.JsxElement:
case SyntaxKind.JsxSelfClosingElement:
return location.kind === SyntaxKind.Identifier
? ScriptElementKind.memberVariableElement
: location.kind === SyntaxKind.LessThanToken ? ScriptElementKind.jsxTagName : ScriptElementKind.jsxAttribute;
switch (location.kind) {
case SyntaxKind.Identifier:
return ScriptElementKind.memberVariableElement;
case SyntaxKind.LessThanToken:
case SyntaxKind.SyntaxList:
return ScriptElementKind.jsxTagName;
default:
return ScriptElementKind.jsxAttribute;
}
case SyntaxKind.JsxAttribute:
return ScriptElementKind.jsxAttribute;
default:
Expand Down
53 changes: 53 additions & 0 deletions tests/cases/fourslash/jsxTagNameDottedNoSnippet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/// <reference path="fourslash.ts" />
//@Filename: file.tsx
////interface NestedInterface {
//// Foo: NestedInterface;
//// (props: {}): any;
////}
////
////declare const Foo: NestedInterface;
////
////function fn1() {
//// return <Foo>
//// </*1*/
//// </Foo>
////}
////function fn2() {
//// return <Foo>
//// <Fo/*2*/
//// </Foo>
////}
////function fn3() {
//// return <Foo>
//// <Foo./*3*/
//// </Foo>
////}
////function fn4() {
//// return <Foo>
//// <Foo.F/*4*/
//// </Foo>
////}
////function fn5() {
//// return <Foo>
//// <Foo.Foo./*5*/
//// </Foo>
////}
////function fn6() {
//// return <Foo>
//// <Foo.Foo.F/*6*/
//// </Foo>
////}

for (const marker of test.markers()) {
verify.completions({
marker,
includes: [
{ name: "Foo", insertText: undefined, isSnippet: undefined }
],
preferences: {
jsxAttributeCompletionStyle: "braces",
includeCompletionsWithSnippetText: true,
includeCompletionsWithInsertText: true,
},
})
}

0 comments on commit f158365

Please sign in to comment.