public void VsTextViewCreated(IVsTextView textViewAdapter) { IVsTextLines textlines; textViewAdapter.GetBuffer(out textlines); if (textlines != null) { Guid langId; textlines.GetLanguageServiceID(out langId); if (langId == GuidStrings.guidLanguageService) // is our language service active ? { string fileName = FilePathUtilities.GetFilePath(textlines); if (!IsOurFile(fileName)) // is this a file node from Vulcan ? { Guid guidVulcanLanguageService = GuidStrings.guidVulcanLanguageService; textlines.SetLanguageServiceID(guidVulcanLanguageService); return; } // // Only capturing keystroke for OUR languageService... ??? // IWpfTextView textView = AdaptersFactory.GetWpfTextView(textViewAdapter); Debug.Assert(textView != null); CommandFilter filter = new CommandFilter(textView, CompletionBroker, NavigatorService.GetTextStructureNavigator(textView.TextBuffer), SignatureHelpBroker, aggregator); IOleCommandTarget next; textViewAdapter.AddCommandFilter(filter, out next); filter.Next = next; } } }
public int OnShellPropertyChange(int propid, object var) { // A modal dialog has been opened. Editor Options ? if (propid == (int)__VSSPROPID4.VSSPROPID_IsModal) { CommandFilter.InvalidateOptions(); } return(VSConstants.S_OK); }
public int OnShellPropertyChange(int propid, object var) { // A modal dialog has been opened. Editor Options ? if (propid == (int)__VSSPROPID4.VSSPROPID_IsModal && var is Boolean) { // when modal window closes if (!(Boolean)var) { CommandFilter.InvalidateOptions(); } } return(VSConstants.S_OK); }
public void VsTextViewCreated(IVsTextView textViewAdapter) { IVsTextLines textlines; textViewAdapter.GetBuffer(out textlines); if (textlines != null) { Guid langId; textlines.GetLanguageServiceID(out langId); IWpfTextView textView = AdaptersFactory.GetWpfTextView(textViewAdapter); Debug.Assert(textView != null); // Note that this may get called after the classifier has been instantiated if (langId == GuidStrings.guidLanguageService) // is our language service active ? { string fileName = FilePathUtilities.GetFilePath(textlines); if (!IsOurSourceFile(fileName)) // is this a file node from Vulcan ? { // we always register the file in the classifier. if (textView.TextBuffer.Properties.ContainsProperty(typeof(XSharpModel.XFile))) { textView.TextBuffer.Properties.RemoveProperty(typeof(XSharpModel.XFile)); } Guid guidVulcanLanguageService = GuidStrings.guidVulcanLanguageService; textlines.SetLanguageServiceID(guidVulcanLanguageService); return; } // // Only capturing keystroke for OUR languageService... ??? // // Get XFile and assign it to the textbuffer if (!textView.TextBuffer.Properties.ContainsProperty(typeof(XSharpModel.XFile))) { var file = XSharpModel.XSolution.FindFile(fileName); if (file != null) { textView.TextBuffer.Properties.AddProperty(typeof(XSharpModel.XFile), file); file.Interactive = true; } } CommandFilter filter = new CommandFilter(textView, CompletionBroker, NavigatorService.GetTextStructureNavigator(textView.TextBuffer), SignatureHelpBroker, aggregator, this); IOleCommandTarget next; textViewAdapter.AddCommandFilter(filter, out next); filter.Next = next; } } }