@@ -267,6 +267,9 @@ type internal CompilerCaches(sizeFactor: int) =
267267
268268    member val  ParseFile  =  AsyncMemoize( keepStrongly =  50  *  sf,  keepWeakly =  20  *  sf,  name =  " ParseFile" ) 
269269
270+     member val  ParseFileWithoutProject  = 
271+         AsyncMemoize< string,  string,  FSharpParseFileResults>( keepStrongly =  5  *  sf,  keepWeakly =  2  *  sf,  name =  " ParseFileWithoutProject" ) 
272+ 
270273    member val  ParseAndCheckFileInProject  =  AsyncMemoize( sf,  2  *  sf,  name =  " ParseAndCheckFileInProject" ) 
271274
272275    member val  ParseAndCheckAllFilesInProject  =  AsyncMemoizeDisabled( sf,  2  *  sf,  name =  " ParseAndCheckFullProject" ) 
@@ -1999,6 +2002,70 @@ type internal TransparentCompiler
19992002            return  parseResult
20002003        } 
20012004
2005+     member  _.ParseFileWithoutProject 
2006+         ( 
2007+             fileName :  string , 
2008+             sourceText :  ISourceText , 
2009+             options :  FSharpParsingOptions , 
2010+             cache :  bool , 
2011+             flatErrors :  bool , 
2012+             userOpName :  string 
2013+         )  :  Async < FSharpParseFileResults >  = 
2014+         let  parseFileAsync  = 
2015+             async  { 
2016+                 let!  ct  =  Async.CancellationToken
2017+ 
2018+                 let  diagnostics ,  parsedInput ,  anyErrors  = 
2019+                     ParseAndCheckFile.parseFile ( sourceText,  fileName,  options,  userOpName,  false ,  flatErrors,  false ,  ct) 
2020+ 
2021+                 return  FSharpParseFileResults( diagnostics,  parsedInput,  anyErrors,  Array.empty) 
2022+             } 
2023+ 
2024+         if  not  cache then 
2025+             parseFileAsync
2026+         else 
2027+             let  cacheKey  = 
2028+                 let  sourceText  =  SourceTextNew.ofISourceText sourceText
2029+ 
2030+                 {  new  ICacheKey<_,  _>  with 
2031+                     member  _.GetLabel ()  =  shortPath fileName
2032+ 
2033+                     member  _.GetKey ()  =  fileName
2034+ 
2035+                     member  _.GetVersion ()  = 
2036+                         Md5Hasher.empty
2037+                         |>  Md5Hasher.addStrings
2038+                             [ 
2039+                                 yield  fileName
2040+                                 yield !  options.ConditionalDefines
2041+                                 yield !  options.SourceFiles
2042+                                 yield  options.LangVersionText
2043+                             ] 
2044+                         |>  Md5Hasher.addBytes ( sourceText.GetChecksum() .ToArray()) 
2045+                         |>  Md5Hasher.addIntegers
2046+                             [ 
2047+                                 yield  options.DiagnosticOptions.WarnLevel
2048+                                 yield !  options.DiagnosticOptions.WarnOff
2049+                                 yield !  options.DiagnosticOptions.WarnOn
2050+                                 yield !  options.DiagnosticOptions.WarnAsError
2051+                                 yield !  options.DiagnosticOptions.WarnAsWarn
2052+                             ] 
2053+                         |>  Md5Hasher.addBooleans
2054+                             [ 
2055+                                 yield  options.ApplyLineDirectives
2056+                                 yield  options.DiagnosticOptions.GlobalWarnAsError
2057+                                 yield  options.IsInteractive
2058+                                 yield !  ( Option.toList options.IndentationAwareSyntax) 
2059+                                 yield !  ( Option.toList options.StrictIndentation) 
2060+                                 yield  options.CompilingFSharpCore
2061+                                 yield  options.IsExe
2062+                             ] 
2063+                         |>  Md5Hasher.toString
2064+                 } 
2065+ 
2066+             caches.ParseFileWithoutProject.Get( cacheKey,  NodeCode.AwaitAsync parseFileAsync) 
2067+             |>  Async.AwaitNodeCode
2068+ 
20022069    member  _.ParseAndCheckFileInProject ( fileName :  string ,  projectSnapshot :  ProjectSnapshot ,  userOpName :  string )  = 
20032070        ignore userOpName
20042071        ComputeParseAndCheckFileInProject fileName projectSnapshot
@@ -2450,8 +2517,8 @@ type internal TransparentCompiler
24502517                cache :  bool , 
24512518                flatErrors :  bool , 
24522519                userOpName :  string 
2453-             )  = 
2454-             backgroundCompiler.ParseFile ( fileName,  sourceText,  options,  cache,  flatErrors,  userOpName) 
2520+             )  :   Async < FSharpParseFileResults >   = 
2521+             this.ParseFileWithoutProject ( fileName,  sourceText,  options,  cache,  flatErrors,  userOpName) 
24552522
24562523        member  this.TryGetRecentCheckResultsForFile 
24572524            ( 
0 commit comments