Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.vscode/**
.vscode-test/**
src/**
.gitignore
.yarnrc
esbuild.js
**/tsconfig.json
**/.eslintrc.json
eslint.config.mjs
**/*.map
**/*.ts
!l10n/**
node_modules/**
.kiro/**
*.patch
*.vsix
.DS_Store
.idea/**
53 changes: 53 additions & 0 deletions esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
const esbuild = require('esbuild');

const production = process.argv.includes('--production');
const watch = process.argv.includes('--watch');

async function main() {
const ctx = await esbuild.context({
entryPoints: ['src/extension.ts'],
bundle: true,
format: 'cjs',
minify: production,
sourcemap: !production,
sourcesContent: false,
platform: 'node',
outfile: 'out/extension.js',
external: ['vscode'],
logLevel: 'warning',
plugins: [
esbuildProblemMatcherPlugin,
],
});
if (watch) {
await ctx.watch();
} else {
await ctx.rebuild();
await ctx.dispose();
}
}

/**
* @type {import('esbuild').Plugin}
*/
const esbuildProblemMatcherPlugin = {
name: 'esbuild-problem-matcher',
setup(build) {
build.onStart(() => {
console.log('[watch] build started');
});
build.onEnd((result) => {
result.errors.forEach(({ text, location }) => {
console.error(`✘ [ERROR] ${text}`);
if (location == null) return;
console.error(` ${location.file}:${location.line}:${location.column}:`);
});
console.log('[watch] build finished');
});
},
};

main().catch((e) => {
console.error(e);
process.exit(1);
});
51 changes: 51 additions & 0 deletions l10n/bundle.l10n.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"No active file! Please open a file first.": "No active file! Please open a file first.",
"No workspace open! Please open a project folder first.": "No workspace open! Please open a project folder first.",
"No file or project path provided!": "No file or project path provided!",
"Cannot launch {0}: \"{1}\" not found. Please check the editor path config.": "Cannot launch {0}: \"{1}\" not found. Please check the editor path config.",
"Failed to launch {0}: {1}": "Failed to launch {0}: {1}",
"Unsupported editor type: {0}. Currently supported types: jetbrains": "Unsupported editor type: {0}. Currently supported types: jetbrains",
"Use default path": "Use default path",
"Select editor to jump to": "Select editor to jump to",
"Jump to...": "Jump to...",
"JetBrains IDE": "JetBrains IDE",
"Select from preset list": "Select from preset list",
"WebStorm, PyCharm, IDEA, RustRover, etc.": "WebStorm, PyCharm, IDEA, RustRover, etc.",
"Custom Editor": "Custom Editor",
"Manual configuration": "Manual configuration",
"Select editor type": "Select editor type",
"Add Editor ({0}/{1})": "Add Editor ({0}/{1})",
"Select JetBrains IDE": "Select JetBrains IDE",
"Enter editor name": "Enter editor name",
"e.g. Sublime Text": "e.g. Sublime Text",
"macOS URL Scheme (optional, leave empty to skip)": "macOS URL Scheme (optional, leave empty to skip)",
"e.g. subl": "e.g. subl",
"Browse...": "Browse...",
"Open file picker": "Open file picker",
"Enter path manually": "Enter path manually",
"Type path directly": "Type path directly",
"Select {0} path": "Select {0} path",
"Enter editor path": "Enter editor path",
"/Applications/WebStorm.app or C:\\Program Files\\...": "/Applications/WebStorm.app or C:\\Program Files\\...",
"Add Editor": "Add Editor",
"Select": "Select",
"Select {0} path to open": "Select {0} path to open",
"Editor added: {0}": "Editor added: {0}",
"Name": "Name",
"Path": "Path",
"URL Scheme": "URL Scheme",
"Auto detect": "Auto detect",
"None": "None",
"Select field to edit": "Select field to edit",
"Edit {0}": "Edit {0}",
"Enter new name": "Enter new name",
"Enter URL Scheme (leave empty to clear)": "Enter URL Scheme (leave empty to clear)",
"Editor updated: {0}": "Editor updated: {0}",
"Are you sure you want to delete \"{0}\"?": "Are you sure you want to delete \"{0}\"?",
"Delete": "Delete",
"Editor deleted: {0}": "Editor deleted: {0}",
"Add editor...": "Add editor...",
"Type: {0}": "Type: {0}",
"Path: {0}": "Path: {0}",
"URL Scheme: {0}": "URL Scheme: {0}"
}
51 changes: 51 additions & 0 deletions l10n/bundle.l10n.zh-cn.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"No active file! Please open a file first.": "没有打开的文件!请先打开一个文件。",
"No workspace open! Please open a project folder first.": "没有打开的工作区!请先打开一个项目文件夹。",
"No file or project path provided!": "没有提供文件或项目路径!",
"Cannot launch {0}: \"{1}\" not found. Please check the editor path config.": "无法启动 {0}:找不到 \"{1}\"。请检查编辑器路径配置。",
"Failed to launch {0}: {1}": "启动 {0} 失败:{1}",
"Unsupported editor type: {0}. Currently supported types: jetbrains": "不支持的编辑器类型:{0}。目前支持的类型:jetbrains",
"Use default path": "使用默认路径",
"Select editor to jump to": "选择要跳转的编辑器",
"Jump to...": "跳转至...",
"JetBrains IDE": "JetBrains IDE",
"Select from preset list": "从预设列表选择",
"WebStorm, PyCharm, IDEA, RustRover, etc.": "WebStorm, PyCharm, IDEA, RustRover 等",
"Custom Editor": "自定义编辑器",
"Manual configuration": "手动配置",
"Select editor type": "选择编辑器类型",
"Add Editor ({0}/{1})": "添加编辑器 ({0}/{1})",
"Select JetBrains IDE": "选择 JetBrains IDE",
"Enter editor name": "输入编辑器名称",
"e.g. Sublime Text": "例如: Sublime Text",
"macOS URL Scheme (optional, leave empty to skip)": "macOS URL Scheme(可选,留空跳过)",
"e.g. subl": "例如: subl",
"Browse...": "浏览选择...",
"Open file picker": "打开文件选择器",
"Enter path manually": "手动输入路径",
"Type path directly": "直接输入路径",
"Select {0} path": "选择 {0} 的路径",
"Enter editor path": "输入编辑器路径",
"/Applications/WebStorm.app or C:\\Program Files\\...": "/Applications/WebStorm.app 或 C:\\Program Files\\...",
"Add Editor": "添加编辑器",
"Select": "选择",
"Select {0} path to open": "选择 {0} 路径",
"Editor added: {0}": "已添加编辑器: {0}",
"Name": "名称",
"Path": "路径",
"URL Scheme": "URL Scheme",
"Auto detect": "自动检测",
"None": "无",
"Select field to edit": "选择要编辑的字段",
"Edit {0}": "编辑 {0}",
"Enter new name": "输入新名称",
"Enter URL Scheme (leave empty to clear)": "输入 URL Scheme(留空清除)",
"Editor updated: {0}": "已更新编辑器: {0}",
"Are you sure you want to delete \"{0}\"?": "确定要删除 \"{0}\" 吗?",
"Delete": "删除",
"Editor deleted: {0}": "已删除编辑器: {0}",
"Add editor...": "添加编辑器...",
"Type: {0}": "类型: {0}",
"Path: {0}": "路径: {0}",
"URL Scheme: {0}": "URL Scheme: {0}"
}
150 changes: 137 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "switch2idea",
"displayName": "Switch2IDEA",
"description": "Quickly switch between VS Code and IntelliJ IDEA, open current file in IDEA with the same position",
"version": "1.0.3",
"version": "1.0.4",
"publisher": "qczone",
"license": "MIT",
"repository": {
Expand All @@ -27,16 +27,57 @@
"activationEvents": [
"onStartupFinished"
],
"l10n": "./l10n",
"main": "./out/extension.js",
"contributes": {
"views": {
"explorer": [
{
"id": "switch2idea.editors",
"name": "%view.editors.name%",
"contextualTitle": "%view.editors.contextualTitle%",
"when": "switch2idea.showTreeView"
}
]
},
"commands": [
{
"command": "Switch2IDEA.openFileInIDEA",
"title": "Open File in IDEA"
"title": "%command.openFile%"
},
{
"command": "Switch2IDEA.openProjectInIDEA",
"title": "Open Project in IDEA"
"title": "%command.openProject%"
},
{
"command": "switch2idea.addEditor",
"title": "%command.addEditor%",
"icon": "$(add)"
},
{
"command": "switch2idea.editEditor",
"title": "%command.editEditor%",
"icon": "$(edit)"
},
{
"command": "switch2idea.deleteEditor",
"title": "%command.deleteEditor%",
"icon": "$(trash)"
},
{
"command": "switch2idea.openJsonConfig",
"title": "%command.openJsonConfig%",
"icon": "$(json)"
},
{
"command": "switch2idea.refreshEditors",
"title": "%command.refreshEditors%",
"icon": "$(refresh)"
},
{
"command": "switch2idea.jumpToEditor",
"title": "%command.jumpToEditor%",
"icon": "$(link-external)"
}
],
"keybindings": [
Expand All @@ -55,10 +96,51 @@
"configuration": {
"title": "Switch2IDEA",
"properties": {
"switch2idea.editors": {
"type": "array",
"default": [],
"description": "%config.editors.description%",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "%config.editors.items.name.description%"
},
"type": {
"type": "string",
"enum": [
"jetbrains",
"custom"
],
"description": "%config.editors.items.type.description%"
},
"path": {
"type": "string",
"description": "%config.editors.items.path.description%"
},
"urlScheme": {
"type": "string",
"description": "%config.editors.items.urlScheme.description%"
}
},
"required": [
"name",
"type",
"path"
]
}
},
"switch2idea.showTreeView": {
"type": "boolean",
"default": true,
"description": "%config.showTreeView.description%"
},
"switch2idea.ideaPath": {
"type": "string",
"default": "",
"description": "IDEA executable path"
"description": "%config.ideaPath.description%",
"deprecationMessage": "%config.ideaPath.deprecationMessage%"
}
}
},
Expand All @@ -78,30 +160,72 @@
"command": "Switch2IDEA.openProjectInIDEA",
"group": "navigation"
}
],
"view/title": [
{
"command": "switch2idea.addEditor",
"when": "view == switch2idea.editors",
"group": "navigation@1"
},
{
"command": "switch2idea.openJsonConfig",
"when": "view == switch2idea.editors",
"group": "navigation@2"
},
{
"command": "switch2idea.refreshEditors",
"when": "view == switch2idea.editors",
"group": "navigation@3"
}
],
"view/item/context": [
{
"command": "switch2idea.jumpToEditor",
"when": "view == switch2idea.editors && viewItem == editorItem",
"group": "inline@1"
},
{
"command": "switch2idea.editEditor",
"when": "view == switch2idea.editors && viewItem == editorItem",
"group": "1_edit@1"
},
{
"command": "switch2idea.deleteEditor",
"when": "view == switch2idea.editors && viewItem == editorItem",
"group": "1_edit@2"
},
{
"command": "switch2idea.jumpToEditor",
"when": "view == switch2idea.editors && viewItem == editorItem",
"group": "2_jump@1"
}
]
}
},
"scripts": {
"vscode:prepublish": "pnpm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"compile": "pnpm run check-types && node esbuild.js --production",
"check-types": "tsc --noEmit",
"watch": "node esbuild.js --watch",
"pretest": "pnpm run compile && pnpm run lint",
"lint": "eslint src",
"test": "vscode-test",
"package": "pnpm vsce package --no-dependencies",
"publish": "pnpm vsce publish --no-dependencies"
"package": "pnpm run compile && pnpm vsce package --no-dependencies",
"publish": "pnpm run compile && pnpm vsce publish --no-dependencies"
},
"packageManager": "pnpm@9.6.0",
"devDependencies": {
"@types/vscode": "^1.93.1",
"@types/mocha": "^10.0.10",
"@types/node": "20.x",
"@types/vscode": "^1.93.1",
"@typescript-eslint/eslint-plugin": "^8.17.0",
"@typescript-eslint/parser": "^8.17.0",
"eslint": "^9.16.0",
"typescript": "^5.7.2",
"@vscode/test-cli": "^0.0.10",
"@vscode/l10n": "^0.0.18",
"@vscode/test-cli": "^0.0.12",
"@vscode/test-electron": "^2.4.1",
"@vscode/vsce": "^3.2.1"
"@vscode/vsce": "^3.7.1",
"esbuild": "^0.27.3",
"eslint": "^9.18.0",
"typescript": "^5.7.2"
}
}
Loading