protected override void Initialize() { base.Initialize(); // Proffer the service. var languageInfo = CreateLanguageInfo(); ((IServiceContainer)this).AddService(languageInfo.GetType(), languageInfo, true); // Hook up language preferences. var textMgr = (IVsTextManager)GetService(typeof(SVsTextManager)); var langPrefs = new LANGPREFERENCES[1]; langPrefs[0].guidLang = languageInfo.GetType().GUID; ErrorHandler.ThrowOnFailure(textMgr.GetUserPreferences(null, null, langPrefs, null)); LanguagePreferences = new LanguagePreferences(this, langPrefs[0]); var textManagerEvents2Guid = typeof(IVsTextManagerEvents2).GUID; IConnectionPoint textManagerEvents2ConnectionPoint; ((IConnectionPointContainer)textMgr).FindConnectionPoint(ref textManagerEvents2Guid, out textManagerEvents2ConnectionPoint); uint cookie; textManagerEvents2ConnectionPoint.Advise(LanguagePreferences, out cookie); RegisterEditorFactory(CreateEditorFactory()); }
public LanguagePreferences(PythonToolsService service, Guid languageGuid) { _service = service; _service.Site.AssertShellIsInitialized(); _textMgr = (IVsTextManager)service.Site.GetService(typeof(SVsTextManager)); if (_textMgr == null) { throw new NotSupportedException(""); } var langPrefs = new LANGPREFERENCES[1]; langPrefs[0].guidLang = languageGuid; ErrorHandler.ThrowOnFailure(_textMgr.GetUserPreferences(null, null, langPrefs, null)); _preferences = langPrefs[0]; var guid = typeof(IVsTextManagerEvents2).GUID; IConnectionPoint connectionPoint = null; (_textMgr as IConnectionPointContainer)?.FindConnectionPoint(ref guid, out connectionPoint); if (connectionPoint != null) { connectionPoint.Advise(this, out _cookie); } }
public int GetUserPreferences(VIEWPREFERENCES[] pViewPrefs, FRAMEPREFERENCES[] pFramePrefs, LANGPREFERENCES[] pLangPrefs, FONTCOLORPREFERENCES[] pColorPrefs) { if (pViewPrefs != null || pFramePrefs != null || pColorPrefs != null) { throw new NotImplementedException(); } LANGPREFERENCES2 langPrefs; if (_langPrefs.TryGetValue(pLangPrefs[0].guidLang, out langPrefs)) { pLangPrefs[0] = new LANGPREFERENCES() { fAutoListMembers = langPrefs.fAutoListMembers, fDropdownBar = langPrefs.fAutoListParams, fAutoListParams = langPrefs.fAutoListParams, fHideAdvancedAutoListMembers = langPrefs.fHideAdvancedAutoListMembers, fHotURLs = langPrefs.fHotURLs, fInsertTabs = langPrefs.fInsertTabs, fLineNumbers = langPrefs.fLineNumbers, fShowCompletion = langPrefs.fShowCompletion, fShowSmartIndent = langPrefs.fShowSmartIndent, fTwoWayTreeview = langPrefs.fTwoWayTreeview, fVirtualSpace = langPrefs.fVirtualSpace, fWordWrap = langPrefs.fWordWrap, guidLang = langPrefs.guidLang, IndentStyle = langPrefs.IndentStyle, szFileType = langPrefs.szFileType, uIndentSize = langPrefs.uIndentSize, uTabSize = langPrefs.uTabSize }; return(VSConstants.S_OK); } return(VSConstants.E_FAIL); }
protected override void Initialize() { SyntaxVisualizer.SyntaxVisualizerToolWindowCommand.Initialize(this); base.Initialize(); Instance = this; // Proffer the service. var languageInfo = new HlslLanguageInfo(this.AsVsServiceProvider()); ((IServiceContainer)this).AddService(typeof(HlslLanguageInfo), languageInfo, true); // Hook up language preferences. var textMgr = (IVsTextManager)GetService(typeof(SVsTextManager)); var langPrefs = new LANGPREFERENCES[1]; langPrefs[0].guidLang = typeof(HlslLanguageInfo).GUID; ErrorHandler.ThrowOnFailure(textMgr.GetUserPreferences(null, null, langPrefs, null)); LanguagePreferences = new HlslLanguagePreferences(this, langPrefs[0]); var textManagerEvents2Guid = typeof(IVsTextManagerEvents2).GUID; IConnectionPoint textManagerEvents2ConnectionPoint; ((IConnectionPointContainer)textMgr).FindConnectionPoint(ref textManagerEvents2Guid, out textManagerEvents2ConnectionPoint); uint cookie; textManagerEvents2ConnectionPoint.Advise(LanguagePreferences, out cookie); }
public void OnUserPreferencesChanged( VIEWPREFERENCES[] pViewPrefs, FRAMEPREFERENCES[] pFramePrefs, LANGPREFERENCES[] pLangPrefs, FONTCOLORPREFERENCES[] pColorPrefs) { try { Setup(); //if (pColorPrefs != null && pColorPrefs.Length > 0 && pColorPrefs[0].pColorTable != null) //{ // var guidFontCategory = (Guid)Marshal.PtrToStructure(pColorPrefs[0].pguidFontCategory, typeof(Guid)); // var guidColorService = (Guid)Marshal.PtrToStructure(pColorPrefs[0].pguidColorService, typeof(Guid)); // if (_guidColorService == Guid.Empty) // { // _guidColorService = guidColorService; // } // if (guidFontCategory == DefGuidList.guidTextEditorFontCategory && _guidColorService == guidColorService) // { // Setup(); // } //} } catch (Exception ex) { //Do Nothing } }
///////////////////////////////////////////////////////////////////////////// // Overridden Package Implementation #region Package Members /// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); var langService = new NodejsLanguageInfo(this); ((IServiceContainer)this).AddService(langService.GetType(), langService, true); RegisterProjectFactory(new NodejsProjectFactory(this)); RegisterEditorFactory(new NodejsEditorFactory(this)); RegisterEditorFactory(new NodejsEditorFactoryPromptForEncoding(this)); RegisterEditorFactory(new JadeEditorFactory(this)); // Add our command handlers for menu (commands must exist in the .vsct file) var commands = new List <Command> { new OpenReplWindowCommand(), new OpenRemoteDebugProxyFolderCommand(), new OpenRemoteDebugDocumentationCommand(), new SurveyNewsCommand(), new ImportWizardCommand(), new DiagnosticsCommand() }; try { commands.Add(new AzureExplorerAttachDebuggerCommand()); } catch (NotSupportedException) { } RegisterCommands(commands, Guids.NodejsCmdSet); IVsTextManager textMgr = (IVsTextManager)Instance.GetService(typeof(SVsTextManager)); var langPrefs = new LANGPREFERENCES[1]; langPrefs[0].guidLang = typeof(NodejsLanguageInfo).GUID; ErrorHandler.ThrowOnFailure(textMgr.GetUserPreferences(null, null, langPrefs, null)); _langPrefs = new LanguagePreferences(langPrefs[0]); var textManagerEvents2Guid = typeof(IVsTextManagerEvents2).GUID; IConnectionPoint textManagerEvents2ConnectionPoint; ((IConnectionPointContainer)textMgr).FindConnectionPoint(ref textManagerEvents2Guid, out textManagerEvents2ConnectionPoint); uint cookie; textManagerEvents2ConnectionPoint.Advise(_langPrefs, out cookie); var textManagerEventsGuid = typeof(IVsTextManagerEvents).GUID; IConnectionPoint textManagerEventsConnectionPoint; ((IConnectionPointContainer)textMgr).FindConnectionPoint(ref textManagerEventsGuid, out textManagerEventsConnectionPoint); textManagerEventsConnectionPoint.Advise(new DataTipTextManagerEvents(this), out cookie); MakeDebuggerContextAvailable(); IntellisenseOptionsPage.AnalysisLogMaximumChanged += IntellisenseOptionsPage_AnalysisLogMaximumChanged; InitializeLogging(); }
public LanguageSettings() { IVsTextManager textManager = (IVsTextManager)Package.GetGlobalService(typeof(SVsTextManager)); LANGPREFERENCES[] preferences = new LANGPREFERENCES[1]; preferences[0].guidLang = Guids.ScssLanguageService; if (textManager.GetUserPreferences(null, null, preferences, null) == 0) _Preferences = preferences[0]; }
internal PythonToolsService(IServiceContainer container) { _container = container; var langService = new PythonLanguageInfo(container); _container.AddService(langService.GetType(), langService, true); IVsTextManager textMgr = (IVsTextManager)container.GetService(typeof(SVsTextManager)); if (textMgr != null) { var langPrefs = new LANGPREFERENCES[1]; langPrefs[0].guidLang = typeof(PythonLanguageInfo).GUID; ErrorHandler.ThrowOnFailure(textMgr.GetUserPreferences(null, null, langPrefs, null)); _langPrefs = new LanguagePreferences(this, langPrefs[0]); Guid guid = typeof(IVsTextManagerEvents2).GUID; IConnectionPoint connectionPoint; ((IConnectionPointContainer)textMgr).FindConnectionPoint(ref guid, out connectionPoint); connectionPoint.Advise(_langPrefs, out _langPrefsTextManagerCookie); } _optionsService = (IPythonToolsOptionsService)container.GetService(typeof(IPythonToolsOptionsService)); var compModel = (IComponentModel)container.GetService(typeof(SComponentModel)); _interpreterRegistry = compModel.GetService <IInterpreterRegistryService>(); if (_interpreterRegistry != null) { _interpreterRegistry.InterpretersChanged += InterpretersChanged; } _interpreterOptionsService = compModel.GetService <IInterpreterOptionsService>(); if (_interpreterOptionsService != null) // not available in some test cases... { _interpreterOptionsService.DefaultInterpreterChanged += UpdateDefaultAnalyzer; LoadInterpreterOptions(); } _idleManager = new IdleManager(container); _advancedOptions = new AdvancedEditorOptions(this); _debuggerOptions = new DebuggerOptions(this); _generalOptions = new GeneralOptions(this); _surveyNews = new SurveyNewsService(container); _suppressDialogOptions = new SuppressDialogOptions(this); _globalInterpreterOptions = new GlobalInterpreterOptions(this, _interpreterOptionsService, _interpreterRegistry); _globalInterpreterOptions.Load(); _interactiveOptions = new PythonInteractiveOptions(this, "Interactive"); _interactiveOptions.Load(); _debugInteractiveOptions = new PythonInteractiveOptions(this, "Debug Interactive Window"); _debuggerOptions.Load(); _factoryProviders = ComponentModel.DefaultExportProvider.GetExports <IPythonInterpreterFactoryProvider, Dictionary <string, object> >(); _logger = new PythonToolsLogger(ComponentModel.GetExtensions <IPythonToolsLogger>().ToArray()); InitializeLogging(); }
public void OnUserPreferencesChanged(VIEWPREFERENCES[] pViewPrefs, FRAMEPREFERENCES[] pFramePrefs, LANGPREFERENCES[] pLangPrefs, FONTCOLORPREFERENCES[] pColorPrefs) { if (pLangPrefs != null) { var preferences = pLangPrefs.Where(i => i.guidLang == _Preferences.guidLang).ToArray(); if (preferences.Length > 0) { _Preferences = preferences[0]; } } }
internal static void SetEditorOptions(IEditorOptions options, Guid languageServiceGuid) { IVsTextManager textMgr = (IVsTextManager)InteractiveWindowPackage.GetGlobalService(typeof(SVsTextManager)); var langPrefs = new LANGPREFERENCES[1]; langPrefs[0].guidLang = languageServiceGuid; ErrorHandler.ThrowOnFailure(textMgr.GetUserPreferences(null, null, langPrefs, null)); options.SetOptionValue(DefaultTextViewHostOptions.ChangeTrackingId, false); options.SetOptionValue(DefaultOptions.ConvertTabsToSpacesOptionId, langPrefs[0].fInsertTabs == 0); options.SetOptionValue(DefaultOptions.TabSizeOptionId, (int)langPrefs[0].uTabSize); options.SetOptionValue(DefaultOptions.IndentSizeOptionId, (int)langPrefs[0].uIndentSize); }
public LanguageSettings() { var textManager = (IVsTextManager)Package.GetGlobalService(typeof(SVsTextManager)); var preferences = new LANGPREFERENCES[1]; preferences[0].guidLang = new Guid("5b6692e7-a860-4b7d-9242-a6781510dee0"); if (textManager.GetUserPreferences(null, null, preferences, null) == 0) { _Preferences = preferences[0]; } }
public LanguageSettings() { IVsTextManager textManager = (IVsTextManager)Package.GetGlobalService(typeof(SVsTextManager)); LANGPREFERENCES[] preferences = new LANGPREFERENCES[1]; preferences[0].guidLang = Guids.ScssLanguageService; if (textManager.GetUserPreferences(null, null, preferences, null) == 0) { _Preferences = preferences[0]; } }
private void SetEditorOptions(IEditorOptions options, Guid languageServiceGuid) { IVsTextManager textMgr = (IVsTextManager)InteractiveWindowPackage.GetGlobalService(typeof(SVsTextManager)); var langPrefs = new LANGPREFERENCES[1]; langPrefs[0].guidLang = languageServiceGuid; ErrorHandler.ThrowOnFailure(textMgr.GetUserPreferences(null, null, langPrefs, null)); options.SetOptionValue(DefaultTextViewHostOptions.ChangeTrackingId, false); options.SetOptionValue(DefaultOptions.ConvertTabsToSpacesOptionId, langPrefs[0].fInsertTabs == 0); options.SetOptionValue(DefaultOptions.TabSizeOptionId, (int)langPrefs[0].uTabSize); options.SetOptionValue(DefaultOptions.IndentSizeOptionId, (int)langPrefs[0].uIndentSize); }
private void InitializeLangPrefs() { IVsTextManager textMgr = (IVsTextManager)Instance.GetService(typeof(SVsTextManager)); var langPrefs = new LANGPREFERENCES[1]; langPrefs[0].guidLang = typeof(VSGenero4GLLanguageInfo).GUID; int result = textMgr.GetUserPreferences(null, null, langPrefs, null); _langPrefs = new Genero4GLLanguagePreferences(langPrefs[0]); Guid guid = typeof(IVsTextManagerEvents2).GUID; IConnectionPoint connectionPoint; ((IConnectionPointContainer)textMgr).FindConnectionPoint(ref guid, out connectionPoint); uint cookie; connectionPoint.Advise(_langPrefs, out cookie); }
public void OnUserPreferencesChanged( VIEWPREFERENCES[] pViewPrefs, FRAMEPREFERENCES[] pFramePrefs, LANGPREFERENCES[] pLangPrefs, FONTCOLORPREFERENCES[] pColorPrefs) { if (pColorPrefs != null && pColorPrefs.Length > 0 && pColorPrefs[0].pColorTable != null) { var guidFontCategory = (Guid) Marshal.PtrToStructure(pColorPrefs[0].pguidFontCategory, typeof(Guid)); var guidColorService = (Guid) Marshal.PtrToStructure(pColorPrefs[0].pguidColorService, typeof(Guid)); if (_guidColorService == Guid.Empty) _guidColorService = guidColorService; if (guidFontCategory == DefGuidList.guidTextEditorFontCategory && _guidColorService == guidColorService) FontAndColorStorage.UpdateColors(); } }
void dteEvents_OnStartupComplete() { if (BabePackage.Setting.IsFirstInstall) { BabePackage.WindowManager.ShowSettingWindow(); //BabePackage.Current.ShowFolderWindow(null, null); //BabePackage.Current.ShowOutlineWindow(null, null); //var props = DTE.Properties["TextEditor", "Lua"]; //props.Item("IndentStyle").Value = EnvDTE.vsIndentStyle.vsIndentStyleDefault; } else if (!string.IsNullOrWhiteSpace(BabePackage.Setting.CurrentSetting)) { IntellisenseHelper.Scan(); } if (BabePackage.Setting.HideUselessViews) { HiddenVSWindows(); } //打开上次关闭时打开的文件 //启动完成。开始初始化。 //如果是此版本第一次运行,更改缩进设置项为“块” if (Properties.Settings.Default.IsFirstRun) { IVsTextManager textMgr = (IVsTextManager)BabePackage.Current.GetService(typeof(SVsTextManager)); var langPrefs = new LANGPREFERENCES[1]; langPrefs[0].guidLang = typeof(LuaLanguageInfo).GUID; ErrorHandler.ThrowOnFailure(textMgr.GetUserPreferences(null, null, langPrefs, null)); langPrefs[0].IndentStyle = Microsoft.VisualStudio.TextManager.Interop.vsIndentStyle.vsIndentStyleDefault; textMgr.SetUserPreferences(null, null, langPrefs, null); Properties.Settings.Default.IsFirstRun = false; Properties.Settings.Default.Save(); } //注册编辑器内容变化通知 TextViewCreationListener.FileContentChanged += TextViewCreationListener_FileContentChanged; Logger.UploadLog(); Updater.CheckVersion(); }
private void GetLanguagePrefs() { if (this.textMgr != null) { this.prefs.guidLang = langSvc; LANGPREFERENCES[] langPrefs = new LANGPREFERENCES[1]; langPrefs[0] = this.prefs; try { if (!this.user) { textMgr.GetPerLanguagePreferences(langPrefs); } else { textMgr.GetUserPreferences(null, null, langPrefs, null); } this.prefs = langPrefs[0]; } catch (Exception ex) { Trace.WriteLine(ex.Message); } } }
private static LANGPREFERENCES2 FromLangPrefs(LANGPREFERENCES langPrefs) { return(new LANGPREFERENCES2 { fAutoListMembers = langPrefs.fAutoListMembers, fAutoListParams = langPrefs.fAutoListParams, fDropdownBar = langPrefs.fDropdownBar, fHideAdvancedAutoListMembers = langPrefs.fHideAdvancedAutoListMembers, fHotURLs = langPrefs.fHotURLs, fInsertTabs = langPrefs.fInsertTabs, fLineNumbers = langPrefs.fLineNumbers, fShowCompletion = langPrefs.fShowCompletion, fShowSmartIndent = langPrefs.fShowSmartIndent, fTwoWayTreeview = langPrefs.fTwoWayTreeview, fVirtualSpace = langPrefs.fVirtualSpace, fWordWrap = langPrefs.fWordWrap, IndentStyle = langPrefs.IndentStyle, guidLang = langPrefs.guidLang, szFileType = langPrefs.szFileType, uIndentSize = langPrefs.uIndentSize, uTabSize = langPrefs.uTabSize }); }
private bool TryGetTextManagerOptionValue(string valueName, ref int optionValue) { bool result = false; // Note: The CacheLanguageGuids method (used by LanguageGuids.Value) depends on // MainPackage.Instance, so we can't pull Value until the package instance is set. Guid langGuid; if (MainPackage.Instance != null && LanguageGuids.Value.TryGetValue(this.textManagerLanguageName, out langGuid)) { IVsTextManager textManager = (IVsTextManager)MainPackage.GetGlobalService(typeof(SVsTextManager)); if (textManager != null) { LANGPREFERENCES[] langPrefs = new LANGPREFERENCES[1]; langPrefs[0].guidLang = langGuid; int hr = textManager.GetUserPreferences(null, null, langPrefs, null); if (ErrorHandler.Succeeded(hr)) { switch (valueName) { case InsertTabsOptionName: optionValue = unchecked ((int)langPrefs[0].fInsertTabs); result = true; break; case TabSizeOptionName: optionValue = unchecked ((int)langPrefs[0].uTabSize); result = true; break; } } } } return(result); }
protected override void Initialize() { base.Initialize(); Instance = this; this.languageInfo = new GLSLLanguageInfo(); ((IServiceContainer)this).AddService(typeof(GLSLLanguageInfo), this.languageInfo, true); this.RegisterEditorFactory(new GLSLEditorFactoryWithoutEncoding(this)); IVsTextManager textManager = (IVsTextManager)this.GetService(typeof(SVsTextManager)); LANGPREFERENCES[] lanaguagePreferences = new LANGPREFERENCES[1]; lanaguagePreferences[0].guidLang = typeof(GLSLLanguageInfo).GUID; ErrorHandler.ThrowOnFailure(textManager.GetUserPreferences(null, null, lanaguagePreferences, null)); this.Preferences = new GLSLPreferences(lanaguagePreferences[0]); Guid events2Guid = typeof(IVsTextManagerEvents2).GUID; ((IConnectionPointContainer)textManager).FindConnectionPoint(ref events2Guid, out this.connectionPoint); this.connectionPoint.Advise(this.Preferences, out this.cookie); }
public PowerShellLanguageInfo(IServiceContainer serviceContainer) { _serviceContainer = serviceContainer; _componentModel = serviceContainer.GetService(typeof(SComponentModel)) as IComponentModel; _editorAdaptersFactoryService = _componentModel.GetService <IVsEditorAdaptersFactoryService>(); IVsTextManager textMgr = (IVsTextManager)serviceContainer.GetService(typeof(SVsTextManager)); if (textMgr != null) { // Load the initial settings var langPrefs = new LANGPREFERENCES[1]; langPrefs[0].guidLang = typeof(PowerShellLanguageInfo).GUID; ErrorHandler.ThrowOnFailure(textMgr.GetUserPreferences(null, null, langPrefs, null)); _langPrefs = new PowerShellLanguagePreferences(langPrefs[0]); // Hook up to the setting change Guid guid = typeof(IVsTextManagerEvents2).GUID; Microsoft.VisualStudio.OLE.Interop.IConnectionPoint connectionPoint; ((Microsoft.VisualStudio.OLE.Interop.IConnectionPointContainer)textMgr).FindConnectionPoint(ref guid, out connectionPoint); uint cookie; connectionPoint.Advise(_langPrefs, out cookie); } }
public LanguagePreferences(PythonToolsService service, LANGPREFERENCES preferences) { _preferences = preferences; _service = service; }
///////////////////////////////////////////////////////////////////////////// // Overriden Package Implementation /// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initilaization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); // Add our command handlers for menu (commands must exist in the .vsct file) OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (null != mcs) { foreach (var command in Commands.CommandTable.Commands) { var beforeQueryStatus = command.BeforeQueryStatus; CommandID toolwndCommandID = new CommandID(GuidList.guidIronPythonToolsCmdSet, command.CommandId); if (beforeQueryStatus == null) { MenuCommand menuToolWin = new MenuCommand(command.DoCommand, toolwndCommandID); mcs.AddCommand(menuToolWin); } else { OleMenuCommand menuToolWin = new OleMenuCommand(command.DoCommand, toolwndCommandID); menuToolWin.BeforeQueryStatus += beforeQueryStatus; mcs.AddCommand(menuToolWin); } } } // This is just to force the MEF creation of the DLR runtime hosting layer, including the content type and runtime. if (RuntimeHost == null) { throw new InvalidOperationException("Unable to obtain the DLR Runtime hosting component"); } RuntimeHost.EnterOutliningModeOnOpen = OptionsPage.EnterOutliningModeOnOpen; // register our language service so that we can support features like the navigation bar var langService = new PythonLanguageInfo(this); ((IServiceContainer)this).AddService(langService.GetType(), langService, true); var solution = (IVsSolution)Package.GetGlobalService(typeof(SVsSolution)); uint cookie; ErrorHandler.ThrowOnFailure(solution.AdviseSolutionEvents(new SolutionAdvisor(), out cookie)); IVsTextManager textMgr = (IVsTextManager)Instance.GetService(typeof(SVsTextManager)); var langPrefs = new LANGPREFERENCES[1]; langPrefs[0].guidLang = typeof(PythonLanguageInfo).GUID; ErrorHandler.ThrowOnFailure(textMgr.GetUserPreferences(null, null, langPrefs, null)); _langPrefs = new LanguagePreferences(langPrefs[0]); Guid guid = typeof(IVsTextManagerEvents2).GUID; IConnectionPoint connectionPoint; ((IConnectionPointContainer)textMgr).FindConnectionPoint(ref guid, out connectionPoint); connectionPoint.Advise(_langPrefs, out cookie); // propagate options to our runtime host RuntimeHost.IntersectMembers = IntellisenseOptionsPage.IntersectMembers; RuntimeHost.EnterOutliningModeOnOpen = OptionsPage.EnterOutliningModeOnOpen; RuntimeHost.HideAdvancedMembers = Instance.LangPrefs.HideAdvancedMembers; }
public LanguagePreferences(LanguagePackageBase package, LANGPREFERENCES preferences) { _package = package; _preferences = preferences; }
///////////////////////////////////////////////////////////////////////////// // Overridden Package Implementation #region Package Members /// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); SubscribeToVsCommandEvents( (int)VSConstants.VSStd97CmdID.AddNewProject, delegate { NewProjectFromExistingWizard.IsAddNewProjectCmd = true; }, delegate { NewProjectFromExistingWizard.IsAddNewProjectCmd = false; } ); var langService = new NodejsLanguageInfo(this); ((IServiceContainer)this).AddService(langService.GetType(), langService, true); ((IServiceContainer)this).AddService(typeof(ClipboardServiceBase), new ClipboardService(), true); RegisterProjectFactory(new NodejsProjectFactory(this)); RegisterEditorFactory(new NodejsEditorFactory(this)); RegisterEditorFactory(new NodejsEditorFactoryPromptForEncoding(this)); RegisterEditorFactory(new JadeEditorFactory(this)); // Add our command handlers for menu (commands must exist in the .vsct file) var commands = new List <Command> { new OpenReplWindowCommand(), new OpenRemoteDebugProxyFolderCommand(), new OpenRemoteDebugDocumentationCommand(), new SurveyNewsCommand(), new ImportWizardCommand(), new DiagnosticsCommand(this) }; try { commands.Add(new AzureExplorerAttachDebuggerCommand()); } catch (NotSupportedException) { } RegisterCommands(commands, Guids.NodejsCmdSet); IVsTextManager textMgr = (IVsTextManager)Instance.GetService(typeof(SVsTextManager)); var langPrefs = new LANGPREFERENCES[1]; langPrefs[0].guidLang = typeof(NodejsLanguageInfo).GUID; ErrorHandler.ThrowOnFailure(textMgr.GetUserPreferences(null, null, langPrefs, null)); _langPrefs = new LanguagePreferences(langPrefs[0]); var textManagerEvents2Guid = typeof(IVsTextManagerEvents2).GUID; IConnectionPoint textManagerEvents2ConnectionPoint; ((IConnectionPointContainer)textMgr).FindConnectionPoint(ref textManagerEvents2Guid, out textManagerEvents2ConnectionPoint); uint cookie; textManagerEvents2ConnectionPoint.Advise(_langPrefs, out cookie); var textManagerEventsGuid = typeof(IVsTextManagerEvents).GUID; IConnectionPoint textManagerEventsConnectionPoint; ((IConnectionPointContainer)textMgr).FindConnectionPoint(ref textManagerEventsGuid, out textManagerEventsConnectionPoint); textManagerEventsConnectionPoint.Advise(new DataTipTextManagerEvents(this), out cookie); MakeDebuggerContextAvailable(); IntellisenseOptionsPage.AnalysisLogMaximumChanged += IntellisenseOptionsPage_AnalysisLogMaximumChanged; InitializeLogging(); InitializeTelemetry(); // The variable is inherited by child processes backing Test Explorer, and is used in // the NTVS test discoverer and test executor to connect back to VS. Environment.SetEnvironmentVariable(NodejsConstants.NodeToolsProcessIdEnvironmentVariable, Process.GetCurrentProcess().Id.ToString()); }
public AlpaLanguagePreferences(AlpaLanguageService service, LANGPREFERENCES preferences) { _preferences = preferences; _service = service; }
public int SetPerLanguagePreferences(LANGPREFERENCES[] pLangPrefs) { throw new Exception("The method or operation is not implemented."); }
public LanguagePreferences(LANGPREFERENCES preferences) { _preferences = preferences; }
///////////////////////////////////////////////////////////////////////////// // Overriden Package Implementation /// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initilaization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); // register our language service so that we can support features like the navigation bar var langService = new JLanguageInfo(this); ((IServiceContainer)this).AddService(langService.GetType(), langService, true); var solution = (IVsSolution)Package.GetGlobalService(typeof(SVsSolution)); _solutionAdvisor = new SolutionAdvisor(solution); IVsTextManager textMgr = (IVsTextManager)Instance.GetService(typeof(SVsTextManager)); var langPrefs = new LANGPREFERENCES[1]; langPrefs[0].guidLang = typeof(JLanguageInfo).GUID; ErrorHandler.ThrowOnFailure(textMgr.GetUserPreferences(null, null, langPrefs, null)); _langPrefs = new LanguagePreferences(langPrefs[0]); Guid guid = typeof(IVsTextManagerEvents2).GUID; IConnectionPoint connectionPoint; ((IConnectionPointContainer)textMgr).FindConnectionPoint(ref guid, out connectionPoint); uint cookie; connectionPoint.Advise(_langPrefs, out cookie); var model = GetService(typeof(SComponentModel)) as IComponentModel; // Add our command handlers for menu (commands must exist in the .vsct file) RegisterCommands(new Command[] { new OpenDebugReplCommand(), new ExecuteInReplCommand(), new SendToReplCommand(), new DebugAsScriptCommand(), new FillParagraphCommand(), new SendToDefiningModuleCommand(), new DiagnosticsCommand(), new RemoveImportsCommand(), new RemoveImportsCurrentScopeCommand() }); RegisterCommands(GetReplCommands()); InterpreterOptionsPage.InterpretersChanged += OnInterpretersChanged; InterpreterOptionsPage.DefaultInterpreterChanged += UpdateDefaultAnalyzer; _solutionEventListener = new UpdateSolutionEventsListener(JToolsPackage.Instance); }
public HlslLanguagePreferences(HlslToolsPackage package, LANGPREFERENCES preferences) { _package = package; _preferences = preferences; }
public Genero4GLLanguagePreferences(LANGPREFERENCES preferences) { _preferences = preferences; VSGeneroPackage.Instance.AdvancedOptions4GL.OptionsChanged += AdvancedOptions4GL_OptionsChanged; }
///////////////////////////////////////////////////////////////////////////// // Overridden Package Implementation #region Package Members /// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); SubscribeToVsCommandEvents( (int)VSConstants.VSStd97CmdID.AddNewProject, delegate { NewProjectFromExistingWizard.IsAddNewProjectCmd = true; }, delegate { NewProjectFromExistingWizard.IsAddNewProjectCmd = false; } ); var langService = new NodejsLanguageInfo(this); ((IServiceContainer)this).AddService(langService.GetType(), langService, true); ((IServiceContainer)this).AddService(typeof(ClipboardServiceBase), new ClipboardService(), true); RegisterProjectFactory(new NodejsProjectFactory(this)); RegisterEditorFactory(new NodejsEditorFactory(this)); RegisterEditorFactory(new NodejsEditorFactoryPromptForEncoding(this)); RegisterEditorFactory(new JadeEditorFactory(this)); // Add our command handlers for menu (commands must exist in the .vsct file) var commands = new List<Command> { new OpenReplWindowCommand(), new OpenRemoteDebugProxyFolderCommand(), new OpenRemoteDebugDocumentationCommand(), new SurveyNewsCommand(), new ImportWizardCommand(), new DiagnosticsCommand(this) }; try { commands.Add(new AzureExplorerAttachDebuggerCommand()); } catch (NotSupportedException) { } RegisterCommands(commands, Guids.NodejsCmdSet); IVsTextManager textMgr = (IVsTextManager)Instance.GetService(typeof(SVsTextManager)); var langPrefs = new LANGPREFERENCES[1]; langPrefs[0].guidLang = typeof(NodejsLanguageInfo).GUID; ErrorHandler.ThrowOnFailure(textMgr.GetUserPreferences(null, null, langPrefs, null)); _langPrefs = new LanguagePreferences(langPrefs[0]); var textManagerEvents2Guid = typeof(IVsTextManagerEvents2).GUID; IConnectionPoint textManagerEvents2ConnectionPoint; ((IConnectionPointContainer)textMgr).FindConnectionPoint(ref textManagerEvents2Guid, out textManagerEvents2ConnectionPoint); uint cookie; textManagerEvents2ConnectionPoint.Advise(_langPrefs, out cookie); var textManagerEventsGuid = typeof(IVsTextManagerEvents).GUID; IConnectionPoint textManagerEventsConnectionPoint; ((IConnectionPointContainer)textMgr).FindConnectionPoint(ref textManagerEventsGuid, out textManagerEventsConnectionPoint); textManagerEventsConnectionPoint.Advise(new DataTipTextManagerEvents(this), out cookie); MakeDebuggerContextAvailable(); IntellisenseOptionsPage.AnalysisLogMaximumChanged += IntellisenseOptionsPage_AnalysisLogMaximumChanged; InitializeLogging(); InitializeTelemetry(); // The variable is inherited by child processes backing Test Explorer, and is used in // the NTVS test discoverer and test executor to connect back to VS. Environment.SetEnvironmentVariable(NodejsConstants.NodeToolsProcessIdEnvironmentVariable, Process.GetCurrentProcess().Id.ToString()); }
public PowerShellLanguagePreferences(LANGPREFERENCES preferences) { _preferences = preferences; }
public Genero4GLLanguagePreferences(LANGPREFERENCES preferences) { _preferences = preferences; }
public void OnUserPreferencesChanged(VIEWPREFERENCES[] pViewPrefs, FRAMEPREFERENCES[] pFramePrefs, LANGPREFERENCES[] pLangPrefs, FONTCOLORPREFERENCES[] pColorPrefs) { var handler = UserPreferencesChanged; if (handler != null) { handler(this, EventArgs.Empty); } }
///////////////////////////////////////////////////////////////////////////// // Overriden Package Implementation /// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initilaization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); // register our language service so that we can support features like the navigation bar var langService = new PythonLanguageInfo(this); ((IServiceContainer)this).AddService(langService.GetType(), langService, true); var solution = (IVsSolution)Package.GetGlobalService(typeof(SVsSolution)); //ErrorHandler.ThrowOnFailure(solution.AdviseSolutionEvents(new SolutionAdvisor(), out cookie)); IVsTextManager textMgr = (IVsTextManager)Instance.GetService(typeof(SVsTextManager)); var langPrefs = new LANGPREFERENCES[1]; langPrefs[0].guidLang = typeof(PythonLanguageInfo).GUID; ErrorHandler.ThrowOnFailure(textMgr.GetUserPreferences(null, null, langPrefs, null)); _langPrefs = new LanguagePreferences(langPrefs[0]); Guid guid = typeof(IVsTextManagerEvents2).GUID; IConnectionPoint connectionPoint; ((IConnectionPointContainer)textMgr).FindConnectionPoint(ref guid, out connectionPoint); uint cookie; connectionPoint.Advise(_langPrefs, out cookie); var model = GetService(typeof(SComponentModel)) as IComponentModel; //new SendToDefiningModuleCommand(), List <Command> commands = new List <Command>() { new ExecuteInReplCommand(), new SendToReplCommand(), new FillParagraphCommand(), new SendToDefiningModuleCommand() }; var factories = model.GetAllPythonInterpreterFactories(); var defaultFactory = GetDefaultInterpreter(factories); // sort so default always comes first, and otherwise in sorted order Array.Sort(factories, (x, y) => { if (x == y) { return(0); } else if (x == defaultFactory) { return(-1); } else if (y == defaultFactory) { return(1); } else { return(String.Compare(x.GetInterpreterDisplay(), y.GetInterpreterDisplay())); } }); for (int i = 0; i < (PkgCmdIDList.cmdidReplWindowF - PkgCmdIDList.cmdidReplWindow); i++) { var factory = i < factories.Length ? factories[i] : null; commands.Add(new OpenReplCommand((int)PkgCmdIDList.cmdidReplWindow + i, factory)); } _commands = commands.ToArray(); // Add our command handlers for menu (commands must exist in the .vsct file) OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (null != mcs) { foreach (var command in Commands) { var beforeQueryStatus = command.BeforeQueryStatus; CommandID toolwndCommandID = new CommandID(GuidList.guidPythonToolsCmdSet, command.CommandId); if (beforeQueryStatus == null) { MenuCommand menuToolWin = new MenuCommand(command.DoCommand, toolwndCommandID); mcs.AddCommand(menuToolWin); } else { OleMenuCommand menuToolWin = new OleMenuCommand(command.DoCommand, toolwndCommandID); menuToolWin.BeforeQueryStatus += beforeQueryStatus; mcs.AddCommand(menuToolWin); } } } }
public int SetUserPreferences(VIEWPREFERENCES[] pViewPrefs, FRAMEPREFERENCES[] pFramePrefs, LANGPREFERENCES[] pLangPrefs, FONTCOLORPREFERENCES[] pColorPrefs) { throw new Exception("The method or operation is not implemented."); }
///////////////////////////////////////////////////////////////////////////// // Overriden Package Implementation #region Package Members /// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initilaization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { base.Initialize(); var services = (IServiceContainer)this; var langService4GL = new VSGenero4GLLanguageInfo(this); services.AddService(langService4GL.GetType(), langService4GL, true); var langServicePER = new VSGeneroPERLanguageInfo(this); services.AddService(langServicePER.GetType(), langServicePER, true); services.AddService( typeof(ErrorTaskProvider), (container, serviceType) => { var errorList = GetService(typeof(SVsErrorList)) as IVsTaskList; var model = ComponentModel; var errorProvider = model != null ? model.GetService <IErrorProviderFactory>() : null; return(new ErrorTaskProvider(this, errorList, errorProvider)); }, promote: true); services.AddService( typeof(CommentTaskProvider), (container, serviceType) => { var taskList = GetService(typeof(SVsTaskList)) as IVsTaskList; var model = ComponentModel; var errorProvider = model != null ? model.GetService <IErrorProviderFactory>() : null; return(new CommentTaskProvider(this, taskList, errorProvider)); }, promote: true); IVsTextManager textMgr = (IVsTextManager)Instance.GetService(typeof(SVsTextManager)); var langPrefs = new LANGPREFERENCES[1]; langPrefs[0].guidLang = typeof(VSGenero4GLLanguageInfo).GUID; int result = textMgr.GetUserPreferences(null, null, langPrefs, null); _langPrefs = new Genero4GLLanguagePreferences(langPrefs[0]); Guid guid = typeof(IVsTextManagerEvents2).GUID; IConnectionPoint connectionPoint; ((IConnectionPointContainer)textMgr).FindConnectionPoint(ref guid, out connectionPoint); uint cookie; connectionPoint.Advise(_langPrefs, out cookie); // TODO: not sure if this is needed...need to test DTE dte = (DTE)GetService(typeof(DTE)); if (dte != null) { GeneroEditorFactory = new EditorFactory(this); this.RegisterEditorFactory(GeneroEditorFactory); } RegisterCommands(new CommonCommand[] { new ExtractSqlStatementsCommand() }, GuidList.guidVSGeneroCmdSet); var dte2 = (DTE2)Package.GetGlobalService(typeof(SDTE)); var sp = new ServiceProvider(dte2 as Microsoft.VisualStudio.OLE.Interop.IServiceProvider); try { var mefContainer = sp.GetService(typeof(Microsoft.VisualStudio.ComponentModelHost.SComponentModel)) as Microsoft.VisualStudio.ComponentModelHost.IComponentModel; var exportSpec = mefContainer?.DefaultExportProvider.GetExport <IBuildTaskProvider>(); if (exportSpec != null) { _BuildTaskProvider = exportSpec.Value; } if (DefaultAnalyzer != null) { } } catch (Exception) { } }
private void GetLanguagePrefs() { if (this.textMgr != null) { this.prefs.guidLang = langSvc; LANGPREFERENCES[] langPrefs = new LANGPREFERENCES[1]; langPrefs[0] = this.prefs; try { if (! this.user) { textMgr.GetPerLanguagePreferences(langPrefs); } else { textMgr.GetUserPreferences(null, null, langPrefs, null); } this.prefs = langPrefs[0]; } catch (Exception ex) { Trace.WriteLine(ex.Message); } } }
public void OnUserPreferencesChanged(VIEWPREFERENCES[] pViewPrefs, FRAMEPREFERENCES[] pFramePrefs, LANGPREFERENCES[] pLangPrefs, FONTCOLORPREFERENCES[] pColorPrefs) { }