public TestJSBeautifier() { this.beautifier = new Beautifier(); this.beautifier.Opts.IndentSize = 4; this.beautifier.Opts.IndentChar = ' '; this.beautifier.Opts.PreserveNewlines = true; this.beautifier.Opts.JslintHappy = false; this.beautifier.Opts.KeepArrayIndentation = false; this.beautifier.Opts.BraceStyle = BraceStyle.Collapse; this.beautifier.Flags.IndentationLevel = 0; this.beautifier.Opts.BreakChainedMethods = false; }
static void Decode(DecodeArgs decoderArgs) { try { Console.WriteLine("Decoding {0}", decoderArgs.JsxbinFilepath); string jsxbin = File.ReadAllText(decoderArgs.JsxbinFilepath, Encoding.ASCII); string jsx = AbstractNode.Decode(jsxbin, decoderArgs.PrintStructure); jsx = new Beautifier().Beautify(jsx); File.WriteAllText(decoderArgs.JsxFilepath, jsx, Encoding.UTF8); Console.WriteLine("Jsxbin successfully decoded to {0}", decoderArgs.JsxFilepath); } catch (Exception ex) { Console.WriteLine("Decoding failed. If this problem persists, please raise an issue on github. Error message: {0}. Stacktrace: {1}.", ex.Message, ex.StackTrace); } }
internal void Beautify() { Beautifier b = new Beautifier(new BeautifierOptions { BraceStyle = BraceStyle.Expand, BreakChainedMethods = false, EvalCode = true, IndentChar = '\t', IndentSize = 1, IndentWithTabs = true, JslintHappy = true, KeepArrayIndentation = true, KeepFunctionIndentation = true, MaxPreserveNewlines = 1, PreserveNewlines = true }); textEditor.Text = b.Beautify(textEditor.Text); }
private string DataLists_GetJsonString() { object[][] selectedItems = new object[][] { new object[BasicDataList.SelectedItems.Count], new object[ExifDataList.SelectedItems.Count], new object[FullDataList.SelectedItems.Count] }; BasicDataList.SelectedItems.CopyTo(selectedItems[0], 0); ExifDataList.SelectedItems.CopyTo(selectedItems[1], 0); FullDataList.SelectedItems.CopyTo(selectedItems[2], 0); Beautifier beautifier = new Jsbeautifier.Beautifier(); return beautifier.Beautify(JsonConvert.SerializeObject(selectedItems)); }
public TestJSBeautifierIndentation() { this.beautifier = new Beautifier(); BeautifierOptions bo = this.beautifier.Opts; bo.IndentWithTabs = true; }