-
-
Notifications
You must be signed in to change notification settings - Fork 391
Refactor hls-test-util and reduce getCurrentDirectory after initilization #4231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e6595bb
25108f4
542ea26
f7611a2
67438ef
9238ff6
8c709ab
5b15ebf
2eae58b
f2c1c61
308e726
543b270
2baa0c9
2ebfafc
042df98
f8f37a0
6a11d1e
7dce0f3
289528a
ca1c2b8
a3dc7ce
1d0f544
7254731
2a25a1f
3997849
e2ff7d0
91d31d8
edca60d
17e3305
4c88650
c0ed673
8223c65
9882ede
fc745c9
9eb3763
80bd4de
836c1b7
faf0cc7
887f8ed
1320577
8826256
53cfa5f
5dc3035
f3cd2e2
9298cc0
2735555
785d22a
92b8bae
1bb8c51
3a5c2cf
bb45003
166bbe9
1844682
48bc29b
54a2330
9c89410
0d4482f
6dfe592
c105dc7
f914c08
f386043
01f1437
37eacc9
7fff110
5ecce5a
f3305a5
2b9a92b
f831bf2
5579952
e4aed03
3723307
a0d64bf
a1b5927
7476dc4
b6d5e92
57366e7
ba50200
2f60c23
06dfac4
afb525b
173b580
94f94ae
e7ec5c9
a09ea8a
e5297b9
e7a81a3
c034ac4
3c7cbfa
eda61af
b75333e
fd1632f
aecf27b
c91bafb
d71cb29
b593e69
a97281c
f75391d
f77c154
6656c2e
50d6a2f
0362913
70d4d31
732d928
99d66e3
83006ad
ca50997
27474b2
2142128
03e21e4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,8 +164,7 @@ | |
import qualified Language.LSP.Server as LSP | ||
import Language.LSP.VFS | ||
import Prelude hiding (mod) | ||
import System.Directory (doesFileExist, | ||
makeAbsolute) | ||
import System.Directory (doesFileExist) | ||
import System.Info.Extra (isWindows) | ||
|
||
|
||
|
@@ -719,13 +718,13 @@ | |
|
||
defineEarlyCutoff (cmapWithPrio LogShake recorder) $ Rule $ \GhcSession file -> do | ||
IdeGhcSession{loadSessionFun} <- useNoFile_ GhcSessionIO | ||
-- loading is always returning a absolute path now | ||
(val,deps) <- liftIO $ loadSessionFun $ fromNormalizedFilePath file | ||
|
||
-- add the deps to the Shake graph | ||
let addDependency fp = do | ||
-- VSCode uses absolute paths in its filewatch notifications | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this comment still relevant? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's keep it here as the remainder. |
||
afp <- liftIO $ makeAbsolute fp | ||
let nfp = toNormalizedFilePath' afp | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we guaranteed that it is already absolute? Or do we just no longer care? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We absolute them in up stream function. The 'loadSessionFun' |
||
let nfp = toNormalizedFilePath' fp | ||
itExists <- getFileExists nfp | ||
when itExists $ void $ do | ||
use_ GetModificationTime nfp | ||
|
@@ -823,7 +822,7 @@ | |
{ source_version = ver | ||
, old_value = m_old | ||
, get_file_version = use GetModificationTime_{missingFileDiagnostics = False} | ||
, get_linkable_hashes = \fs -> map (snd . fromJust . hirCoreFp) <$> uses_ GetModIface fs | ||
Check warning on line 825 in ghcide/src/Development/IDE/Core/Rules.hs
|
||
, regenerate = regenerateHiFile session f ms | ||
} | ||
r <- loadInterface (hscEnv session) ms linkableType recompInfo | ||
|
@@ -853,7 +852,7 @@ | |
hie_loc = Compat.ml_hie_file $ ms_location ms | ||
fileHash <- liftIO $ Util.getFileHash hie_loc | ||
mrow <- liftIO $ withHieDb (\hieDb -> HieDb.lookupHieFileFromSource hieDb (fromNormalizedFilePath f)) | ||
hie_loc' <- liftIO $ traverse (makeAbsolute . HieDb.hieModuleHieFile) mrow | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The doc said hieModuleHieFile would return a full path, I guess it is not necessary to absolute it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm unsure about this sort of thing. If we need it to be absolute then I think it can be sensible to absolutize it just to be sure... since we don't track it in the types or anything. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps we should also introduce an abstraction that tracks whether we expect a path to be absolute or relative? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like a good idea, some places we might need this. The ones from ghc should depend on how we load the file into There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is quite a mess in our codebase, we might need to open an issue and try to sweep and standardize them. |
||
let hie_loc' = HieDb.hieModuleHieFile <$> mrow | ||
case mrow of | ||
Just row | ||
| fileHash == HieDb.modInfoHash (HieDb.hieModInfo row) | ||
|
@@ -1105,7 +1104,7 @@ | |
-- thus bump its modification time, forcing this rule to be rerun every time. | ||
exists <- liftIO $ doesFileExist obj_file | ||
mobj_time <- liftIO $ | ||
if exists | ||
Check warning on line 1107 in ghcide/src/Development/IDE/Core/Rules.hs
|
||
then Just <$> getModTime obj_file | ||
else pure Nothing | ||
case mobj_time of | ||
|
Uh oh!
There was an error while loading. Please reload this page.