Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>Code Alignment ArrowsNew to Visual Studio Code? Get it now.
Code Alignment Arrows

Code Alignment Arrows

code-alignment-arrows

|
11 installs
| (0) | Free
对齐多种编程语言中的箭头符号(=>) 和等号(=) - Multi-language code alignment for arrows and equals
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Code Alignment Arrows - VS Code Extension

📝 English Description

Overview

Code Alignment Arrows is a professional code formatting extension that supports multiple programming languages for aligning arrow functions (=>, ->) and assignment operators (=). Make your code cleaner and more readable with perfect alignment across different languages.

🚀 Key Features

  • Multi-Language Support: Supports JavaScript, TypeScript, PHP, Java, C#, Python, Go, Rust, C/C++, and more
  • Smart Alignment: Automatically align arrow functions and assignment operators in selected code blocks or entire file
  • Keyboard Shortcuts: Ctrl+Shift+R (Windows/Linux) or Cmd+Shift+R (macOS)
  • Command Palette: Quick access via "Align Arrows and Equals" command
  • Intelligent Recognition: Automatically distinguishes assignment operators from comparison operators
  • Preserve Indentation: Perfectly maintains original code indentation structure
  • Comment Filtering: Automatically skips comment lines to avoid misalignment

🌍 Supported Programming Languages

Language Supported Symbols Special Features
JavaScript/TypeScript =>, = Arrow functions + Assignment
PHP =>, = Arrow functions + Arrays + Assignment
Java ->, = Lambda expressions + Assignment
C# =>, = Lambda expressions + Assignment
Python = Assignment + Lambda
Go =, := Assignment + Short declaration
Rust =>, = Pattern matching + Assignment
C/C++ = Assignment

📖 Usage Guide

Method 1: Keyboard Shortcut (Recommended)

  1. Select the code block you want to align (or select nothing to align the entire file)
  2. Press Ctrl+Shift+R (Windows/Linux) or Cmd+Shift+R (macOS)
  3. Code is instantly aligned

Method 2: Command Palette

  1. Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (macOS) to open Command Palette
  2. Type "Align Arrows and Equals"
  3. Select and execute the command

🎯 Multi-Language Alignment Examples

JavaScript/TypeScript

// Before alignment
const a = () => console.log('a');
const longVariableName = () => console.log('long');
const b = () => console.log('b');

// After alignment
const a                = () => console.log('a');
const longVariableName = () => console.log('long');
const b                = () => console.log('b');

PHP

// Before alignment
$a = 1;
$longVariableName = 2;
$fn = fn($x) => $x * 2;

// After alignment
$a                = 1;
$longVariableName = 2;
$fn               = fn($x) => $x * 2;

Java

// Before alignment
Function<Integer, Integer> square = x -> x * x;
Function<Integer, Integer> longFunctionName = parameter -> parameter * 2;
int a = 1;

// After alignment
Function<Integer, Integer> square           = x -> x * x;
Function<Integer, Integer> longFunctionName = parameter -> parameter * 2;
int a                                       = 1;

Python

# Before alignment
a = 1
long_variable_name = 2
square = lambda x: x * x

# After alignment
a                  = 1
long_variable_name = 2
square             = lambda x: x * x

Go

// Before alignment
a := 1
longVariableName := 2
var b = 3

// After alignment
a                := 1
longVariableName := 2
var b            = 3

💡 Use Cases

  • Frontend Development: JavaScript/TypeScript, React/Vue/Angular components
  • Backend Development: Node.js, PHP, Java, C#, Go, Python projects
  • Systems Programming: Rust, C/C++ development
  • Functional Programming: Lambda expressions and arrow function alignment
  • Configuration Files: Any code files containing key-value pairs

⚙️ Requirements

  • Visual Studio Code 1.60.0 or higher
  • Supports all major operating systems (Windows, macOS, Linux)
  • Works with any programming language (with default rules for unsupported languages)

🔧 Installation

  1. Open VS Code
  2. Go to Extensions view (Ctrl+Shift+X)
  3. Search for "Code Alignment Arrows"
  4. Click Install

Start using immediately after installation - no additional configuration required!


📝 中文说明

概述

Code Alignment Arrows 是一个专业的代码格式化插件,支持多种编程语言中的箭头函数(=>、->)和赋值操作符(=)对齐。让你的代码更加整洁美观,提升代码可读性。

🚀 主要功能

  • 多语言支持:支持 JavaScript、TypeScript、PHP、Java、C#、Python、Go、Rust、C/C++ 等主流编程语言
  • 智能对齐:自动对齐选中代码块或整个文件中的箭头函数和赋值操作符
  • 快捷键支持:Ctrl+Shift+R(Windows/Linux)或 Cmd+Shift+R(macOS)
  • 命令面板:通过 "Align Arrows and Equals" 命令快速调用
  • 智能识别:自动区分赋值操作符和比较操作符(跳过 ==、===、!=、<=、>= 等)
  • 保持缩进:完美保留原有的代码缩进结构
  • 注释过滤:自动跳过注释行,避免误对齐

🌍 支持的编程语言

语言 支持的符号 特殊功能
JavaScript/TypeScript =>, = 箭头函数 + 赋值
PHP =>, = 箭头函数 + 数组 + 赋值
Java ->, = Lambda 表达式 + 赋值
C# =>, = Lambda 表达式 + 赋值
Python = 赋值 + Lambda
Go =, := 赋值 + 短声明
Rust =>, = 模式匹配 + 赋值
C/C++ = 赋值

📖 使用教程

方法一:快捷键(推荐)

  1. 选中要对齐的代码块(或不选中以对齐整个文件)
  2. 按下 Ctrl+Shift+R(Windows/Linux)或 Cmd+Shift+R(macOS)
  3. 代码即时对齐完成

方法二:命令面板

  1. 按下 Ctrl+Shift+P(Windows/Linux)或 Cmd+Shift+P(macOS)打开命令面板
  2. 输入 "Align Arrows and Equals" 或 "对齐"
  3. 选择命令执行

🎯 多语言对齐效果示例

JavaScript/TypeScript

// 对齐前
const a = () => console.log('a');
const longVariableName = () => console.log('long');
const b = () => console.log('b');

// 对齐后  
const a                = () => console.log('a');
const longVariableName = () => console.log('long');
const b                = () => console.log('b');

PHP

// 对齐前
$a = 1;
$longVariableName = 2;
$fn = fn($x) => $x * 2;

// 对齐后
$a                = 1;
$longVariableName = 2;
$fn               = fn($x) => $x * 2;

Java

// 对齐前
Function<Integer, Integer> square = x -> x * x;
Function<Integer, Integer> longFunctionName = parameter -> parameter * 2;
int a = 1;

// 对齐后
Function<Integer, Integer> square           = x -> x * x;
Function<Integer, Integer> longFunctionName = parameter -> parameter * 2;
int a                                       = 1;

Python

# 对齐前
a = 1
long_variable_name = 2
square = lambda x: x * x

# 对齐后
a                  = 1
long_variable_name = 2
square             = lambda x: x * x

Go

// 对齐前
a := 1
longVariableName := 2
var b = 3

// 对齐后
a                := 1
longVariableName := 2
var b            = 3

💡 适用场景

  • 前端开发:JavaScript/TypeScript、React/Vue/Angular 组件
  • 后端开发:Node.js、PHP、Java、C#、Go、Python
  • 系统编程:Rust、C/C++
  • 函数式编程:Lambda 表达式、箭头函数对齐
  • 配置文件:任何包含键值对的代码文件

🛠️ Development

npm install
npm run compile

Press F5 to run the extension in development mode.

📞 Support & Feedback

If you encounter any issues or have suggestions for improvement, please feel free to create an issue on our GitHub repository.

Keywords: alignment, format, arrow function, equals, code formatting, javascript, typescript, php, java, csharp, python, go, rust, lambda, multi-language

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft