Skip to content

Commit 0dbb7f8

Browse files
authored
Merge pull request #58 from phenixqin/support-trae-cn
Add support for Trae AI IDE - 添加对Trae AI IDE的支持
2 parents e1d2c64 + 7ae7fb2 commit 0dbb7f8

File tree

2 files changed

+62
-1
lines changed

2 files changed

+62
-1
lines changed

.gitignore

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,43 @@
1-
/node_modules
1+
/node_modules
2+
.DS_Store
3+
*.log
4+
.vscode/
5+
dist/
6+
build/
7+
*.vsix
8+
*.tgz
9+
*.zip
10+
coverage
11+
.env
12+
.env.local
13+
.env.development.local
14+
.env.test.local
15+
.env.production.local
16+
.cache
17+
.parcel-cache
18+
.next
19+
.nuxt
20+
.vuepress/dist
21+
.serverless/
22+
.fusebox/
23+
.dynamodb/
24+
.tern-port
25+
.vscode-test
26+
.yarn-integrity
27+
*.pem
28+
.history/
29+
Thumbs.db
30+
*.swp
31+
*.swo
32+
*~
33+
.project
34+
.classpath
35+
.c9/
36+
*.launch
37+
.settings/
38+
*.sublime-workspace
39+
*.suo
40+
*.ntvs*
41+
*.njsproj
42+
*.sln
43+
*.sw?

src/extension.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,25 @@ if (!fs.existsSync(htmlFile)) {
2727
if (!fs.existsSync(htmlFile)) {
2828
htmlFile = path.join(base, 'electron-sandbox', 'workbench', 'workbench.esm.html')
2929
}
30+
// Support Trae CN (similar to Cursor)
31+
if (!fs.existsSync(htmlFile)) {
32+
// Check if this is Trae CN by looking at the application path
33+
const isTraeCN = require.main && require.main.filename.includes('Trae CN.app')
34+
if (isTraeCN && fs.existsSync(path.join(base, 'electron-sandbox'))) {
35+
// Create a symlink for Trae CN if electron-browser doesn't exist
36+
try {
37+
const electronBrowserPath = path.join(base, 'electron-browser')
38+
if (!fs.existsSync(electronBrowserPath)) {
39+
const electronSandboxPath = path.join(base, 'electron-sandbox')
40+
// Instead of creating actual symlink (which requires admin rights),
41+
// we'll just use the electron-sandbox path for Trae CN
42+
htmlFile = path.join(electronSandboxPath, 'workbench', 'workbench.html')
43+
}
44+
} catch (error) {
45+
console.error('Error handling Trae CN path:', error)
46+
}
47+
}
48+
}
3049
if (!fs.existsSync(htmlFile)) {
3150
htmlFile = path.join(base, 'electron-browser', 'workbench', 'workbench.esm.html')
3251
}

0 commit comments

Comments
 (0)