Страница:
Coding Guidelines
Страницы
Accessibility Guidelines
Adopting Multi Root Workspace APIs
Automated Issue Triaging
Build Champion
Build and run 32bit Code OSS on Windows
Code Editor Roadmap
Coding Guidelines
Color customization color id changes
Commit Signing
Community Issue Tracking
Contributor License Agreement
Cross Compiling for Debian Based Linux
Dealing with Test Flakiness
December Pre Release
December Test Plan
Design Goals
Development Process
Differences between the repository and Visual Studio Code
Editor decorations & colors
Explain extension causes high cpu load
Extension API guidelines
Extension API process
Feature Areas
Feedback Channels
File Watcher Internals
File Watcher Issues
Git & SCM Issues
Home
How to Contribute
IME Test
Insiders Release Notes
Interactive Window Documentation
Inventory of performance marks
Issue Grooming
Issue Tracking
Issues Triaging
Iteration Plans
Keybinding Issues
Known issues
Lists And Trees
Native Crash Issues
Notebook Smoke Test
Notebook documentation
Notebook layout
November Plan
Performance Issues (old)
Performance Issues
Pointer Device & Touch support
Publish vscode types
Related Projects
Release Process
Releasing vscode.dev
Removing Insiders
Roadmap 2017
Roadmap 2018
Roadmap 2019
Roadmap 2020
Roadmap
Roadmap‐2021‐2022
Running the Endgame
Sanity Check
Search Issues
Selfhosting on Windows WSL
Semantic Highlighting Overview
Setting Descriptions
Smoke Test
Source Code Organization
Submitting Bugs and Suggestions
Terminal Issues
TypeScript Issues
UX
VS Code Speech
Virtual Workspaces
Working Copies
Working with xterm.js
Writing Test Plan Items
Writing Tests
[DEV] Perf Tools for VS Code Development
[DEV] Programming advice and tips & tricks
[WIP] Code Editor Design Doc
[WIP] Design Checklist
[WIP] Design Principles
[dev perf] PerformanceError and unresponsive renderer telemetry
23
Coding Guidelines
Rob Lourens редактировал(а) эту страницу 2022-10-18 09:00:30 -07:00
Intro
These are VS Code coding guidelines. Please also review our Source Code Organisation page.
Indentation
We use tabs, not spaces.
Names
- Use PascalCase for
type
names - Use PascalCase for
enum
values - Use camelCase for
function
andmethod
names - Use camelCase for
property
names andlocal variables
- Use whole words in names when possible
Types
- Do not export
types
orfunctions
unless you need to share it across multiple components - Do not introduce new
types
orvalues
to the global namespace
Comments
- Use JSDoc style comments for
functions
,interfaces
,enums
, andclasses
Strings
- Use "double quotes" for strings shown to the user that need to be externalized (localized)
- Use 'single quotes' otherwise
- All strings visible to the user need to be externalized
Style
- Use arrow functions
=>
over anonymous function expressions - Only surround arrow function parameters when necessary. For example,
(x) => x + x
is wrong but the following are correct:
x => x + x
(x, y) => x + y
<T>(x: T, y: T) => x === y
- Always surround loop and conditional bodies with curly braces
- Open curly braces always go on the same line as whatever necessitates them
- Parenthesized constructs should have no surrounding whitespace. A single space follows commas, colons, and semicolons in those constructs. For example:
for (let i = 0, n = str.length; i < 10; i++) {
if (x < 10) {
foo();
}
}
function f(x: number, y: string): void { }
Project Management
- Roadmap
- Iteration Plans
- Development Process
- Issue Tracking
- Build Champion
- Release Process
- Running the Endgame
- Related Projects
Contributing
- How to Contribute
- Submitting Bugs and Suggestions
- Feedback Channels
- Source Code Organization
- Coding Guidelines
- Testing
- Dealing with Test Flakiness
- Contributor License Agreement
- Extension API Guidelines
- Accessibility Guidelines
Documentation