private static void getEditorPreferences(ITextView textView) { if (!_optionsValid) { var package = XSharp.Project.XSharpProjectPackage.Instance; var optionsPage = package.GetIntellisenseOptionsPage(); var textManager = package.GetTextManager(); // _alignDoCase = optionsPage.AlignDoCase; _alignMethod = optionsPage.AlignMethod; _keywordCase = optionsPage.KeywordCase; _identifierCase = optionsPage.IdentifierCase; _noGotoDefinition = optionsPage.DisableGotoDefinition; var languagePreferences = new LANGPREFERENCES3[1]; languagePreferences[0].guidLang = GuidStrings.guidLanguageService; var result = textManager.GetUserPreferences4(pViewPrefs: null, pLangPrefs: languagePreferences, pColorPrefs: null); if (result == VSConstants.S_OK) { _indentStyle = languagePreferences[0].IndentStyle; } _tabSize = textView.Options.GetTabSize(); _indentSize = textView.Options.GetIndentSize(); _optionsValid = true; } }
public virtual int?GetDesiredIndentation(ITextSnapshotLine line) { try { vsIndentStyle indentStyle = IndentStyle; if (indentStyle == vsIndentStyle.vsIndentStyleNone) { return(0); } int?result = null; if (indentStyle == vsIndentStyle.vsIndentStyleSmart) { result = GetSmartIndentation(line); } if (result == null) { result = GetFallbackIndentation(line); } return(result); } catch (Exception ex) when(!ErrorHandler.IsCriticalException(ex)) { // Throwing an exception from here will crash the IDE. return(null); } }
private void getOptions() { _alignDoCase = _optionsPage.AlignDoCase; _alignMethod = _optionsPage.AlignMethod; var languagePreferences = new LANGPREFERENCES3[1]; languagePreferences[0].guidLang = GuidStrings.guidLanguageService; var result = _textManager.GetUserPreferences4(pViewPrefs: null, pLangPrefs: languagePreferences, pColorPrefs: null); if (result == VSConstants.S_OK) { _indentStyle = languagePreferences[0].IndentStyle; _tabSize = (int)languagePreferences[0].uTabSize; } }