private void JSBeautifySelection(object sender, RoutedEventArgs e) { try { Plugins.JSBeautify jsBeautify = new Plugins.JSBeautify(CurrentTab().TextEditor.SelectedText, GetAndPersistJsBeautifyOptions()); string formattedScript = jsBeautify.GetResult(); CurrentTab().TextEditor.SelectedText = formattedScript; this.CancelSettingsUI(); } catch { } }
private void JSBeautifyFile(object sender, RoutedEventArgs e) { try { CurrentTab().TextEditor.BeginChange(); Plugins.JSBeautify jsBeautify = new Plugins.JSBeautify(CurrentTab().TextEditor.Text, GetAndPersistJsBeautifyOptions()); string newFile = jsBeautify.GetResult(); CurrentTab().TextEditor.ReplaceText(0, CurrentTab().TextEditor.Text.Length, newFile); CurrentTab().TextEditor.EndChange(); this.CancelSettingsUI(); } catch { } }