@@ -1394,14 +1394,13 @@ type TypeCheckInfo
13941394override __.ToString () = " TypeCheckInfo(" + mainInputFileName+ " )"
13951395
13961396type FSharpParsingOptions =
1397- {
1398- SourceFiles: string []
1397+ { SourceFiles: string []
13991398 ConditionalCompilationDefines: string list
14001399 ErrorSeverityOptions: FSharpErrorSeverityOptions
1400+ IsInteractive: bool
14011401 LightSyntax: bool option
14021402 CompilingFsLib: bool
1403- IsExe: bool
1404- }
1403+ IsExe: bool }
14051404
14061405member x.LastFileName =
14071406 Debug.Assert( not ( Array.isEmpty x.SourceFiles), " Parsing options don't contain any file" )
@@ -1411,26 +1410,26 @@ type FSharpParsingOptions =
14111410{ SourceFiles= Array.empty
14121411 ConditionalCompilationDefines= []
14131412 ErrorSeverityOptions= FSharpErrorSeverityOptions.Default
1413+ IsInteractive= false
14141414 LightSyntax= None
14151415 CompilingFsLib= false
1416- IsExe= false
1417- }
1416+ IsExe= false }
14181417
1419- static member FromTcConfig ( tcConfig : TcConfig , sourceFiles ) =
1420- {
1421- SourceFiles= sourceFiles
1418+ static member FromTcConfig ( tcConfig : TcConfig , sourceFiles , isInteractive : bool ) =
1419+ { SourceFiles= sourceFiles
14221420 ConditionalCompilationDefines= tcConfig.conditionalCompilationDefines
14231421 ErrorSeverityOptions= tcConfig.errorSeverityOptions
1422+ IsInteractive= isInteractive
14241423 LightSyntax= tcConfig.light
14251424 CompilingFsLib= tcConfig.compilingFslib
1426- IsExe= tcConfig.target.IsExe
1427- }
1425+ IsExe= tcConfig.target.IsExe}
14281426
1429- static member FromTcConfigBuidler ( tcConfigB : TcConfigBuilder , sourceFiles ) =
1427+ static member FromTcConfigBuidler ( tcConfigB : TcConfigBuilder , sourceFiles , isInteractive : bool ) =
14301428{
14311429 SourceFiles= sourceFiles
14321430 ConditionalCompilationDefines= tcConfigB.conditionalCompilationDefines
14331431 ErrorSeverityOptions= tcConfigB.errorSeverityOptions
1432+ IsInteractive= isInteractive
14341433 LightSyntax= tcConfigB.light
14351434 CompilingFsLib= tcConfigB.compilingFslib
14361435 IsExe= tcConfigB.target.IsExe
@@ -1502,7 +1501,7 @@ module internal Parser =
15021501
15031502// If we're editing a script then we define INTERACTIVE otherwise COMPILED.
15041503// Since this parsing for intellisense we always define EDITING.
1505- let defines = SourceFileImpl.AdditionalDefinesForUseInEditor( fileName ) @ options.ConditionalCompilationDefines
1504+ let defines = ( SourceFileImpl.AdditionalDefinesForUseInEditor options.IsInteractive ) @ options.ConditionalCompilationDefines
15061505
15071506// Note: we don't really attempt to intern strings across a large scope.
15081507let lexResourceManager = new Lexhelp.LexResourceManager()
@@ -2520,7 +2519,7 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC
25202519let! tcErrors , tcFileResult =
25212520 Parser.CheckOneFile( parseResults, source, fileName, options.ProjectFileName, tcPrior.TcConfig, tcPrior.TcGlobals, tcPrior.TcImports,
25222521 tcPrior.TcState, loadClosure, tcPrior.Errors, reactorOps, ( fun () -> builder.IsAlive), textSnapshotInfo, userOpName)
2523- let parsingOptions = FSharpParsingOptions.FromTcConfig( tcPrior.TcConfig, Array.ofList builder.SourceFiles)
2522+ let parsingOptions = FSharpParsingOptions.FromTcConfig( tcPrior.TcConfig, Array.ofList builder.SourceFiles, options.UseScriptResolutionRules )
25242523let checkAnswer = MakeCheckFileAnswer( fileName, tcFileResult, options, builder, Array.ofList tcPrior.TcDependencyFiles, creationErrors, parseResults.Errors, tcErrors)
25252524 bc.RecordTypeCheckFileInProjectResults( fileName, options, parsingOptions, parseResults, fileVersion, tcPrior.TimeStamp, Some checkAnswer, source)
25262525return checkAnswer
@@ -2634,7 +2633,7 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC
26342633let! tcPrior = execWithReactorAsync<| fun ctok -> builder.GetCheckResultsBeforeFileInProject( ctok, filename)
26352634
26362635// Do the parsing.
2637- let parsingOptions = FSharpParsingOptions.FromTcConfig( builder.TcConfig, Array.ofList( builder.SourceFiles))
2636+ let parsingOptions = FSharpParsingOptions.FromTcConfig( builder.TcConfig, Array.ofList( builder.SourceFiles), options.UseScriptResolutionRules )
26382637let parseErrors , parseTreeOpt , anyErrors = Parser.parseFile( source, filename, parsingOptions, userOpName)
26392638let parseTreeOpt = parseTreeOpt|> Option.map builder.DeduplicateParsedInputModuleNameInProject
26402639let parseResults = FSharpParseFileResults( parseErrors, parseTreeOpt, anyErrors, builder.AllDependenciesDeprecated)
@@ -2914,7 +2913,7 @@ type FSharpChecker(legacyReferenceResolver, projectCacheSize, keepAssemblyConten
29142913member ic.GetParsingOptionsFromProjectOptions ( options ): FSharpParsingOptions * _ =
29152914let sourceFiles = List.ofArray options.SourceFiles
29162915let argv = List.ofArray options.OtherOptions
2917- ic.GetParsingOptionsFromCommandLineArgs( sourceFiles, argv)
2916+ ic.GetParsingOptionsFromCommandLineArgs( sourceFiles, argv, options.UseScriptResolutionRules )
29182917
29192918member ic.MatchBraces ( filename , source , options : FSharpProjectOptions , ? userOpName : string ) =
29202919let userOpName = defaultArg userOpName" Unknown"
@@ -3117,16 +3116,17 @@ type FSharpChecker(legacyReferenceResolver, projectCacheSize, keepAssemblyConten
31173116 ExtraProjectInfo= extraProjectInfo
31183117 Stamp= None}
31193118
3120- member ic.GetParsingOptionsFromCommandLineArgs ( initialSourceFiles , argv ) =
3119+ member ic.GetParsingOptionsFromCommandLineArgs ( initialSourceFiles , argv , ? isInteractive ) =
3120+ let isInteractive = defaultArg isInteractivefalse
31213121use errorScope= new ErrorScope()
31223122let tcConfigBuilder = TcConfigBuilder.Initial
31233123
31243124// Apply command-line arguments and collect more source files if they are in the arguments
31253125let sourceFilesNew = ApplyCommandLineArgs( tcConfigBuilder, initialSourceFiles, argv)
3126- FSharpParsingOptions.FromTcConfigBuidler( tcConfigBuilder, Array.ofList sourceFilesNew), errorScope.Diagnostics
3126+ FSharpParsingOptions.FromTcConfigBuidler( tcConfigBuilder, Array.ofList sourceFilesNew, isInteractive ), errorScope.Diagnostics
31273127
3128- member ic.GetParsingOptionsFromCommandLineArgs ( argv ) =
3129- ic.GetParsingOptionsFromCommandLineArgs([], argv)
3128+ member ic.GetParsingOptionsFromCommandLineArgs ( argv , ? isInteractive : bool ) =
3129+ ic.GetParsingOptionsFromCommandLineArgs([], argv, ?isInteractive = isInteractive )
31303130
31313131/// Begin background parsing the given project.
31323132member ic.StartBackgroundCompile ( options , ? userOpName ) =
@@ -3197,7 +3197,7 @@ type FsiInteractiveChecker(legacyReferenceResolver, reactorOps: IReactorOperatio
31973197let userOpName = defaultArg userOpName" Unknown"
31983198let filename = Path.Combine( tcConfig.implicitIncludeDir, " stdin.fsx" )
31993199// Note: projectSourceFiles is only used to compute isLastCompiland, and is ignored if Build.IsScript(mainInputFileName) is true (which it is in this case).
3200- let parsingOptions = FSharpParsingOptions.FromTcConfig( tcConfig, [| filename|])
3200+ let parsingOptions = FSharpParsingOptions.FromTcConfig( tcConfig, [| filename|], true )
32013201let parseErrors , parseTreeOpt , anyErrors = Parser.parseFile( source, filename, parsingOptions, userOpName)
32023202let dependencyFiles = [| |] // interactions have no dependencies
32033203let parseResults = FSharpParseFileResults( parseErrors, parseTreeOpt, parseHadErrors= anyErrors, dependencyFiles= dependencyFiles)
@@ -3240,8 +3240,8 @@ module CompilerEnvironment =
32403240let DefaultReferencesForOrphanSources ( assumeDotNetFramework ) = DefaultReferencesForScriptsAndOutOfProjectSources( assumeDotNetFramework)
32413241
32423242/// Publish compiler-flags parsing logic. Must be fast because its used by the colorizer.
3243- let GetCompilationDefinesForEditing ( filename : string , parsingOptions : FSharpParsingOptions ) =
3244- SourceFileImpl.AdditionalDefinesForUseInEditor( filename ) @
3243+ let GetCompilationDefinesForEditing ( parsingOptions : FSharpParsingOptions ) =
3244+ SourceFileImpl.AdditionalDefinesForUseInEditor( parsingOptions.IsInteractive ) @
32453245 parsingOptions.ConditionalCompilationDefines
32463246
32473247/// Return true if this is a subcategory of error or warning message that the language service can emit