Browse Source

Fix #227: Class no longer available for code completion when file renamed

pull/315/head
Daniel Grunwald 12 years ago
parent
commit
33c72ed327
  1. 2
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpSemanticHighlighter.cs
  2. 2
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs
  3. 2
      src/Main/SharpDevelop/Parser/ParserService.cs
  4. 10
      src/Main/SharpDevelop/Parser/ParserServiceEntry.cs
  5. 4
      src/Main/SharpDevelop/Project/Build/BuildEngine.cs
  6. 11
      src/Main/SharpDevelop/Project/ProjectService.cs

2
src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpSemanticHighlighter.cs

@ -256,7 +256,7 @@ namespace CSharpBinding @@ -256,7 +256,7 @@ namespace CSharpBinding
if (parseInfo == null) {
if (invalidLines != null && !invalidLines.Contains(documentLine)) {
invalidLines.Add(documentLine);
Debug.WriteLine("Semantic highlighting for line {0} - marking as invalid", lineNumber);
//Debug.WriteLine("Semantic highlighting for line {0} - marking as invalid", lineNumber);
}
if (cachedLine != null) {

2
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs

@ -1027,7 +1027,7 @@ namespace ICSharpCode.AvalonEdit.Rendering @@ -1027,7 +1027,7 @@ namespace ICSharpCode.AvalonEdit.Rendering
if (heightTree.GetIsCollapsed(documentLine.LineNumber))
throw new InvalidOperationException("Trying to build visual line from collapsed line");
Debug.WriteLine("Building line " + documentLine.LineNumber);
//Debug.WriteLine("Building line " + documentLine.LineNumber);
VisualLine visualLine = new VisualLine(this, documentLine);
VisualLineTextSource textSource = new VisualLineTextSource(visualLine) {

2
src/Main/SharpDevelop/Parser/ParserService.cs

@ -194,6 +194,7 @@ namespace ICSharpCode.SharpDevelop.Parser @@ -194,6 +194,7 @@ namespace ICSharpCode.SharpDevelop.Parser
{
if (project == null)
throw new ArgumentNullException("project");
//SD.Log.Debug("Add " + fileName + " to " + project);
var entry = GetFileEntry(fileName, true);
entry.AddOwnerProject(project, isLinkedFile);
if (startAsyncParse)
@ -204,6 +205,7 @@ namespace ICSharpCode.SharpDevelop.Parser @@ -204,6 +205,7 @@ namespace ICSharpCode.SharpDevelop.Parser
{
if (project == null)
throw new ArgumentNullException("project");
//SD.Log.Debug("Remove " + fileName + " from " + project);
var entry = GetFileEntry(fileName, false);
if (entry != null)
entry.RemoveOwnerProject(project);

10
src/Main/SharpDevelop/Parser/ParserServiceEntry.cs

@ -214,8 +214,9 @@ namespace ICSharpCode.SharpDevelop.Parser @@ -214,8 +214,9 @@ namespace ICSharpCode.SharpDevelop.Parser
return new ProjectEntry(parentProject, parseInfo.UnresolvedFile, parseInfo);
} else {
if (versionComparison == 0 && index >= 0) {
// Ensure we have parse info for the specified project (entry.UnresolvedFile is null for newly registered projects)
// If full parse info is requested, ensure we have full parse info.
if (!(fullParseInformationRequested && entries[index].CachedParseInformation == null)) {
if (entries[index].UnresolvedFile != null && !(fullParseInformationRequested && entries[index].CachedParseInformation == null)) {
// We already have the requested version parsed, just return it:
return entries[index];
}
@ -271,6 +272,7 @@ namespace ICSharpCode.SharpDevelop.Parser @@ -271,6 +272,7 @@ namespace ICSharpCode.SharpDevelop.Parser
#region ParseAsync
Task<ProjectEntry> runningAsyncParseTask;
ITextSourceVersion runningAsyncParseFileContentVersion;
IProject runningAsyncParseProject;
bool runningAsyncParseFullInfoRequested;
public async Task<ParseInformation> ParseAsync(ITextSource fileContent, IProject parentProject, CancellationToken cancellationToken)
@ -312,8 +314,9 @@ namespace ICSharpCode.SharpDevelop.Parser @@ -312,8 +314,9 @@ namespace ICSharpCode.SharpDevelop.Parser
int index = FindIndexForProject(parentProject);
int versionComparison = CompareVersions(fileContent.Version);
if (versionComparison == 0 && index >= 0) {
// Ensure we have parse info for the specified project (entry.UnresolvedFile is null for newly registered projects)
// If full parse info is requested, ensure we have full parse info.
if (!(requestFullParseInformation && entries[index].CachedParseInformation == null)) {
if (entries[index].UnresolvedFile != null && !(requestFullParseInformation && entries[index].CachedParseInformation == null)) {
// We already have the requested version parsed, just return it:
return Task.FromResult(entries[index]);
}
@ -321,6 +324,7 @@ namespace ICSharpCode.SharpDevelop.Parser @@ -321,6 +324,7 @@ namespace ICSharpCode.SharpDevelop.Parser
// Optimization:
// if an equivalent task is already running, return that one instead
if (runningAsyncParseTask != null && (!requestFullParseInformation || runningAsyncParseFullInfoRequested)
&& runningAsyncParseProject == parentProject
&& runningAsyncParseFileContentVersion.BelongsToSameDocumentAs(fileContent.Version)
&& runningAsyncParseFileContentVersion.CompareAge(fileContent.Version) == 0)
{
@ -338,12 +342,14 @@ namespace ICSharpCode.SharpDevelop.Parser @@ -338,12 +342,14 @@ namespace ICSharpCode.SharpDevelop.Parser
lock (this) {
runningAsyncParseTask = null;
runningAsyncParseFileContentVersion = null;
runningAsyncParseProject = null;
}
}
}, cancellationToken);
if (fileContent != null && fileContent.Version != null && !cancellationToken.CanBeCanceled) {
runningAsyncParseTask = task;
runningAsyncParseFileContentVersion = fileContent.Version;
runningAsyncParseProject = parentProject;
runningAsyncParseFullInfoRequested = requestFullParseInformation;
}
}

4
src/Main/SharpDevelop/Project/Build/BuildEngine.cs

@ -30,7 +30,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -30,7 +30,7 @@ namespace ICSharpCode.SharpDevelop.Project
/// </summary>
/// <param name="project">The project/solution to build</param>
/// <param name="options">The build options that should be used</param>
/// <param name="realtimeBuildFeedbackSink">The build feedback sink that receives the build output.
/// <param name="buildFeedbackSink">The build feedback sink that receives the build output.
/// The output is nearly sent "as it comes in": sometimes output must wait because the BuildEngine
/// will ensure that output from two projects building in parallel isn't interleaved.</param>
/// <param name="progressMonitor">The progress monitor that receives build progress. The monitor will be disposed
@ -38,7 +38,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -38,7 +38,7 @@ namespace ICSharpCode.SharpDevelop.Project
public static Task<BuildResults> BuildAsync(IBuildable project, BuildOptions options, IBuildFeedbackSink buildFeedbackSink, IProgressMonitor progressMonitor)
{
if (project == null)
throw new ArgumentNullException("solution");
throw new ArgumentNullException("project");
if (options == null)
throw new ArgumentNullException("options");

11
src/Main/SharpDevelop/Project/ProjectService.cs

@ -137,7 +137,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -137,7 +137,7 @@ namespace ICSharpCode.SharpDevelop.Project
if (!CloseSolution(allowCancel: true))
return false;
FileUtility.ObservedLoad(OpenSolutionInternal, fileName);
return currentSolution != null;
}
@ -147,13 +147,6 @@ namespace ICSharpCode.SharpDevelop.Project @@ -147,13 +147,6 @@ namespace ICSharpCode.SharpDevelop.Project
using (var progress = AsynchronousWaitDialog.ShowWaitDialog("Loading Solution...")) {
solution = LoadSolutionFile(fileName, progress);
//(openSolution.Preferences as IMementoCapable).SetMemento(solutionProperties);
// try {
// ApplyConfigurationAndReadProjectPreferences();
// } catch (Exception ex) {
// MessageService.ShowException(ex);
// }
this.CurrentSolution = solution;
}
@ -263,7 +256,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -263,7 +256,7 @@ namespace ICSharpCode.SharpDevelop.Project
public event EventHandler<SolutionClosingEventArgs> SolutionClosing = delegate { };
public event EventHandler<SolutionEventArgs> SolutionClosed = delegate { };
public bool CloseSolution(bool allowCancel)
public bool CloseSolution(bool allowCancel = true)
{
SD.MainThread.VerifyAccess();
var solution = this.CurrentSolution;

Loading…
Cancel
Save