提交 162e6178 编写于 作者: T Tomáš Matoušek

Merge pull request #5220 from tmat/FixInit

Fix REPL initialization
......@@ -546,7 +546,9 @@ private void UpdateResolvers(ImmutableArray<string> changedReferenceSearchPaths,
}
var solution = _workspace.CurrentSolution;
var options = solution.GetProjectState(_currentSubmissionProjectId).CompilationOptions;
// Maybe called after reset, when no submissions are available.
var optionsOpt = (_currentSubmissionProjectId != null) ? solution.GetProjectState(_currentSubmissionProjectId).CompilationOptions : null;
if (changedWorkingDirectory != null)
{
......@@ -557,17 +559,28 @@ private void UpdateResolvers(ImmutableArray<string> changedReferenceSearchPaths,
{
ReferenceSearchPaths = changedReferenceSearchPaths;
_metadataReferenceResolver = CreateMetadataReferenceResolver(_workspace.CurrentSolution.Services.MetadataService, ReferenceSearchPaths, WorkingDirectory);
options = options.WithMetadataReferenceResolver(_metadataReferenceResolver);
if (optionsOpt != null)
{
optionsOpt = optionsOpt.WithMetadataReferenceResolver(_metadataReferenceResolver);
}
}
if (!changedSourceSearchPaths.IsDefault || changedWorkingDirectory != null)
{
SourceSearchPaths = changedSourceSearchPaths;
_sourceReferenceResolver = CreateSourceReferenceResolver(SourceSearchPaths, WorkingDirectory);
options = options.WithSourceReferenceResolver(_sourceReferenceResolver);
if (optionsOpt != null)
{
optionsOpt = optionsOpt.WithSourceReferenceResolver(_sourceReferenceResolver);
}
}
_workspace.SetCurrentSolution(solution.WithProjectCompilationOptions(_currentSubmissionProjectId, options));
if (optionsOpt != null)
{
_workspace.SetCurrentSolution(solution.WithProjectCompilationOptions(_currentSubmissionProjectId, optionsOpt));
}
}
public async Task SetPathsAsync(ImmutableArray<string> referenceSearchPaths, ImmutableArray<string> sourceSearchPaths, string workingDirectory)
......
......@@ -658,7 +658,7 @@ public void SetTestObjectFormattingOptions()
string fullPath = ResolveRelativePath(file.Path, rspDirectory, sourceSearchPaths, displayPath: true);
if (fullPath != null)
{
var newScriptState = await ExecuteFileAsync(state, fullPath).ConfigureAwait(false);
var newScriptState = await ExecuteFileAsync(rspState, fullPath).ConfigureAwait(false);
if (newScriptState != null)
{
rspState = rspState.WithScriptState(newScriptState);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册