mirror of
https://github.com/github/semantic.git
synced 2024-11-24 08:54:07 +03:00
Define a ToTags instance for JSON.
There’s no tags to generate for JSON (without e.g. a schema or something for the data), but implementing the instance allows us to avoid having to customize the list of parsers for tagging.
This commit is contained in:
parent
ed17dcbeea
commit
2d74113a9d
@ -23,6 +23,7 @@ library
|
|||||||
Language.JSON
|
Language.JSON
|
||||||
build-depends:
|
build-depends:
|
||||||
base >= 4.12 && < 5
|
base >= 4.12 && < 5
|
||||||
|
, semantic-tags ^>= 0.0
|
||||||
, tree-sitter ^>= 0.4
|
, tree-sitter ^>= 0.4
|
||||||
, tree-sitter-json ^>= 0.3
|
, tree-sitter-json ^>= 0.3
|
||||||
hs-source-dirs: src
|
hs-source-dirs: src
|
||||||
|
@ -3,6 +3,7 @@ module Language.JSON
|
|||||||
( Term(..)
|
( Term(..)
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import qualified Tags.Tagging.Precise as Tags
|
||||||
import qualified TreeSitter.JSON.AST as JSON
|
import qualified TreeSitter.JSON.AST as JSON
|
||||||
import qualified TreeSitter.Unmarshal as TS
|
import qualified TreeSitter.Unmarshal as TS
|
||||||
|
|
||||||
@ -10,3 +11,6 @@ newtype Term a = Term { getTerm :: JSON.Document a }
|
|||||||
|
|
||||||
instance TS.Unmarshal Term where
|
instance TS.Unmarshal Term where
|
||||||
unmarshalNode node = Term <$> TS.unmarshalNode node
|
unmarshalNode node = Term <$> TS.unmarshalNode node
|
||||||
|
|
||||||
|
instance Tags.ToTags Term where
|
||||||
|
tags _ _ = []
|
||||||
|
Loading…
Reference in New Issue
Block a user