public void Reset() { Model = null; FilePath = null; Diagnostics.Clear(); _lastWriteTimeUtc = DateTime.MinValue; }
public void Handle(AutodictorDiagnosticEvent message) { if (message.NameRailwayStation == StationOwner.Name) { Diagnostics.Clear(); Diagnostics.AddRange(message.DiagnosticData); } }
void SetDiagnostics(IEnumerable <CompilerDiagnostic> diags) { Diagnostics.Clear(); Diagnostics.AddRange(diags.OrderBy(a => a, CompilerDiagnosticComparer.Instance). Where(a => a.Severity != CompilerDiagnosticSeverity.Hidden). Select(a => new CompilerDiagnosticVM(a, GetImageReference(a.Severity) ?? default(ImageReference)))); SelectedCompilerDiagnosticVM = Diagnostics.FirstOrDefault(); }
public void StartCompiling() { Diagnostics.Clear(); Dependencies.Clear(); TranspilationDependencies = null; }
public EditorViewModel(EditorModel model) : base(model) { disposables = new CompositeDisposable(); highlightingData = new ObservableCollection <OffsetSyntaxHighlightingData>(); BeforeTextChangedCommand = ReactiveCommand.Create(); disposables.Add(BeforeTextChangedCommand.Subscribe(model.OnBeforeTextChanged)); TextChangedCommand = ReactiveCommand.Create(); disposables.Add(TextChangedCommand.Subscribe(model.OnTextChanged)); SaveCommand = ReactiveCommand.Create(); disposables.Add(SaveCommand.Subscribe(param => Save())); disposables.Add(CloseCommand.Subscribe(_ => { Model.ProjectFile.FileModifiedExternally -= ProjectFile_FileModifiedExternally; Model.Editor.CaretChangedByPointerClick -= Editor_CaretChangedByPointerClick; Save(); Model.ShutdownBackgroundWorkers(); Model.UnRegisterLanguageService(); intellisenseManager?.Dispose(); intellisenseManager = null; Diagnostics?.Clear(); ShellViewModel.Instance.InvalidateErrors(); Model.Dispose(); Intellisense.Dispose(); disposables.Dispose(); Model.TextDocument = null; })); AddWatchCommand = ReactiveCommand.Create(); disposables.Add(AddWatchCommand.Subscribe(_ => { IoC.Get <IWatchList>()?.AddWatch(WordAtCaret); })); tabCharacter = " "; model.DocumentLoaded += (sender, e) => { model.ProjectFile.FileModifiedExternally -= ProjectFile_FileModifiedExternally; Model.Editor.CaretChangedByPointerClick -= Editor_CaretChangedByPointerClick; foreach (var bgRenderer in languageServiceBackgroundRenderers) { BackgroundRenderers.Remove(bgRenderer); } languageServiceBackgroundRenderers.Clear(); foreach (var transformer in languageServiceDocumentLineTransformers) { DocumentLineTransformers.Remove(transformer); } languageServiceDocumentLineTransformers.Clear(); if (model.LanguageService != null) { languageServiceBackgroundRenderers.AddRange(model.LanguageService.GetBackgroundRenderers(model.ProjectFile)); foreach (var bgRenderer in languageServiceBackgroundRenderers) { BackgroundRenderers.Add(bgRenderer); } languageServiceDocumentLineTransformers.AddRange( model.LanguageService.GetDocumentLineTransformers(model.ProjectFile)); foreach (var textTransformer in languageServiceDocumentLineTransformers) { DocumentLineTransformers.Add(textTransformer); } intellisenseManager = new IntellisenseManager(Model.Editor, Intellisense, Intellisense.CompletionAssistant, model.LanguageService, model.ProjectFile); EventHandler <KeyEventArgs> tunneledKeyUpHandler = (send, ee) => { if (caretIndex > 0) { intellisenseManager.OnKeyUp(ee, CaretIndex, CaretTextLocation.Line, CaretTextLocation.Column); } }; EventHandler <KeyEventArgs> tunneledKeyDownHandler = (send, ee) => { if (caretIndex > 0) { intellisenseManager.OnKeyDown(ee, CaretIndex, CaretTextLocation.Line, CaretTextLocation.Column); } }; EventHandler <TextInputEventArgs> tunneledTextInputHandler = (send, ee) => { if (caretIndex > 0) { intellisenseManager.OnTextInput(ee, CaretIndex, CaretTextLocation.Line, CaretTextLocation.Column); } }; Model.Editor.CaretChangedByPointerClick += Editor_CaretChangedByPointerClick; disposables.Add(Model.Editor.AddHandler(InputElement.KeyDownEvent, tunneledKeyDownHandler, RoutingStrategies.Tunnel)); disposables.Add(Model.Editor.AddHandler(InputElement.KeyUpEvent, tunneledKeyUpHandler, RoutingStrategies.Tunnel)); disposables.Add(Model.Editor.AddHandler(InputElement.TextInputEvent, tunneledTextInputHandler, RoutingStrategies.Bubble)); } model.CodeAnalysisCompleted += (s, ee) => { Diagnostics = model.CodeAnalysisResults.Diagnostics; HighlightingData = new ObservableCollection <OffsetSyntaxHighlightingData>(model.CodeAnalysisResults.SyntaxHighlightingData); IndexItems = new ObservableCollection <IndexEntry>(model.CodeAnalysisResults.IndexItems); selectedIndexEntry = IndexItems.FirstOrDefault(); this.RaisePropertyChanged(nameof(SelectedIndexEntry)); ShellViewModel.Instance.InvalidateErrors(); }; model.ProjectFile.FileModifiedExternally += ProjectFile_FileModifiedExternally; TextDocument = model.TextDocument; Title = Model.ProjectFile.Name; }; model.TextChanged += (sender, e) => { if (ShellViewModel.Instance.DocumentTabs.TemporaryDocument == this) { Dock = Dock.Left; ShellViewModel.Instance.DocumentTabs.TemporaryDocument = null; } IsDirty = model.IsDirty; }; intellisense = new IntellisenseViewModel(model, this); documentLineTransformers = new ObservableCollection <IDocumentLineTransformer>(); backgroundRenderers = new ObservableCollection <IBackgroundRenderer>(); backgroundRenderers.Add(new SelectedLineBackgroundRenderer()); DebugLineHighlighter = new SelectedDebugLineBackgroundRenderer(); backgroundRenderers.Add(DebugLineHighlighter); backgroundRenderers.Add(new ColumnLimitBackgroundRenderer()); wordAtCaretHighlighter = new SelectedWordBackgroundRenderer(); backgroundRenderers.Add(wordAtCaretHighlighter); backgroundRenderers.Add(new SelectionBackgroundRenderer()); margins = new ObservableCollection <TextViewMargin>(); Dock = Dock.Right; }