Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>fch snippetsNew to Visual Studio Code? Get it now.
fch snippets

fch snippets

zqii

|
675 installs
| (0) | Free
代码补全
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

目前有的代码片段:

.tsx .ts

imp =>
import name from 'module';
imd =>
import {  } from 'module';
ims =>
import { xx } from '~/solution/model/services/xx.service'
imc =>
import { xx } from '~/framework/components/component.module'

.ts .js .tsx

cl => 
console.log();
clog => 
console.log('===>',);
fe =>
array.forEach((item, index)=>{
        // body
});
mp =>
array.map((item, index)=>{
        // body
});
fn =>
/**
* methodName
*/
function methodName (arguments) {
    // body
}
sv =>
xxService.method(param).subscribe(res => {
    // body
});

.less

flex =>
display: flex;
justify-content: space-between;
align-items: center;
pos =>
position: absolute;
left: 0px;
right: 0px;
top: 0px;
bottom: 0px;
margin: auto;
lh =>
height: @hpx;
line-height: @hpx;
textf =>
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;

这个插件有2个功能

1针对不同的后缀文件设置不同的代码片段

比如在.tsx 文件里面输入: ims 就会联想出 import { xx } from '~/solution/model/services/xx.service' 可以在这个文件夹里面添加常用的代码片段 ==> src/snippets/react-snippet.json

如果想给其他后缀名的文件添加代码片段,可以在src/snippets/这个文件夹里面针对不同的后缀文件添加更多的代码片段,然后在 package.json里面申明下:

"contributes": {
		"snippets": [
            {
                "language": "javascript", // 这个就是.js文件
                "path": "./snippets/javascript.json" // 对应的json文件
            }]
}

2输入 @fch 可以快速输入自己定义的字符串

在任何文件里面输入 @fch 会弹出选择内置的字符串, 这个功能在添加的时候只能添加字符串上去,没办法添加代码片段

如果想自己添加可以在 根目录 /RULES.js 里面添加自己的数据,然后在 package.json里面申明下:

"contributes": {
		"commands": [
            {
                "command": "extension.rule1",
                "title": "$(rocket) zz: 统一社会信用代码"
            }]
}
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft