代码折叠
使用此页面指定默认的代码折叠设置。 有关如何展开或折叠代码元素的快捷方式,请参阅 code folding部分。
项目 | 描述 |
|---|---|
显示代码折叠箭头 | 在编辑器中显示代码折叠图标。 从列表中选择展开区域图标的显示方式:
![]() 显示底部箭头 :也在装订区域处显示底部折叠箭头。 否则,仅显示顶部箭头。 |
默认折叠 | 选择在编辑器中首次打开文件时默认应折叠的代码片段。 |
默认折叠部分
在此部分中,选择在打开相应类型文件时默认应折叠的特定语言元素。
通用
选项 | 未折叠的代码 | 已折叠的代码 |
|---|---|---|
文件头 适用于头部注释块。 |
<?php
/**
* Start the application
*
* This function processes the request and
* sends the response back to the browser.
*/
function start(){
};
|
<?php
/*** Start the application ...*/
function start(){
};
|
Import 适用于非 PHP 上下文,例如 JavaScript。 |
import defaultExport from "module-name";
import * as name from "module-name";
import { foo , bar } from "specific/file";
import "module-name";
var promise = import("module-name");
|
import ...
var promise = import("module-name");
|
文档注释 |
/**
* User constructor.
* @param $name
* @param $age
*/
function __construct($name, $age) {
$this->_age = $age;
$this->_name = $name;
}
|
/** User constructor. ...*/
function __construct($name, $age) {
$this->_age = $age;
$this->_name = $name;
}
|
方法体 适用于非 PHP 上下文,例如 JavaScript。 |
class User {
constructor(name) {
this.name = name;
}
get name() {
return this._name;
}
set name(value) {
this._name = value;
}
}
|
class User {
constructor(name) {...}
get name() {...}
set name(value) {...}
}
|
自定义折叠区域 折叠用 有关更多信息,请参见 自定义折叠区域。 |
//<editor-fold desc="Folding region">
function foo() {
bar();
}
foo();
//</editor-fold>
|
Folding region
|
JavaScript
选项 | 未折叠的代码 | 已折叠的代码 |
|---|---|---|
JavaScript 和 TypeScript 中的单行函数 |
var obj = {
id: 1,
timer: function timer() {
setTimeOut(() => {
console.log(this);
console.log(this.id);
}, 1000);
}
};
|
var obj = {
id: 1,
timer: function timer() {
setTimeOut(() => {...}, 1000);
}
};
|
对象字面量 |
var myObject = {
a: 'value',
b: 2,
c: false
};
|
var myObject = {a: 'value'...};
|
数组字面量 |
var myArray = [
'foo',
'bar',
'baz'
];
|
var myArray = [...];
|
XML 字面量 |
var html = <html>
<p id="p1">First paragraph</p>
<p id="p2">Second paragraph</p>
</html>;
|
var html = <html...>;
|
PHP
选项 | 未折叠的代码 | 已折叠的代码 |
|---|---|---|
类体 |
class Foo {
public function bar() {
}
}
|
class Foo {...}
|
导入 |
use App\User;
use App\Controllers\Controller;
class MyClass() {
}
|
use ...
class MyClass() {
}
|
方法体 |
class Foo {
public function bar() {
echo 'baz';
}
}
|
class Foo {
public function bar() {...}
}
|
函数体 |
<?php
function foo($bar) {
echo $bar;
}
|
<?php
function foo($bar) {...}
|
选项卡 |
<html>
<body>
<?php
echo '<p>
PHP output
</p>';
?>
</body>
</html>
|
<html>
<body>
<?php...?>
</body>
</html>
|
HEREDOC/NOWDOC |
<?php
echo <<<'Label'
Example of a nowdoc string.
Label;
|
<?php
echo <<<'Label'...Label;
|
属性 |
use JetBrains\PhpStorm\Internal\LanguageLevelTypeAware;
#[LanguageLevelTypeAware(
['8.0' => 'int|false'],
default: 'int|false|null'
)
]
function foo() {
}
|
use JetBrains\PhpStorm\Internal\LanguageLevelTypeAware;
#[LanguageLevelTypeAware(...)]
function foo() {
}
|
属性列表 |
use JetBrains\PhpStorm\ExpectedValues;
use JetBrains\PhpStorm\Deprecated;
#[
ExpectedValues,
Deprecated
]
function foo() {
}
|
use JetBrains\PhpStorm\ExpectedValues;
use JetBrains\PhpStorm\Deprecated;
#[...]
function foo() {
}
|
SQL
选项 | 未折叠的代码 | 已折叠的代码 |
|---|---|---|
在数字字面量中插入下划线(6 位或更长) |
DECLARE @i BIGINT = 1000000000;
|
DECLARE @i BIGINT = 1_000_000_000;
|
XML
选项 | 未折叠的代码 | 已折叠的代码 |
|---|---|---|
XML 标签 |
<?xml version="1.0" encoding="UTF-8"?>
<phpunit>
<testsuite name="MyTestSuite">
<directory>tests</directory>
</testsuite>
</phpunit>
|
<?xml version="1.0" encoding="UTF-8"?>
<phpunit...>
|
HTML 'style' 属性 |
<html>
<body>
<h1 style="color:blue;">
Heading
</h1>
<p style="color:red;">
Paragraph
</p>
</body>
</html>
|
<html>
<body>
<h1 style="...">
Heading
</h1>
<p style="...">
Paragraph
</p>
</body>
</html>
|
XML 实体 |
<!DOCTYPE html>
<html>
<body>
<p>
Enclose a tag in < and >
</p>
</body>
</html>
|
<!DOCTYPE html>
<html>
<body>
<p>
Enclose a tag in < and >
</p>
</body>
</html>
|
数据 URI |
<img src="data:image/png;
base64,
2P4//8/w38gljNBAAO9TXL0Y4O"/>
|
<img src="data:"/>
|
工作原理
最后修改日期: 2025年 9月 26日
