ghc-tags-plugin 0.6.0.0 → 0.6.0.1
raw patch · 3 files changed
+44/−27 lines, 3 filesdep ~ghc-tags-coredep ~ghc-tags-pipesdep ~lukkoPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: ghc-tags-core, ghc-tags-pipes, lukko
API changes (from Hackage documentation)
Files
- README.md +13/−4
- ghc-tags-plugin.cabal +10/−15
- lib/Plugin/GhcTags.hs +21/−8
README.md view
@@ -18,7 +18,6 @@ `ghc-9.4` includes a [fix][ghc-issue-20417] which makes `cabal` cache mechanism works again. - ● Plugin options ---------------- @@ -43,7 +42,7 @@ ## ● Emacs support -To produce `etags` file you will need to pass the follwing option+To produce `etags` file you will need to pass the following option ``` -fplugin-opt=Plugin.GhcTags:--etags ```@@ -114,7 +113,7 @@ This is alternative method, which also could be modified for `cabal` (but it is not as nice as the previous method where you don't need to modify any files-checked in vcs).+checked in a VCS). Add `ghc-tags-plugin` to `build-depends` in your `*.cabal` files. (You should hide it behind a cabal flag). And add these lines to `stack.yaml` file:@@ -169,7 +168,7 @@ `~/.ghc/x86_64-linux-8.6.5/environments/default` (or whatever is your default environment) - * unregister the installeld version from cabal store (you can check what is+ * unregister the installed version from cabal store (you can check what is installed in your store with `ghc-pkg --package=PACKAGE_DB list | grep ghc-tags` for the following command): @@ -207,4 +206,14 @@ [modify/](https://github.com/coot/ghc-tags-plugin/blob/master/src/Plugin/GhcTags.hs#L95) the syntax tree. +● ghc-tags - standalone program+-------------------------------++[`ghc-tags-fork`] is a fork of [`ghc-tags-hackage`]. Both provide a standalone+`ghc-tags` command. Unlike the `hackage` version [ghc-tags-fork] is using the+latest [`ghc-tags-core`] version.+ [ghc-issue-20417]: https://gitlab.haskell.org/ghc/ghc/-/issues/20417+[`ghc-tags-fork`]: https://github.com/coot/ghc-tags+[`ghc-tags-hackage`]: https://hackage.haskell.org/package/ghc-tags+[`ghc-tags-core`]: https//hackage.haskell.org/package/ghc-tags-core
ghc-tags-plugin.cabal view
@@ -1,17 +1,18 @@ cabal-version: 3.0 name: ghc-tags-plugin-version: 0.6.0.0+version: 0.6.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)- which takes parsed Haskell representation @HsModule GhcPs@,- extracts __tags__ information and saves it either in __ctags__ or- __etags__ format.+ __etags__ format. For a standalone `ghc-tags` command look for or+ [ghc-tags](https://hackage.haskell.org/package/ghc-tags) or its+ [fork](https://github.com/coot/ghc-tags) (the fork is using+ [ghc-tags-core](https://hackage.haskell.org/package/ghc-tags-core),+ the same library which `ghc-tags-plugin` is using). license: MPL-2.0 license-file: LICENSE author: Marcin Szamotulski maintainer: coot@coot.me-copyright: (c) 2020-2022, Marcin Szamotulski+copyright: (c) 2020-2023, Marcin Szamotulski category: Development stability: alpha extra-source-files: CHANGELOG.md@@ -57,7 +58,7 @@ directory ^>=1.3, filepath ^>=1.4, ghc >=8.4 && <10,- lukko >=0.1,+ lukko ^>=0.1, mtl >=2.2 && <2.4, optparse-applicative >=0.15.1 && < 0.17,@@ -66,14 +67,8 @@ pipes-safe ^>=2.3, text >=1.2 && <2.1, - -- on macos `ghc-tags-core-0.4.2.0` does not build (preprocessor error)- if impl(ghc < 8.10) && os(darwin)- build-depends: ghc-tags-core < 0.4.2.0,- ghc-tags-pipes- else- build-depends: ghc-tags-core,- ghc-tags-pipes-+ ghc-tags-core ^>=0.6,+ ghc-tags-pipes ^>=0.1.1 default-language: Haskell2010
lib/Plugin/GhcTags.hs view
@@ -245,13 +245,11 @@ (displayException ioerr)) throwIO (GhcTagsParserPluginIOException ioerr)) $ - let lockFile = case FilePath.splitFileName tagsFile of- (dir, name) -> dir FilePath.</> "." ++ name ++ ".lock" in -- Take advisory exclusive lock (a BSD lock using `flock`) on the tags -- file. This is needed when `cabal` compiles in parallel. -- We take the lock on the copy, otherwise the lock would be removed when -- we move the file.- withFileLock debug lockFile ExclusiveLock $ \_ -> do+ withFileLock debug (lockFilePath tagsFile) ExclusiveLock $ \_ -> do mbInSize <- if debug then Just <$> getFileSize tagsFile@@ -568,6 +566,19 @@ Right (Right parsedTags) -> do let sourcePathBS = rawFilePathFromBS $ Text.encodeUtf8 (Text.pack sourcePath)+ modulePath =+ case GHC.getLoc lmodule of+#if __GLASGOW_HASKELL__ >= 900+ GHC.RealSrcSpan rss _ ->+#else+ GHC.RealSrcSpan rss ->+#endif+ rawFilePathFromBS+ . bytesFS+ . GHC.srcSpanFile+ $ rss+ GHC.UnhelpfulSpan {} ->+ fixFilePath cwd tagsDir sourcePathBS tags :: [ETag] tags = filterAdjacentTags@@ -578,10 +589,7 @@ $ lmodule combined :: [ETag]- combined = combineTags ETag.compareTags- (fixFilePath cwd tagsDir sourcePathBS)- tags- (sortBy ETag.compareTags tags)+ combined = combineTags ETag.compareTags modulePath tags parsedTags BB.hPutBuilder writeHandle (ETag.formatETagsFile combined) @@ -674,7 +682,7 @@ (messageDoc UnhandledException Nothing (displayException ioerr)) throwIO (GhcTagsDynFlagsPluginIOException ioerr)) $- withFileLock debug tagsFile ExclusiveLock $ \_ -> do+ withFileLock debug (lockFilePath tagsFile) ExclusiveLock $ \_ -> do cwd <- rawFilePathFromBS . BSC.pack <$> getCurrentDirectory tagsDir <- rawFilePathFromBS . BSC.pack <$> canonicalizePath (fst $ FilePath.splitFileName tagsFile) tagsContent <- BSC.readFile tagsFile@@ -772,6 +780,11 @@ $ fixFilePath cwd tagsDir (rawFilePathFromBS $ Text.encodeUtf8 fp)) }++lockFilePath :: FilePath -> FilePath+lockFilePath tagsFile =+ case FilePath.splitFileName tagsFile of+ (dir, name) -> dir FilePath.</> "." ++ name ++ ".lock" -- -- Error Formatting