ghc-tags-plugin 0.4.0.0 → 0.4.0.1
raw patch · 4 files changed
+85/−64 lines, 4 filesdep ~basedep ~text
Dependency ranges changed: base, text
Files
- CHANGELOG.md +51/−40
- README.md +6/−1
- ghc-tags-plugin.cabal +5/−5
- lib/Plugin/GhcTags.hs +23/−18
CHANGELOG.md view
@@ -1,71 +1,82 @@ # Revision history for ghctags -## 0.1.0.0 -- YYYY-mm-dd+## 0.4.0.1 -* First version. Released on an unsuspecting world.+* `ghc-tags-plugin` is now compatible with `GHC-9.4`.+ **NOTE**: `GHC-9.4` includes a [fix][ghc-issue-20417], which makes `cabal`+ cache mechanism work properly when plugins are enabled. -## 0.1.1.0 -- 2020-03-03+## 0.4.0.0 -- 2022-01-09 -* Added support for tag's kinds.-* Added various file headers+* `ghc-tags-plugin` is now compatible with `GHC-9.2`+* `--stream` option, only effective for `ctags`; When enabled,+ `ghc-tags-plugin` streams existing tags when adding the tags found in a new+ module. Without this option the tags file is read at once into memory. -## 0.1.2.0 -- 2020-03-05+## 0.3.0.0 -- 2021-05-01 -* Preserve tag information in ctags generated files-* Support for `file:` tags (exported / not exported terms)-* Added a test-suite (golden tests and property tests)+* filter adjacents tags: preserve only type signatures (filter out adjacent+ terms) or data constructors (filter out adjacent type constructors).+* fix emacs support: ghc-tags-plugin can now correctly display multiple tags+ (e.g. instance declarations). Thanks to @nfrisby for finding out how to do+ that. -## 0.1.3.0 -- 2020-03-08+## 0.2.4.0 -- 2020-09-08 -* Change order of tags: type classes, type families and data type families are- sorted before their instances. If one is using multipe tags (the default),- the order of them also matters (i.e. in the vim `tags` option).+* `ghc-tags-vim` a vim plugin which helps to maintain a `cabal.project.local` file.+* better tag info -## 0.1.4.0 -- 2020-03-11+## 0.2.3.0 -- 2020-08-07 -* Tags for default instances of associated (data) type familes.-* Added path argument, can be passed using `-fplugin-opt=Plugin.GhcTags:../tags`.-* Wrapped `IOExceptions`, so when it will happen it will be obvious that the- plugin failed not `ghc`-* Fixed the tag ordering function to be fullfil the transitivness property.+* Generate tags for template haskell splices (requires at least `GHC-8.10`).+* Include types of class methods. -## 0.1.5.0 -- 2020-03-13+## 0.2.0.0 -- 2020-04-12 -* concurrency safety - protection `tags` file using a file lock+* Fixed bug [#37][issue-37]+* Added `--debug` flag ## 0.1.6.0 -- 2020-03-24 -* support for etags files+* support etags files * various bug fixes * type level information (not type checked!), from the parsed tree, including: type of instances (instance context & instance head), types of `GADTs` constructors, rhs of type synonyms, kinds of type or data families. * expanded ctags pseudo tags with descriptions of fields and tag kinds -## 0.2.0.0 -- 2020-04-12+## 0.1.5.0 -- 2020-03-13 -* Fixed bug #37-* Added `--debug` flag+* concurrency safety - protection `tags` file using a file lock -## 0.2.3.0 -- 2020-08-07+## 0.1.4.0 -- 2020-03-11 -* Generate tags for template haskell splices (requires at least `GHC-8.10`).-* Include types of class methods.+* Tags for default instances of associated (data) type familes.+* Added path argument, can be passed using `-fplugin-opt=Plugin.GhcTags:../tags`.+* Wrapped `IOExceptions`, so when it will happen it will be obvious that the+ plugin failed not `ghc`+* Fixed the tag ordering function to be fullfil the transitivness property. -## 0.2.4.0 -- 2020-09-08+## 0.1.3.0 -- 2020-03-08 -* `ghc-tags-vim` a vim plugin which helps to maintain a `cabal.project.local` file.-* better tag info+* Change order of tags: type classes, type families and data type families are+ sorted before their instances. If one is using multipe tags (the default),+ the order of them also matters (i.e. in the vim `tags` option). -## 0.3.0.0 -- 2021-05-01+## 0.1.2.0 -- 2020-03-05 -* filter adjacents tags: preserve only type signatures (filter out adjacent- terms) or data constructors (filter out adjacent type constructors).-* fix emacs support: ghc-tags-plugin can now correctly display multiple tags- (e.g. instance declarations). Thanks to @nfrisby for finding out how to do- that.+* Preserve tag information in ctags generated files+* Support `file:` tags (exported / not exported terms)+* Added a test-suite (golden tests and property tests) -## 0.4.0.0 -- 2022-01-09+## 0.1.1.0 -- 2020-03-03 -* `ghc-tags-plugin` is not compatible with `ghc-9.2`-* `--stream` option, only effective for `ctags`; When enabled, `ghc-tags-plugin` streams existing tags when adding the tags found in a new module. Without this option the tags file is read at once into memory.+* Added support for tag's kinds.+* Added various file headers++## 0.1.0.0 -- YYYY-mm-dd++* First version. Released on an unsuspecting world.++[ghc-issue-20417]: https://gitlab.haskell.org/ghc/ghc/-/issues/20417+[issue-37]: https://github.com/coot/ghc-tags-plugin/issues/37
README.md view
@@ -13,10 +13,13 @@ ● Requirements -------------- -The plugin requires at least: `ghc >= 8.6`; `ghc-tags-plugin` can generate tags+The plugin requires at least: `ghc >= 8.8`; `ghc-tags-plugin` can generate tags for template-haskell splices, but it requires: `ghc >= 8.10`. +`ghc-9.4` includes a [fix][ghc-issue-20417] which makes `cabal` cache mechanism+works again. + ● Plugin options ---------------- @@ -204,3 +207,5 @@ state) as of `IO`, and does not [modify/](https://github.com/coot/ghc-tags-plugin/blob/master/src/Plugin/GhcTags.hs#L95) the syntax tree.++[ghc-issue-20417]: https://gitlab.haskell.org/ghc/ghc/-/issues/20417
ghc-tags-plugin.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: ghc-tags-plugin-version: 0.4.0.0+version: 0.4.0.1 synopsis: A compiler plugin which generates tags file from GHC parsed syntax tree. description: A [GHC compiler plugin](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/extending_ghc.html?highlight=compiler%20plugin#compiler-plugins)@@ -11,14 +11,14 @@ license-file: LICENSE author: Marcin Szamotulski maintainer: coot@coot.me-copyright: (c) 2020-2021, Marcin Szamotulski+copyright: (c) 2020-2022, Marcin Szamotulski category: Development stability: alpha extra-source-files: CHANGELOG.md README.md homepage: https://github.com/coot/ghc-tags-plugin#readme bug-reports: https://github.com/coot/ghc-tags-plugin/issues-tested-with: GHC==8.8.4, GHC==8.10.7, GHC==9.0.1, GHC==9.2.1+tested-with: GHC==8.8.4, GHC==8.10.7, GHC==9.0.1, GHC==9.2.4, GHC==9.4.2 -- Don't build gtp-check command by default; it's a development tool. flag gtp-check@@ -37,7 +37,7 @@ other-modules: Plugin.GhcTags.CTag Paths_ghc_tags_plugin autogen-modules: Paths_ghc_tags_plugin- build-depends: base >=4.12.0.0 && <4.17,+ build-depends: base >=4.12.0.0 && <4.18, bytestring >=0.10 && < 0.12, directory ^>=1.3, filepath ^>=1.4,@@ -52,7 +52,7 @@ pipes-attoparsec ^>=0.5, pipes-bytestring ^>=2.1, pipes-safe ^>=2.3,- text ^>=1.2,+ text >=1.2 && <2.1, ghc-tags-core
lib/Plugin/GhcTags.hs view
@@ -2,10 +2,8 @@ {-# LANGUAGE BangPatterns #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE NamedFieldPuns #-}-{-# LANGUAGE LambdaCase #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeApplications #-} {-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}@@ -37,9 +35,9 @@ import Options.Applicative.Types (ParserFailure (..)) -import qualified Pipes as Pipes+import qualified Pipes import Pipes.Safe (SafeT)-import qualified Pipes.Safe as Pipes.Safe+import qualified Pipes.Safe import qualified Pipes.ByteString as Pipes.BS #if __GLASGOW_HASKELL__ >= 900@@ -200,7 +198,14 @@ -- plugin :: Plugin plugin = GhcPlugins.defaultPlugin {- parsedResultAction = ghcTagsParserPlugin,+ parsedResultAction =+#if __GLASGOW_HASKELL__ >= 904+ -- TODO: add warnings / errors to 'ParsedResult'+ \args summary result@GhcPlugins.ParsedResult { GhcPlugins.parsedResultModule } ->+ result <$ ghcTagsParserPlugin args summary parsedResultModule,+#else+ ghcTagsParserPlugin,+#endif #if __GLASGOW_HASKELL__ >= 902 driverPlugin = ghcTagsDriverPlugin, #elif __GLASGOW_HASKELL__ >= 810@@ -210,7 +215,7 @@ } --- | IOExcption wrapper; it is useful for the user to know that it's the plugin+-- | IOException wrapper; it is useful for the user to know that it's the plugin -- not `ghc` that thrown the error. -- data GhcTagsPluginException@@ -223,7 +228,10 @@ -- | The plugin does not change the 'HsParedModule', it only runs side effects. ---ghcTagsParserPlugin :: [CommandLineOption] -> ModSummary -> HsParsedModule -> Hsc HsParsedModule+ghcTagsParserPlugin :: [CommandLineOption]+ -> ModSummary+ -> HsParsedModule+ -> Hsc HsParsedModule ghcTagsParserPlugin options moduleSummary@ModSummary {ms_mod, ms_hspp_opts = dynFlags} hsParsedModule@HsParsedModule {hpm_module} =@@ -320,7 +328,7 @@ -- -- update ctags (streaming) --- -- Stream ctags from from the tags file and intersparse tags parsed from+ -- Stream ctags from from the tags file and intersperse tags parsed from -- the current module. The results are written to a destination file which -- is then renamed to tags file. updateCTags_stream = do@@ -337,8 +345,6 @@ else pure (Just 0) else pure Nothing - -- when tagsFileExists- -- $ renameFile tagsFile destFile withFile destFile WriteMode $ \writeHandle -> withFile tagsFile ReadWriteMode $ \readHandle -> do cwd <- BSC.pack <$> getCurrentDirectory@@ -349,7 +355,7 @@ Nothing -> pure () Just sourcePath -> do let sourcePathBS = Text.encodeUtf8 (Text.pack sourcePath)- -- path of the combiled module; it is relative to the cabal file,+ -- path of the compiled module; it is relative to the cabal file, -- not the project. modulePath = case GHC.getLoc lmodule of@@ -386,7 +392,6 @@ -- loudly and continue. putDocLn dynFlags $ messageDoc ParserException (Just ms_mod) (displayException e) )- $ -- merge tags (\tag -> do -- update tags counter@@ -470,7 +475,7 @@ Nothing -> pure () Just sourcePath -> do let sourcePathBS = Text.encodeUtf8 (Text.pack sourcePath)- -- path of the combiled module; it is relative to the cabal file,+ -- path of the compiled module; it is relative to the cabal file, -- not the project. modulePath = case GHC.getLoc lmodule of@@ -729,7 +734,7 @@ -- run the hook and call call the callback with new declarations withMetaD :: MetaHook TcM -> MetaRequest -> LHsExpr GhcTc -> ([LHsDecl GhcPs] -> TcM a)- -> TcM (MetaResult)+ -> TcM MetaResult withMetaD h req e f = case req of MetaE k -> k <$> metaRequestE h e MetaP k -> k <$> metaRequestP h e@@ -746,7 +751,7 @@ -- fixFilePath :: RawFilePath- -- ^ curent directory+ -- ^ current directory -> RawFilePath -- ^ tags file directory -> RawFilePath@@ -773,7 +778,7 @@ } ----- Error Formattng+-- Error Formatting -- data MessageSeverity@@ -786,8 +791,8 @@ Out.blankLine $+$ Out.coloured PprColour.colBold- ((Out.text "GhcTagsPlugin: ")- Out.<> (Out.coloured messageColour (Out.text $ show errorType)))+ (Out.text "GhcTagsPlugin: "+ Out.<> Out.coloured messageColour (Out.text $ show errorType)) $$ case mb_mod of Just mod_ ->