偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

VS Code調(diào)試太難?這款可視化代碼調(diào)試工具值得擁有

新聞 前端
一個(gè)名叫 hediet 的外國(guó)程序員開源了一個(gè)在調(diào)試期間可視化數(shù)據(jù)結(jié)構(gòu)的 VS Code 擴(kuò)展——Debug Visualizer。

 [[316055]]

這是一個(gè)在調(diào)試期間可視化數(shù)據(jù)結(jié)構(gòu)的 VS Code 擴(kuò)展,使用它之后,你可以清晰明了的看到不同數(shù)據(jù)之間的關(guān)系。

一個(gè)名叫 hediet 的外國(guó)程序員開源了一個(gè)在調(diào)試期間可視化數(shù)據(jù)結(jié)構(gòu)的 VS Code 擴(kuò)展——Debug Visualizer。

這個(gè)擴(kuò)展程序可以在 VS Code 中調(diào)試任何編程語(yǔ)言,當(dāng)然,目前最適配的編程語(yǔ)言是 JavaScript 和 TypeScript,另外 C#、Java 和 PHP 也進(jìn)行了相應(yīng)的測(cè)試。

1. 如何安裝使用?

安裝此擴(kuò)展后,使用命令 Open a new Debug Visualizer View 打開新的可視化器視圖。在這個(gè)視圖中,你可以輸入一個(gè)表達(dá)式,該表達(dá)式在逐步分析你的代碼時(shí)會(huì)進(jìn)行評(píng)估和可視化,例如

  1. kind: { graph: true }, 
  2. nodes: [ { id: "1", label: "1" }, { id: "2", label: "2" } ], 
  3. edges: [{ from: "1", to: "2", label: "edge" }] 

你可以通過編寫自己的函數(shù),從自定義數(shù)據(jù)結(jié)構(gòu)中提取這些調(diào)試數(shù)據(jù)。

2. 哪些數(shù)據(jù)可被可視化呢?

很多人可能會(huì)問,這個(gè)可視化代碼調(diào)試工具都支持哪些東西可視化呢?基本上你能想到的,它都可以做到可視化。

圖形可視化

Graphviz 和 Vis.js 可視化工具可以渲染與 Graph 界面匹配的數(shù)據(jù)。

  1. interface Graph { 
  2.   kind: { graph: true }; 
  3.   nodes: NodeGraphData[]; 
  4.   edges: EdgeGraphData[]; 
  5.  
  6. interface NodeGraphData { 
  7.   id: string; 
  8.   label?: string; 
  9.   color?: string; 
  10.   shape?: "ellipse" | "box"
  11.  
  12. interface EdgeGraphData { 
  13.   from: string; 
  14.   to: string; 
  15.   label?: string; 
  16.   id?: string; 
  17.   color?: string; 
  18.   dashes?: boolean

graphviz 可視化工具可以通過使用 SVG 查看器來查看 viz.js 創(chuàng)建的 SVG。

VS Code调试太难?这款可视化代码调试工具值得拥有

Plotly 可視化

plotly visualizer 可以通過 plotly 來渲染與界面匹配的 JSON 數(shù)據(jù)。

  1. export interface Plotly { 
  2.   kind: { plotly: true }; 
  3.   data: Partial<Plotly.Data>[]; 
  4. // See plotly docs for Plotly.Data. 

VS Code调试太难?这款可视化代码调试工具值得拥有

Tree 可視化

樹可視化器渲染與 Tree 接口匹配的數(shù)據(jù)。

  1. interface Tree<TData = unknown> { 
  2.   kind: { tree: true }; 
  3.   root: TreeNode<TData>; 
  4. interface TreeNode<TExtraData> { 
  5.   id: string | undefined; 
  6.   name: string; 
  7.   value: string | undefined; 
  8.   emphasizedValue: string | undefined; 
  9.   children: TreeNode<TExtraData>[]; 
  10.   data: TExtraData; 
  11.   isMarked: boolean

VS Code调试太难?这款可视化代码调试工具值得拥有

AST 可視化

AST 可視化工具渲染與 Ast 接口匹配的數(shù)據(jù)。

  1. interface Ast 
  2.   extends Tree<{ 
  3.       position: number; 
  4.       length: number; 
  5.     }>, 
  6.     Text { 
  7.   kind: { text: true; tree: true; ast: true }; 

除了樹視圖外,AST 可視化工具還會(huì)高亮顯示源代碼的來源。

VS Code调试太难?这款可视化代码调试工具值得拥有

Grid 可視化

Grid 可視化工具會(huì)渲染與以下接口匹配的數(shù)據(jù)。

  1. export interface Grid { 
  2.   kind: { array: true }; 
  3.   columnLabels?: { label?: string }[]; 
  4.   rows: { 
  5.     label?: string; 
  6.     columns: { 
  7.       content?: string; 
  8.       tag?: string; 
  9.       color?: string; 
  10.     }[]; 
  11.   }[]; 
  12.   markers?: { 
  13.     id: string; 
  14.  
  15.     row: number; 
  16.     column: number; 
  17.     rows?: number; 
  18.     columns?: number; 
  19.  
  20.     label?: string; 
  21.     color?: string; 
  22.   }[]; 

Text 可視化

文本可視化工具渲染與 Text 接口匹配的數(shù)據(jù)。

  1. interface Text { 
  2.   kind: { text: true }; 
  3.   text: string; 
  4.   mimeType?: string; 
  5.   fileName?: string; 

mimeType 和 fileName 的文件擴(kuò)展名用于語(yǔ)法高亮顯示。

SVG 可視化

SVG 可視化工具渲染與 Svg 接口匹配的數(shù)據(jù)。實(shí)際的 SVG 數(shù)據(jù)必須存儲(chǔ)在 text 中。

  1. interface Svg extends Text { 
  2.   kind: { text: true; svg: true }; 

點(diǎn)圖可視化

點(diǎn)圖可視化工具渲染與 DotGraph 接口匹配的數(shù)據(jù)。

  1. interface DotGraph extends Text { 
  2.   kind: { text: true; dotGraph: true }; 

Viz.js(Graphviz)用于渲染。

3. 哪些數(shù)據(jù)可被提???

該工具中包含有 JavaScript/TypeScript 數(shù)據(jù)提取器,數(shù)據(jù)提取器可將任意值轉(zhuǎn)換為可視化數(shù)據(jù)。這個(gè)擴(kuò)展會(huì)自動(dòng)在被調(diào)試者中注入以下數(shù)據(jù)提取器,當(dāng)然用戶也可以注冊(cè)自定義數(shù)據(jù)提取器。

ToString

只需對(duì)值調(diào)用 .toString() ,就可將數(shù)據(jù)轉(zhuǎn)換為文本類型。

TypeScript AST

  • 直接可視化 ts.Node
  • Record 和 [ts.Node] 的可視化。如果記錄包含 fn 鍵,則將為每個(gè)節(jié)點(diǎn)顯示它們的值。

As Is 數(shù)據(jù)提取器

將數(shù)據(jù)直接輸入到可視化工具。

使用方法 getDebugVisualization

調(diào)用 .getDebugVisualization(),就可將數(shù)據(jù)轉(zhuǎn)換為可視化工具的直接輸入。

Plotly y-Values

使用 plotly 繪制數(shù)字?jǐn)?shù)組。

對(duì)象圖

構(gòu)造一個(gè)圖形,其中包含從表達(dá)式求值到的對(duì)象可到達(dá)的所有對(duì)象。使用廣度搜索構(gòu)造圖,在 50 個(gè)節(jié)點(diǎn)后停止。

Array Grid

可以為數(shù)組數(shù)據(jù)創(chuàng)建 Grid visualization。

4. 其它事項(xiàng)

該擴(kuò)展支持多行表達(dá)式,例如點(diǎn)擊 shift+enter    可添加新行,點(diǎn)擊 ctrl+enter 可計(jì)算表達(dá)式。當(dāng)只有一行時(shí),    enter 是提交當(dāng)前表達(dá)式,當(dāng)有多行時(shí),enter 插入另一個(gè)換行符。

經(jīng)過該擴(kuò)展程序開發(fā)者的測(cè)試,可與 TypeScript / JavaScript 庫(kù)一起很好地工作。

GitHub 開源地址:

https://github.com/hediet/vscode-debug-visualizer/tree/master/extension

 

責(zé)任編輯:張燕妮 來源: 架構(gòu)頭條
相關(guān)推薦

2022-08-08 07:35:37

云測(cè)試工具云存儲(chǔ)云計(jì)算

2025-03-31 03:25:00

2020-02-27 08:59:11

DebugCode開源工具

2022-05-05 07:01:09

可視化代碼執(zhí)行工具

2022-08-28 10:36:53

調(diào)試工具通用

2022-03-11 08:32:53

C代碼代碼編輯vscode

2022-07-25 07:57:19

工具代碼調(diào)試

2021-01-18 17:23:30

代碼調(diào)試VS Code

2011-08-15 17:38:48

iPhone開發(fā)調(diào)試工具

2025-04-17 08:36:30

2022-06-06 12:18:44

配置可視化Nginx

2024-01-24 13:22:40

Python調(diào)試工具技巧

2024-07-09 08:31:26

2023-03-29 08:18:16

Go調(diào)試工具

2016-12-02 20:23:51

AndroidADB

2017-11-27 11:59:40

Node.JSChrome調(diào)試程序

2012-02-24 09:25:20

JavaScript

2009-10-22 13:02:47

SQL SERVER

2009-12-04 13:31:50

VS代碼調(diào)試

2022-08-21 14:05:54

調(diào)試工具CDP
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)