From 0f389b5d6f405df31f7b40195111ef96768ec5ca Mon Sep 17 00:00:00 2001 From: Javier Neira Date: Wed, 3 Nov 2021 13:22:58 +0100 Subject: [PATCH] Fix virtual file name adding .hs extension (#364) Problem: virtualFileName always adds a .hs extension to the filename. Solution: Use takeExtensios instead to use the original file extension. Co-authored-by: Heitor Toledo Lassarote de Paula --- lsp-types/src/Language/LSP/VFS.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lsp-types/src/Language/LSP/VFS.hs b/lsp-types/src/Language/LSP/VFS.hs index 608276698..ecde62121 100644 --- a/lsp-types/src/Language/LSP/VFS.hs +++ b/lsp-types/src/Language/LSP/VFS.hs @@ -41,7 +41,7 @@ module Language.LSP.VFS , changeChars ) where -import Control.Lens hiding ( parts ) +import Control.Lens hiding ( (<.>), parts ) import Control.Monad import Data.Char (isUpper, isAlphaNum) import Data.Text ( Text ) @@ -247,7 +247,7 @@ virtualFileName prefix uri (VirtualFile _ file_ver _) = padLeft n num = let numString = show num in replicate (n - length numString) '0' ++ numString - in prefix basename ++ "-" ++ padLeft 5 file_ver ++ "-" ++ show (hash uri_raw) ++ ".hs" + in prefix basename ++ "-" ++ padLeft 5 file_ver ++ "-" ++ show (hash uri_raw) <.> takeExtensions basename -- | Write a virtual file to a temporary file if it exists in the VFS. persistFileVFS :: VFS -> J.NormalizedUri -> Maybe (FilePath, IO ())