Skip to content

Commit 218f7dd

Browse files
author
申蛟隆
committed
多workspace支持
1 parent b091b73 commit 218f7dd

File tree

9 files changed

+30367
-1470
lines changed

9 files changed

+30367
-1470
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616
## 快速开始
1717
请查看文档 [vue-helper](http://vue-helper.80fight.cn/)!
1818

19-
## version 2.6.0
19+
## version 2.6.2
2020

21-
1、支持 [Ant Design Vue](http://vue-helper.80fight.cn/document/ant-design-vue.html) 组件标签的所有**68**个组件,总计**288**个代码块缩写
22-
2、解决 issue [75](https://github.com/jiaolong1021/vue-helper/issues/75), [76](https://github.com/jiaolong1021/vue-helper/issues/76), [73](https://github.com/jiaolong1021/vue-helper/issues/73)
21+
1、解决多文件插件提示不起作用问题
2322

2423

2524
## 规划
@@ -30,7 +29,7 @@
3029
* 在github上提交[issue](https://github.com/jiaolong1021/vue-helper/issues),如果该项目对你有所帮助,记得Star关注哦。🤪
3130
* 加入我们的微信群,直接在群里反馈问题,即时解决,并获取更多权益。
3231

33-
![/imgs/creator.png](https://www.80fight.cn/helper/wxq.png)
32+
![/imgs/creator.png](https://www.80fight.cn/helper/wxq1.png)
3433

3534
在这里我们提供 🎁
3635
1、新功能抢先体验

dist/client.js

Lines changed: 30267 additions & 1447 deletions
Large diffs are not rendered by default.

dist/server.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.activate=void 0;function t(e){console.log("vue-helper activate",e.extension.id)}exports.activate=t;
1+
"use strict";
2+
3+
// out/server.js
4+
Object.defineProperty(exports, "__esModule", { value: true });
5+
exports.activate = void 0;
6+
function activate(context) {
7+
console.log("vue-helper activate", context.extension.id);
8+
}
9+
exports.activate = activate;

package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
{
22
"name": "vue-helper",
3-
"version": "2.5.0",
3+
"displayName": "vue-helper",
4+
"version": "2.6.2",
45
"description": "vue enhance, extension for Element-UI, Element Plus, Ant Desigin Vue",
56
"keywords": [
67
"vue-helper",
78
"element-ui",
89
"Element Plus",
10+
"Ant",
911
"Ant Desigin Vue",
1012
"vue",
1113
"vscode"
@@ -41,6 +43,10 @@
4143
"engines": {
4244
"vscode": "^1.74.0"
4345
},
46+
"categories": [
47+
"Snippets",
48+
"Other"
49+
],
4450
"activationEvents": [
4551
"onStartupFinished",
4652
"onLanguage:vue"
@@ -74,7 +80,7 @@
7480
{
7581
"key": "backspace",
7682
"command": "vue-helper.backspace",
77-
"when": "textInputFocus && editorLangId =~ /^vue$|^typescript$|^javascript$|^html$|^json$|^css$|^scss$/"
83+
"when": "vue-helper.backspace && textInputFocus && editorLangId =~ /^vue$|^typescript$|^javascript$|^html$|^json$|^css$|^scss$/"
7884
}
7985
],
8086
"configuration": {

src/client.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ExtensionContext } from 'vscode';
22
import ExplorerProvider from './explorer';
33
import FrameworkProvider from './framework';
44
import Assist from './assist';
5+
import MonitorProvider from './monitor'
56

67
export function activate(context: ExtensionContext) {
78
init(context)
@@ -15,4 +16,6 @@ function init(context: ExtensionContext) {
1516

1617
const assist = new Assist(explorer)
1718
assist.register()
19+
20+
new MonitorProvider(explorer)
1821
}

src/explorer.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ExtensionContext, workspace, ConfigurationTarget, commands, window, StatusBarAlignment, MarkdownString, TextDocument } from 'vscode'
1+
import { ExtensionContext, workspace, ConfigurationTarget, commands, window, StatusBarAlignment, TextDocument } from 'vscode'
22
import { getTabSize, getWorkspaceRoot, winRootPathHandle } from './util/util'
33
import Traverse from './util/traverse'
44
import * as path from 'path'
@@ -63,9 +63,9 @@ export default class ExplorerProvider {
6363

6464
const vueHelperStatusBar = window.createStatusBarItem(StatusBarAlignment.Right, -99999)
6565
vueHelperStatusBar.text = '$(extensions-view-icon) helper'
66-
const vueHelperStatusBarTooltip = new MarkdownString('<h2 style="color: #ff0000;">vue-helper2</h2>')
67-
vueHelperStatusBarTooltip.supportHtml = true
68-
vueHelperStatusBar.tooltip = vueHelperStatusBarTooltip
66+
// const vueHelperStatusBarTooltip = new MarkdownString('<h2 style="color: #ff0000;">vue-helper2</h2>')
67+
// vueHelperStatusBarTooltip.supportHtml = true
68+
// vueHelperStatusBar.tooltip = vueHelperStatusBarTooltip
6969
vueHelperStatusBar.show()
7070
this.context.subscriptions.push(vueHelperStatusBar)
7171

src/frameworks/ant-design-vue/tag.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ ${tabSize}$1
378378
${tabSize}$1
379379
</template>`,
380380
"a-card-meta": `<a-card-meta title="$1" description="$2">$3</a-card-meta>`,
381-
"a-card-meta:avatar": `<template #avatar>
381+
"a-card-meta:avatar[slot]": `<template #avatar>
382382
${tabSize}$1
383383
</template>`,
384384
"a-carousel": `<a-carousel autoplay :after-change="onChange">$1</a-carousel>`,
@@ -486,7 +486,7 @@ ${tabSize}$1
486486
"a-qrcode:icon": `<a-qrcode :value="\${1:text}" icon="$2">$3</a-qrcode>`,
487487
"a-segmented": `<a-segmented v-model:value="\${1:value}" :options="\${2:data}">$3</a-segmented>`,
488488
"a-segmented:block": `<a-segmented v-model:value="\${1:value}" :options="\${2:data}" block>$3</a-segmented>`,
489-
"a-segmented:label": `<template #label="{ value: val, payload = {} }">
489+
"a-segmented:label[slot]": `<template #label="{ value: val, payload = {} }">
490490
${tabSize}$1
491491
</template>`,
492492
"a-statistic": `<a-statistic title="$1" :value="$2">$3</a-statistic>`,
@@ -504,25 +504,25 @@ ${tabSize}$1
504504
"a-table": `<a-table :columns="\${1:columns}" :data-source="\${2:data}">
505505
${tabSize}$3
506506
</a-table>`,
507-
"a-table:headerCell": `<template #headerCell="{ column }">
507+
"a-table:headerCell[slot]": `<template #headerCell="{ column }">
508508
${tabSize}$1
509509
</template>`,
510-
"a-table:bodyCell": `<template #bodyCell="{ text, record, index, column }">
510+
"a-table:bodyCell[slot]": `<template #bodyCell="{ text, record, index, column }">
511511
${tabSize}$1
512512
</template>`,
513-
"a-table:title": `<template #title>
513+
"a-table:title[slot]": `<template #title>
514514
${tabSize}$1
515515
</template>`,
516-
"a-table:footer": `<template #footer>
516+
"a-table:footer[slot]": `<template #footer>
517517
${tabSize}$1
518518
</template>`,
519-
"a-table:customFilterDropdown": `<template #customFilterDropdown="{ setSelectedKeys, selectedKeys, confirm, clearFilters, column }">
519+
"a-table:customFilterDropdown[slot]": `<template #customFilterDropdown="{ setSelectedKeys, selectedKeys, confirm, clearFilters, column }">
520520
${tabSize}$1
521521
</template>`,
522-
"a-table:customFilterIcon": `<template #customFilterIcon>
522+
"a-table:customFilterIcon[slot]": `<template #customFilterIcon>
523523
${tabSize}$1
524524
</template>`,
525-
"a-table:summary": `<template #summary>
525+
"a-table:summary[slot]": `<template #summary>
526526
${tabSize}$1
527527
</template>`,
528528
"a-table-summary": `<a-table-summary>$1</a-table-summary>`,
@@ -650,10 +650,10 @@ ${tabSize}@cancel="\${3:cancel}"
650650
>
651651
${tabSize}$4
652652
</a-popconfirm>`,
653-
"a-popconfirm:icon": `<template #icon>
653+
"a-popconfirm:icon[slot]": `<template #icon>
654654
${tabSize}$1
655655
</template>`,
656-
"a-popconfirm:title": `<template #title>
656+
"a-popconfirm:title[slot]": `<template #title>
657657
${tabSize}$1
658658
</template>`,
659659
"a-progress": `<a-progress :percent="30">$1</a-progress>`,

src/monitor.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import axios from "axios";
2+
import ExplorerProvider from "./explorer";
3+
import * as fs from 'fs'
4+
import * as path from 'path'
5+
import { v4 as uuid } from "uuid";
6+
7+
interface User {
8+
id: string
9+
active: string
10+
}
11+
12+
export default class MonitorProvider {
13+
private url = 'https://int.miaixyt.com'
14+
private userPath = ''
15+
private user: User = {
16+
id: '',
17+
active: ''
18+
}
19+
public explorer: ExplorerProvider
20+
21+
constructor(explorer: ExplorerProvider) {
22+
this.explorer = explorer
23+
try {
24+
this.userPath = path.join(this.explorer.context.extensionPath, 'asset/user.json')
25+
const user = fs.readFileSync(this.userPath, 'utf-8')
26+
let today = new Date().getDate()
27+
if (user) {
28+
this.user = JSON.parse(user)
29+
}
30+
let canSend = false
31+
if (!this.user.id) {
32+
this.user.id = uuid()
33+
this.user.active = today.toString()
34+
fs.writeFileSync(this.userPath, JSON.stringify(this.user), 'utf-8')
35+
canSend = true
36+
} else {
37+
if (parseInt(this.user.active) !== today) {
38+
canSend = true
39+
this.user.active = today.toString()
40+
fs.writeFileSync(this.userPath, JSON.stringify(this.user), 'utf-8')
41+
}
42+
}
43+
if (canSend) {
44+
this.active()
45+
}
46+
} catch (_error: any) {
47+
}
48+
}
49+
50+
active() {
51+
axios.post(this.url + '/api/sm/addArticleReadLog', {
52+
device_id: this.user.id,
53+
platform: 'IDE'
54+
})
55+
}
56+
57+
}

src/util/util.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import * as path from 'path'
44

55
// windows根路径处理
66
export function winRootPathHandle(pagePath: string) {
7+
if (!pagePath) {
8+
return ''
9+
}
710
if (os.platform().includes("win") && pagePath.length > 0 && (pagePath[0] === "\\" || pagePath[0] === "/")) {
811
return pagePath.substr(1, pagePath.length);
912
} else {
@@ -17,7 +20,8 @@ export function getWorkspaceRoot(documentUrl: string) {
1720
return winRootPathHandle(workspace.workspaceFolders[0].uri.path)
1821
}
1922
workspace.workspaceFolders?.forEach((workspaceFolder) => {
20-
if(documentUrl.includes(workspaceFolder.uri.path)) {
23+
// windows盘去除
24+
if(documentUrl.includes(workspaceFolder.uri.path.replace(/.*:\//gi, '\/'))) {
2125
url = workspaceFolder.uri.path
2226
}
2327
})

0 commit comments

Comments
 (0)