From 2d74113a9df80fa2b179fb7f6595adc18d77f32a Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 7 Oct 2019 11:04:37 -0400 Subject: [PATCH] Define a ToTags instance for JSON. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- semantic-json/semantic-json.cabal | 1 + semantic-json/src/Language/JSON.hs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/semantic-json/semantic-json.cabal b/semantic-json/semantic-json.cabal index e79c3671d..29dda0cad 100644 --- a/semantic-json/semantic-json.cabal +++ b/semantic-json/semantic-json.cabal @@ -23,6 +23,7 @@ library Language.JSON build-depends: base >= 4.12 && < 5 + , semantic-tags ^>= 0.0 , tree-sitter ^>= 0.4 , tree-sitter-json ^>= 0.3 hs-source-dirs: src diff --git a/semantic-json/src/Language/JSON.hs b/semantic-json/src/Language/JSON.hs index 87b4f4278..97f4b822e 100644 --- a/semantic-json/src/Language/JSON.hs +++ b/semantic-json/src/Language/JSON.hs @@ -3,6 +3,7 @@ module Language.JSON ( Term(..) ) where +import qualified Tags.Tagging.Precise as Tags import qualified TreeSitter.JSON.AST as JSON import qualified TreeSitter.Unmarshal as TS @@ -10,3 +11,6 @@ newtype Term a = Term { getTerm :: JSON.Document a } instance TS.Unmarshal Term where unmarshalNode node = Term <$> TS.unmarshalNode node + +instance Tags.ToTags Term where + tags _ _ = []