1
1
mirror of https://github.com/github/semantic.git synced 2024-12-29 01:42:43 +03:00

🔥 the JavaScript language.

This commit is contained in:
Rob Rix 2017-05-17 12:54:37 -04:00
parent 501cd45d87
commit 681d0c8bce
4 changed files with 3 additions and 5 deletions

View File

@ -12,10 +12,9 @@ import Term
data Language =
C
| Go
| JavaScript
| Markdown
| Ruby
| TypeScript
| TypeScript -- ^ Also JavaScript.
deriving (Show, Eq, Read)
-- | Returns a Language based on the file extension (including the ".").

View File

@ -81,7 +81,6 @@ parserForLanguage :: Maybe Language -> Parser (Syntax Text) (Record DefaultField
parserForLanguage Nothing = lineByLineParser
parserForLanguage (Just language) = case language of
C -> treeSitterParser C tree_sitter_c
JavaScript -> treeSitterParser TypeScript tree_sitter_typescript
TypeScript -> treeSitterParser TypeScript tree_sitter_typescript
Markdown -> cmarkParser
Ruby -> treeSitterParser Ruby tree_sitter_ruby

View File

@ -43,7 +43,7 @@ replacementSummary :: DiffSummary DiffInfo
replacementSummary = DiffSummary { diffSummaryPatch = Replace (LeafInfo StringLiteral "a" $ sourceSpanBetween (1, 2) (1, 4)) (LeafInfo SymbolLiteral "b" $ sourceSpanBetween (1,1) (1, 2)), parentAnnotation = [Left (Info.FunctionCall, "foo")] }
blobs :: Both SourceBlob
blobs = both (SourceBlob (fromText "[]") nullOid "a.js" (Just defaultPlainBlob) (Just JavaScript)) (SourceBlob (fromText "[a]") nullOid "b.js" (Just defaultPlainBlob) (Just JavaScript))
blobs = both (SourceBlob (fromText "[]") nullOid "a.js" (Just defaultPlainBlob) (Just TypeScript)) (SourceBlob (fromText "[a]") nullOid "b.js" (Just defaultPlainBlob) (Just TypeScript))
spec :: Spec
spec = parallel $ do

View File

@ -218,7 +218,7 @@ blankDiff = wrap (pure arrayInfo :< Indexed [ inserting (cofree $ literalInfo :<
literalInfo = Nothing :. Range 1 2 :. StringLiteral :. sourceSpanBetween (1, 2) (1, 4) :. Nil
blankDiffBlobs :: Both SourceBlob
blankDiffBlobs = both (SourceBlob (fromText "[]") nullOid "a.js" (Just defaultPlainBlob) (Just JavaScript)) (SourceBlob (fromText "[a]") nullOid "b.js" (Just defaultPlainBlob) (Just JavaScript))
blankDiffBlobs = both (SourceBlob (fromText "[]") nullOid "a.js" (Just defaultPlainBlob) (Just TypeScript)) (SourceBlob (fromText "[a]") nullOid "b.js" (Just defaultPlainBlob) (Just TypeScript))
instance Listable Text where
tiers = unListableText `mapT` tiers