diff --git a/CodeCompletion/DomSyntaxTreeVisitor.cs b/CodeCompletion/DomSyntaxTreeVisitor.cs index 7cd993af3..d919f4b36 100644 --- a/CodeCompletion/DomSyntaxTreeVisitor.cs +++ b/CodeCompletion/DomSyntaxTreeVisitor.cs @@ -2197,7 +2197,7 @@ namespace CodeCompletion } //add_standart_types_simple(); Stack regions_stack = new Stack(); - if (CodeCompletionController.comp.CompilerOptions.CurrentProject != null && CodeCompletionController.comp.CompilerOptions.CurrentProject.ContainsSourceFile(_unit_module.file_name)) + if (CodeCompletionController.comp != null && CodeCompletionController.comp.CompilerOptions.CurrentProject != null && CodeCompletionController.comp.CompilerOptions.CurrentProject.ContainsSourceFile(_unit_module.file_name)) { IReferenceInfo[] refs = CodeCompletionController.comp.CompilerOptions.CurrentProject.References; if (_unit_module.compiler_directives == null) @@ -2407,7 +2407,7 @@ namespace CodeCompletion cur_scope = unit_scope = new InterfaceUnitScope(new SymInfo("", SymbolKind.Namespace, "program"), null); CodeCompletionController.comp_modules[_program_module.file_name] = this.converter; Stack regions_stack = new Stack(); - if (CodeCompletionController.comp.CompilerOptions.CurrentProject != null && CodeCompletionController.comp.CompilerOptions.CurrentProject.ContainsSourceFile(_program_module.file_name)) + if (CodeCompletionController.comp != null && CodeCompletionController.comp.CompilerOptions.CurrentProject != null && CodeCompletionController.comp.CompilerOptions.CurrentProject.ContainsSourceFile(_program_module.file_name)) { IReferenceInfo[] refs = CodeCompletionController.comp.CompilerOptions.CurrentProject.References; if (_program_module.compiler_directives == null) diff --git a/VisualPascalABCNET/DS/VisualEnvironmentCompiler.cs b/VisualPascalABCNET/DS/VisualEnvironmentCompiler.cs index 102690d51..86a89d678 100644 --- a/VisualPascalABCNET/DS/VisualEnvironmentCompiler.cs +++ b/VisualPascalABCNET/DS/VisualEnvironmentCompiler.cs @@ -139,6 +139,11 @@ namespace VisualPascalABC { standartCompiler = new PascalABCCompiler.Compiler(SourceFilesProvider, OnChangeCompilerState); CodeCompletion.CodeCompletionController.comp = new PascalABCCompiler.Compiler((PascalABCCompiler.Compiler)standartCompiler, SourceFilesProvider, OnChangeCompilerState); + if (ProjectFactory.Instance.CurrentProject != null) + { + CodeCompletion.CodeCompletionController.comp.CompilerOptions.CurrentProject = ProjectFactory.Instance.CurrentProject; + ProjectFactory.Instance.Dirty = true; + } CodeCompletion.CodeCompletionController.ParsersController = standartCompiler.ParsersController; CodeCompletion.CodeCompletionController.StandartDirectories = StandartDirectories; diff --git a/VisualPascalABCNET/Workbench/ProjectService.cs b/VisualPascalABCNET/Workbench/ProjectService.cs index 8e24adf38..0b7c0b230 100644 --- a/VisualPascalABCNET/Workbench/ProjectService.cs +++ b/VisualPascalABCNET/Workbench/ProjectService.cs @@ -14,7 +14,7 @@ namespace VisualPascalABC public partial class Form1 : IWorkbenchProjectService { public List LastOpenProjects; - + public void NewProject() { NewProjectForm npf = new NewProjectForm();