public void UpdateGherkinHighlighing(bool installFolding = true) { if (string.IsNullOrEmpty(CurrentFilePath) || (MainGherkinEditor == null)) { return; } try { if (GherkinUtil.IsFeatureFile(CurrentFilePath)) { GherkinUtil.RegisterGherkinHighlighting(CurrentLanguage); IHighlightingDefinition highlighting = GetHighlightingDefinition(); UpdateEditorProperty(nameof(GherkinEditor.SyntaxHighlighting), highlighting); if (installFolding && (FoldingExecutor != null)) { FoldingExecutor.InstallFoldingManager(CurrentFilePath); } } } catch (Exception ex) { EventAggregator <StatusChangedArg> .Instance.Publish(this, new StatusChangedArg(ex.Message)); } }
private void OnFileNameChanged(object sender, EventArgs e) { var indentationStrategy = TextEditor.TextArea.IndentationStrategy; if (GherkinUtil.IsFeatureFile(Document.FileName)) { if (!(indentationStrategy is GherkinIndentationStrategy)) { TextEditor.TextArea.IndentationStrategy = new GherkinIndentationStrategy(TextEditor, SubTextEditor); } TextEditor.TextArea.Options.EditTableByTableEditorCmd = EditTableByTableEditorCmd; TextEditor.TextArea.Options.ReplaceTableFromGridCmd = ReplaceTableFromGridCmd; TextEditor.TextArea.Options.PasteTableFromGridCmd = PasteTableFromGridCmd; } else { if (GherkinUtil.IsCSharpFile(Document.FileName)) { if (!(indentationStrategy is CSharpIndentationStrategy)) { TextEditor.TextArea.IndentationStrategy = new CSharpIndentationStrategy(TextEditor.Options); } } TextEditor.TextArea.Options.EditTableByTableEditorCmd = null; TextEditor.TextArea.Options.ReplaceTableFromGridCmd = null; TextEditor.TextArea.Options.PasteTableFromGridCmd = null; } }
private void CreateFoldingStrategy(string filePath) { GherkinFoldingStrategy = null; XmlFoldingStrategy = null; if (GherkinUtil.IsFeatureFile(filePath)) { GherkinFoldingStrategy = new GherkinFoldingStrategy(); } else if (IsXMLFile(filePath)) { XmlFoldingStrategy = new XmlFoldingStrategy(); } }
private void SetSyntaxHighlighting(string filePath) { IHighlightingDefinition highlighting; if (GherkinUtil.IsFeatureFile(filePath)) { highlighting = HighlightingManager.Instance.GetDefinition(GherkinUtil.GherkinHighlightingName(CurrentLanguage)); } else { highlighting = HighlightingManager.Instance.GetDefinitionByExtension(Path.GetExtension(filePath)); } UpdateEditorProperty(nameof(GherkinEditor.SyntaxHighlighting), highlighting); }
private void UpdateEditor(string filePath) { bool isOldFileFeatureFile = GherkinUtil.IsFeatureFile(Document.FileName); SetSyntaxHighlighting(filePath); FoldingExecutor?.InstallFoldingManager(filePath); CurrentFilePath = filePath; Document.FileName = filePath; FileNameChangedEvent?.Invoke(filePath); if (isOldFileFeatureFile != IsFeatureFile) { HideScenarioIndex = !IsFeatureFile; } if (CurrentFilePath != filePath) { EventAggregator <FileSavedAsArg> .Instance.Publish(this, new FileSavedAsArg(CurrentFilePath)); } }
private bool CanPasteTableFromGrid() { return(GherkinUtil.IsFeatureFile(Document.FileName)); }
private bool CanReplaceTableFromGrid() { return(GherkinUtil.IsFeatureFile(Document.FileName) && IsCurrentLineTableRow()); }
private bool CanEditTableByTableEditor() { return(GherkinUtil.IsFeatureFile(Document.FileName) && IsCurrentLineTableRow()); }
private bool NeedShowVSplitView(string filePath) => m_AppSettings.EditorSettings.ShowSplitVerticalViewByDefault && GherkinUtil.IsFeatureFile(filePath);
private bool CanCommentOutSelectedLines() { return(GherkinUtil.IsFeatureFile(CurrentEditor?.Document?.FileName)); }
private bool HasFoldingStrategy(string filePath) { return(GherkinUtil.IsFeatureFile(filePath) || IsXMLFile(filePath)); }