public string GetProjectPath() { if (m_project == null) { return(""); } return(m_project.GetProjectPath()); }
public UIViewItem(ABnf abnf, ABnf abnf_ui, IWpfTextView view , SVsServiceProvider provider, IVsEditorAdaptersFactoryService adapters_factory , UIProjectInfo project, uint item_id, string full_path, ABnfFactory factory, string line_comment_begin) { m_left_pairs.Add("(", ")"); m_left_pairs.Add("[", "]"); m_left_pairs.Add("<", ">"); m_left_pairs.Add("{", "}"); m_right_pairs.Add(")", "("); m_right_pairs.Add("]", "["); m_right_pairs.Add(">", "<"); m_right_pairs.Add("}", "{"); // 保存相关信息 m_abnf = abnf; m_abnf_ui = abnf_ui; m_factory = factory; m_view = view; m_buffer = m_view.TextBuffer; m_provider = provider; m_project = project; m_item_id = item_id; m_adapters_factory = adapters_factory; m_full_path = full_path; m_line_comment_begin = line_comment_begin; if (m_view.Properties.TryGetProperty("version", out long version)) { m_view.Properties.RemoveProperty("version"); } ++version; m_view.Properties.AddProperty("version", version); string text = m_view.TextBuffer.CurrentSnapshot.GetText().Clone() as string; string project_path = null; if (m_project != null) { project_path = m_project.GetProjectPath(); m_project.AddViewItem(m_item_id, this); } if (m_view.Properties.TryGetProperty(nameof(ALanguageServer), out ALanguageServer server)) { server.AddTask(() => server.UpdateViewContent(m_view, project_path, m_item_id, m_full_path, text, version)); } m_view.TextBuffer.Changed += OnBufferChanged; m_view.GotAggregateFocus += OnViewFocusIn; m_view.LostAggregateFocus += OnViewFocusOut; }