且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

DevExpress通过Javascript重构获得了多远?

更新时间:2023-02-18 22:48:50

CodeRush支持五十二个JavaScript重构:




  • 添加块分隔符

  • 添加参数

  • Break Apart Arguments

  • Break Apart Parameters

  • 条件

  • 组合条件(嵌套)

  • 组合条件(并行)

  • 压缩作业

  • 压缩到三元表达式

  • 连接字符串

  • 有条件

  • 创建多变量声明

  • 创建超载

  • 创建Setter方法

  • 使用声明创建

  • 展开作业

  • 展开三元表达式

  • 提取方法

  • 有条件的平铺

  • For Forach

  • ForEach to For

  • 有条件地初始化

  • 内联最近作业

  • 内联结果

  • 内联温度

  • 内置语句

  • 介绍本地

  • 介绍本地(全部替换)

  • 引入结果变量

  • 阵容参数

  • 阵容参数

  • 移动声明接近参考

  • 将初始化移动到声明

  • 促进参数

  • 删除块分隔符

  • 删除参数

  • 删除有条件的冗余

  • 重命名本地

  • 重新排序参数

  • 用查询替换Temp

  • 替换为本地


  • 简化表达式

  • 拆分条件

  • 拆分条件(和重复的其他块)

  • 从声明中拆分初始化

  • 拆分多变量声明

  • 拆分字符串

  • 拆分临时变量

  • 拆分声明

  • 扩大范围

  • 扩大范围(促销到字段)



八个消费者声明和快速修复功能:




  • 添加合约

  • 添加其他声明

  • 声明字段

  • 声明本地

  • 镜像代码

  • 反向循环

  • 旋转90度

  • 拼写Checker



此外,我们正在努力改进10.2版本的重构支持。我们最近也改进了Quick Nav,以便导航到JavaScript函数,就像C#或VB中的导航一样简单。这种改进将在10.2中发布,但现在可供CodeRush客户在日常生活中使用。



全面披露 - 我领导DevExpress的CodeRush团队。


Over a year ago, I remember watching one of DevExpress evangelists previewing or at least promoting rich Javascript refactoring (beyond just limited intellisense) within the Visual Studio shell, I recall part of CodeRush/DevExpress product line. I was excited.

On checking today (lmgtfy) I can find only very very limited reference to it, just one small italtic line about beta in product description, no videos, no blog posts, no community buzz. Was it dropped? Vapourware? Poor implementation that they dont even promote it?

With Javascript arguably the most popular programming language ever and with a VM for it on practically every machine in last 10 years, why is editor support so poor? (Compared with those for Java and C#)? You see the likes of ScottGu bragging we now have jQuery intellisense but compare this to richness of C# support in the IDE it is a joke.

Someone once said since there are many style of writing Javascript a rich IDE (beyond intellisense) with refactoring support is difficult, but if several engines can interpret/compile JS with same result surely it should be hard to analysis it to support stuff like rename variable, extract method, move to another namespace (or JS minic of it), etc.. Am I wrong?

CodeRush supports fifty-two JavaScript refactorings:

  • Add Block Delimiters
  • Add Parameter
  • Break Apart Arguments
  • Break Apart Parameters
  • Case to Conditional
  • Combine Conditionals (nested)
  • Combine Conditionals (parallel)
  • Compress Assignment
  • Compress to Ternary Expression
  • Concatenate Strings
  • Conditional to Case
  • Create Multi-variable Declaration
  • Create Overload
  • Create Setter Method
  • Create With Statement
  • Expand Assignment
  • Expand Ternary Expression
  • Extract Method
  • Flatten Conditional
  • For to ForEach
  • ForEach to For
  • Initialize Conditionally
  • Inline Recent Assignment
  • Inline Result
  • Inline Temp
  • Inline With Statement
  • Introduce Local
  • Introduce Local (replace all)
  • Introduce Result Variable
  • Line-up Arguments
  • Line-up Parameters
  • Move Declaration Near Reference
  • Move Initialization to Declaration
  • Promote to Parameter
  • Remove Block Delimiters
  • Remove Parameter
  • Remove Redundant Conditional
  • Rename Local
  • Reorder Parameters
  • Replace Temp with Query
  • Replace with Local
  • Reverse Conditional
  • Simplify Expression
  • Split Conditional
  • Split Conditional (and duplicate else block)
  • Split Initialization from Declaration
  • Split Multi-variable Declaration
  • Split String
  • Split Temporary Variable
  • Split With Statement
  • Widen Scope
  • Widen Scope (promote to field)

And eight consume-first declaration and quick fix features:

  • Add Contract
  • Add Else Statement
  • Declare Field
  • Declare Local
  • Mirror Code
  • Reverse For Loop
  • Rotate 90 Degrees
  • Spell Checker

Also, we're working to improve our refactoring support for the 10.2 release. We've also recently improved Quick Nav to make navigating to JavaScript functions as easy as navigation in C# or VB. This improvement will ship in 10.2 but is available now for CodeRush customers in a daily build.

Full Disclosure -- I lead the CodeRush team at DevExpress.