diff --git a/semantic-tsx/src/Language/TSX/Tags.hs b/semantic-tsx/src/Language/TSX/Tags.hs index e063acfd7..ade3bc2c4 100644 --- a/semantic-tsx/src/Language/TSX/Tags.hs +++ b/semantic-tsx/src/Language/TSX/Tags.hs @@ -100,6 +100,19 @@ instance ToTags Tsx.Class where } = yieldTag text Class loc byteRange >> gtags t tags t = gtags t +instance ToTags Tsx.Module where + tags t@Tsx.Module + { ann = loc@Loc { byteRange } + , name + } = match name + where + match expr = case expr of + Prj Tsx.Identifier { text } -> yield text + -- TODO: Handle NestedIdentifiers and Strings + -- Prj Tsx.NestedIdentifier { extraChildren } -> match + _ -> gtags t + yield text = yieldTag text Module loc byteRange >> gtags t + instance (ToTags l, ToTags r) => ToTags (l :+: r) where tags (L1 l) = tags l tags (R1 r) = tags r @@ -222,7 +235,7 @@ instance ToTags Tsx.MemberExpression instance ToTags Tsx.MetaProperty -- instance ToTags Tsx.MethodDefinition instance ToTags Tsx.MethodSignature -instance ToTags Tsx.Module +-- instance ToTags Tsx.Module instance ToTags Tsx.NamedImports instance ToTags Tsx.NamespaceImport instance ToTags Tsx.NestedIdentifier diff --git a/semantic-typescript/src/Language/TypeScript/Tags.hs b/semantic-typescript/src/Language/TypeScript/Tags.hs index 0f5fea56c..e36b28285 100644 --- a/semantic-typescript/src/Language/TypeScript/Tags.hs +++ b/semantic-typescript/src/Language/TypeScript/Tags.hs @@ -93,6 +93,19 @@ instance ToTags Ts.CallExpression where _ -> gtags t yield name = yieldTag name Call loc byteRange >> gtags t +instance ToTags Ts.Module where + tags t@Ts.Module + { ann = loc@Loc { byteRange } + , name + } = match name + where + match expr = case expr of + Prj Ts.Identifier { text } -> yield text + -- TODO: Handle NestedIdentifiers and Strings + -- Prj Tsx.NestedIdentifier { extraChildren } -> match + _ -> gtags t + yield text = yieldTag text Module loc byteRange >> gtags t + instance (ToTags l, ToTags r) => ToTags (l :+: r) where tags (L1 l) = tags l tags (R1 r) = tags r @@ -215,7 +228,7 @@ instance ToTags Ts.MemberExpression instance ToTags Ts.MetaProperty -- instance ToTags Ts.MethodDefinition instance ToTags Ts.MethodSignature -instance ToTags Ts.Module +-- instance ToTags Ts.Module instance ToTags Ts.NamedImports instance ToTags Ts.NamespaceImport instance ToTags Ts.NestedIdentifier