Skip to content

Commit 0f389b5

Browse files
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 <heitortoledo@hotmail.com>
1 parent 39f9711 commit 0f389b5

File tree

1 file changed

+2
-2
lines changed
  • lsp-types/src/Language/LSP

1 file changed

+2
-2
lines changed

lsp-types/src/Language/LSP/VFS.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module Language.LSP.VFS
4141
, changeChars
4242
) where
4343

44-
import Control.Lens hiding ( parts )
44+
import Control.Lens hiding ( (<.>), parts )
4545
import Control.Monad
4646
import Data.Char (isUpper, isAlphaNum)
4747
import Data.Text ( Text )
@@ -247,7 +247,7 @@ virtualFileName prefix uri (VirtualFile _ file_ver _) =
247247
padLeft n num =
248248
let numString = show num
249249
in replicate (n - length numString) '0' ++ numString
250-
in prefix </> basename ++ "-" ++ padLeft 5 file_ver ++ "-" ++ show (hash uri_raw) ++ ".hs"
250+
in prefix </> basename ++ "-" ++ padLeft 5 file_ver ++ "-" ++ show (hash uri_raw) <.> takeExtensions basename
251251

252252
-- | Write a virtual file to a temporary file if it exists in the VFS.
253253
persistFileVFS :: VFS -> J.NormalizedUri -> Maybe (FilePath, IO ())

0 commit comments

Comments
 (0)