diff --git a/src/OmniSharp.Script/ScriptProjectProvider.cs b/src/OmniSharp.Script/ScriptProjectProvider.cs index 6f49c9fa8f..817c9d8935 100644 --- a/src/OmniSharp.Script/ScriptProjectProvider.cs +++ b/src/OmniSharp.Script/ScriptProjectProvider.cs @@ -43,7 +43,7 @@ public class ScriptProjectProvider "System.Threading.Tasks" }; - private static readonly CSharpParseOptions ParseOptions = new CSharpParseOptions(LanguageVersion.CSharp8, DocumentationMode.Parse, SourceCodeKind.Script); + private static readonly CSharpParseOptions ParseOptions = new CSharpParseOptions(LanguageVersion.Latest, DocumentationMode.Parse, SourceCodeKind.Script); private readonly Lazy _compilationOptions; private readonly Lazy _commandLineArgs; @@ -103,7 +103,6 @@ private CSharpCompilationOptions CreateCompilationOptions() compilationOptions = compilationOptions .WithAllowUnsafe(true) - .WithMetadataReferenceResolver(metadataReferenceResolver) .WithSourceReferenceResolver(sourceResolver) .WithAssemblyIdentityComparer(DesktopAssemblyIdentityComparer.Default) diff --git a/tests/OmniSharp.Script.Tests/ScriptProjectProviderTests.cs b/tests/OmniSharp.Script.Tests/ScriptProjectProviderTests.cs new file mode 100644 index 0000000000..9339fba6ad --- /dev/null +++ b/tests/OmniSharp.Script.Tests/ScriptProjectProviderTests.cs @@ -0,0 +1,23 @@ +using System.IO; +using System.Linq; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.Scripting.Hosting; +using Microsoft.Extensions.Logging; +using OmniSharp.Services; +using Xunit; + +namespace OmniSharp.Script.Tests +{ + public class ScriptProjectProviderTests + { + [Fact] + public void DefaultLanguageVersionShouldBeLatest() + { + var scriptProjectProvider = new ScriptProjectProvider(new ScriptOptions(), new OmniSharpEnvironment(), new LoggerFactory(), true, false); + var scriptProjectInfo = scriptProjectProvider.CreateProject("test.csx", Enumerable.Empty(), Path.GetTempPath(), typeof(CommandLineScriptGlobals)); + Assert.Equal(LanguageVersion.Latest, ((CSharpParseOptions)scriptProjectInfo.ParseOptions).SpecifiedLanguageVersion); + Assert.Equal(LanguageVersion.CSharp9, ((CSharpParseOptions)scriptProjectInfo.ParseOptions).LanguageVersion); + } + } +} diff --git a/tests/OmniSharp.Script.Tests/WorkspaceInformationTests.cs b/tests/OmniSharp.Script.Tests/WorkspaceInformationTests.cs index 4f0ef5fbd7..626d4949c2 100644 --- a/tests/OmniSharp.Script.Tests/WorkspaceInformationTests.cs +++ b/tests/OmniSharp.Script.Tests/WorkspaceInformationTests.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Reflection; using System.Threading.Tasks; +using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Scripting.Hosting; using OmniSharp.Models.FilesChanged; using OmniSharp.Models.WorkspaceInformation;