Skip to content

Commit

Permalink
Remove dupe commands, fixup internationalization (i18n) (#479)
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-wiemer authored Aug 28, 2024
1 parent a110e47 commit d293156
Show file tree
Hide file tree
Showing 9 changed files with 153 additions and 127 deletions.
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ dist
node_modules
out

# Files
# Common files
.vscode/settings.json
language/*.tmLanguage.json
*.exe
*.vsix

# Misc
*.log
*.txt
*.vsix
*.zip
2 changes: 1 addition & 1 deletion ahk2
Submodule ahk2 updated from fd70f0 to 4f5fd5
13 changes: 2 additions & 11 deletions docs/FullV2Integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ This doc covers all the new features as a result of integrating with thqby's AHK

### Commands

- ahk2.debug (dupe of ahk++.debug)
- ahk2.debug.attach
- ahk2.debug.params
- ahk2.diagnostic.full
- ahk2.export.symbols
- ahk2.run (dupe of ahk++.run)
- ahk2.selection.run (dupe of ahk++.runSelection)
- ahk2.run (replaces ahk++.run)
- ahk2.selection.run (replaces ahk++.runSelection)
- ahk2.stop
- ahk2.compile (dupe of ahk++.compile)
- ahk2.generate.comment
- ahk2.updateversioninfo
- ahk2.switch
Expand Down Expand Up @@ -74,8 +72,6 @@ See [commands](#commands) for duplicates

- ahk2.run
- ahk2.selection.run
- ahk2.compile
- ahk2.debug
- ahk2.debug.params
- ahk2.help
- ahk2.stop
Expand All @@ -90,12 +86,10 @@ See [commands](#commands) for duplicates

editor/context:

- ahk2.debug
- ahk2.debug.attach
- ahk2.debug.params
- ahk2.selection.run
- ahk2.run
- ahk2.compile
- ahk2.help
- ahk2.stop
- ahk2.generate.comment
Expand All @@ -105,7 +99,6 @@ editor/title:

- ahk2.run
- ahk2.stop
- ahk2.debug

### Semantic token scopes

Expand All @@ -128,10 +121,8 @@ New, added:

These issues will be resolved before a full release

- Several [commands](#commands) are duplicated. The plan is to retain the current visual style.
- Needs more tests!! Many features have not been tested at all, hence the pre-release!
- [Release pipeline](../.github/workflows/deploy.yml) has been changed to push pre-releases. Definitely fix this for the final release 😉
- Settings description name placeholders are not replaced

### Low priority

Expand Down
71 changes: 2 additions & 69 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"language/snippetsV2.json",
"dist/extension.js",
"icon.png",
"license.txt"
"license.txt",
"package.nls.*"
],
"scripts": {
"build": "node build.mjs --mode=production && cd ahk2 && npm run build",
Expand Down Expand Up @@ -108,23 +109,6 @@
"title": "Open AutoHotkey Help",
"category": "AHK++"
},
{
"command": "ahk++.run",
"title": "Run AHK Script",
"category": "AHK++"
},
{
"command": "ahk++.runSelection",
"title": "Run Selection",
"category": "AHK++"
},
{
"enablement": "editorLangId == ahk2 && shellExecutionSupported",
"command": "ahk2.debug",
"title": "%ahk2.debug%",
"icon": "$(debug)",
"category": "ahk2"
},
{
"enablement": "!isWeb",
"command": "ahk2.debug.attach",
Expand Down Expand Up @@ -169,12 +153,6 @@
"icon": "$(stop)",
"category": "ahk2"
},
{
"enablement": "editorLangId == ahk2 && shellExecutionSupported",
"command": "ahk2.compile",
"title": "%ahk2.compile%",
"category": "ahk2"
},
{
"enablement": "editorLangId == ahk2",
"command": "ahk2.generate.comment",
Expand Down Expand Up @@ -774,16 +752,6 @@
"key": "ctrl+f1",
"when": "editorLangId == ahk || editorLangId == ahk2"
},
{
"command": "ahk++.run",
"key": "ctrl+f9",
"when": "editorLangId == ahk || editorLangId == ahk2"
},
{
"command": "ahk++.runSelection",
"key": "ctrl+f8",
"when": "editorLangId == ahk || editorLangId == ahk2"
},
{
"command": "ahk2.run",
"key": "ctrl+f5",
Expand All @@ -794,16 +762,6 @@
"key": "ctrl+f5",
"when": "editorLangId == ahk2 && !isWeb && editorHasSelection"
},
{
"command": "ahk2.compile",
"key": "ctrl+shift+f5",
"when": "editorLangId == ahk2 && !isWeb"
},
{
"command": "ahk2.debug",
"key": "f5",
"when": "editorLangId == ahk2 && !isWeb && !inDebugMode"
},
{
"command": "ahk2.debug.params",
"key": "shift+f5",
Expand Down Expand Up @@ -875,21 +833,6 @@
"when": "editorLangId == ahk || editorLangId == ahk2",
"group": "navigation@1"
},
{
"command": "ahk++.run",
"when": "editorLangId == ahk || editorLangId == ahk2",
"group": "navigation@0"
},
{
"command": "ahk++.runSelection",
"when": "(editorLangId == ahk || editorLangId == ahk2) && editorHasSelection",
"group": "navigation@-1"
},
{
"when": "editorLangId == ahk2 && !isWeb",
"command": "ahk2.debug",
"group": "navigation@1"
},
{
"when": "editorLangId == ahk2 && !isWeb",
"command": "ahk2.debug.attach",
Expand All @@ -910,11 +853,6 @@
"command": "ahk2.run",
"group": "navigation@0"
},
{
"when": "editorLangId == ahk2 && !isWeb",
"command": "ahk2.compile",
"group": "navigation@2"
},
{
"when": "editorLangId == ahk2 && !isWeb && ahk2:isRunning",
"command": "ahk2.stop",
Expand Down Expand Up @@ -946,11 +884,6 @@
"command": "ahk2.stop",
"group": "navigation@0",
"when": "resourceLangId == ahk2 && ahk2:isRunning && shellExecutionSupported"
},
{
"command": "ahk2.debug",
"group": "navigation@1",
"when": "resourceLangId == ahk2 && shellExecutionSupported"
}
]
},
Expand Down
33 changes: 33 additions & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"ahk2.actionwhenv1isdetected": "Action when v1 script is detected",
"ahk2.autolibinclude": "Provide completion and automatic include from User and Standard library, Local library",
"ahk2.commenttags": "A regular expression used to extract named tags from comments and generate module symbols",
"ahk2.compilercmd": "Compiler command line options. If ahk2exe.exe is not specified, the default path will be used. `${execPath}` is equal to the currently selected AutoHotkey.exe",
"ahk2.completefunctionparens": "Parentheses are added to function completion when there is no `(` or `[` on the right; otherwise move the cursor to the right",
"ahk2.completioncommitcharacters": "Characters which commit auto completion, such as `.(`",
"ahk2.debug.attach": "Attach Running Script",
"ahk2.debug.params": "Debug Script with Params",
"ahk2.debugconfiguration": "Append debugging configuration to the currently started debugger, same as launch.json configuration",
"ahk2.description": "Autohotkey2 Language Support using vscode-lsp",
"ahk2.diagnostic.full": "Diagnostic full text",
"ahk2.diagnostics.class-non-dynamic-member-check": "Check whether non-dynamic members of class exist",
"ahk2.diagnostics.paramscheck": "Check that the function call has the correct number of arguments",
"ahk2.warn.varunset": "Display warnings for each variable that has never been directly assigned or used with the reference operator",
"ahk2.warn.localsameasglobal": "Display warnings for each undeclared local variable which has the same name as a global variable",
"ahk2.warn.callwithoutparentheses": "Display warnings for each function or method call without parentheses",
"ahk2.export.symbols": "Export ahk classes and functions",
"ahk2.files.exclude": "Configure glob patterns for excluding files and folders when scanning ahk files.",
"ahk2.files.scanmaxdepth": "Controls the depth when scanning ahk files.",
"ahk2.generatecomment": "Generate Comment Template",
"ahk2.help": "Quick Help",
"ahk2.interpreterpath": "The path of the `AutoHotkey.exe` executable file. If `AutoHotkeyUX.exe` is selected, the script will be launched using UX Launcher.",
"ahk2.run": "Run Script",
"ahk2.selection.run": "Run Selected Script",
"ahk2.setinterpreter": "Select AutoHotkey2 Interpreter",
"ahk2.setscriptdir": "Set here as A_ScriptDir",
"ahk2.stop": "Stop Running Script",
"ahk2.symbolfoldingfromopenbrace": "Forced symbol folding starts at open brace",
"ahk2.syntaxes": "Specifies the folder path to the `ahk2.json`, `*.snippet.json` and `ahk2.d.ahk` files used for IntelliSense.",
"ahk2.updateversioninfo": "Update File Version Info",
"ahk2.workingdirs": "Sets the working directory for the script"
}
109 changes: 109 additions & 0 deletions package.nls.zh-cn.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{
"action.skipline": "跳过行",
"action.stopparsing": "停止解析",
"action.switchtov1": "切换到ahk v1",
"ahk2.actionwhenv1isdetected": "检测到v1脚本时的行为",
"ahk2.autolibinclude": "对用户库和标准库, 本地库提供补全和自动include",
"ahk2.commenttags": "用来从注释中提取命名标记的正则表达式, 并生成模块符号",
"ahk2.compilercmd": "编译器命令行选项. 如果未指定ahk2exe.exe, 将使用默认路径. `${execPath}`等价于当前选择的AutoHotkey.exe",
"ahk2.completefunctionparens": "当右侧不存在`(`或`[`时, 给函数补全添加括号; 否则向右移动光标",
"ahk2.completioncommitcharacters": "提交自动完成的字符, 例如`.(`",
"ahk2.debug.attach": "附加到运行中的脚本",
"ahk2.debug.params": "带参调试",
"ahk2.debugconfiguration": "追加调试配置到当前启动的调试器, 与launch.json配置相同",
"ahk2.description": "基于 vscode-lsp 协议的 Autohotkey2 语言支持",
"ahk2.diagnostic.full": "诊断全文",
"ahk2.diagnostics.class-non-dynamic-member-check": "检查类非动态成员是否存在",
"ahk2.diagnostics.paramscheck": "检查函数调用参数个数是否正确",
"ahk2.warn.varunset": "为每个从未直接赋值或与引用操作符一起使用的变量的显示警告",
"ahk2.warn.localsameasglobal": "为每个与全局变量同名的未声明的局部变量显示警告",
"ahk2.warn.callwithoutparentheses": "为每个不带括号的函数或方法调用显示警告",
"ahk2.export.symbols": "导出ahk类和函数",
"ahk2.files.exclude": "配置 glob 模式以在扫描ahk文件时排除文件和文件夹.",
"ahk2.files.scanmaxdepth": "控制扫描ahk文件时的深度.",
"ahk2.generatecomment": "生成注释模板",
"ahk2.help": "快捷帮助",
"ahk2.interpreterpath": "`AutoHotkey.exe`可执行文件的路径. 如果选择`AutoHotkeyUX.exe`, 将使用UX Launcher启动脚本.",
"ahk2.run": "运行脚本",
"ahk2.selection.run": "运行选择的脚本",
"ahk2.setinterpreter": "选择AutoHotkey2解释器",
"ahk2.setscriptdir": "设置此处为A_ScriptDir",
"ahk2.stop": "停止运行中的脚本",
"ahk2.symbolfoldingfromopenbrace": "强制符号折叠从大括号处开始",
"ahk2.syntaxes": "指定用于智能感知的`ahk2.json`, `*.snippet.json`和`ahk2.d.ahk`文件的文件夹路径.",
"ahk2.updateversioninfo": "更新文件版本信息",
"ahk2.workingdirs": "设置脚本的工作目录",
"codeaction.include": "导入 '{0}'",
"completionitem.author": "添加作者, 描述, 日期, 版本等文件信息.",
"completionitem.generatecomment": "生成当前作用域函数/方法的注释模板.",
"completionitem.include": "从'{0}'自动导入",
"completionitem.new": "构造类的新实例.",
"completionitem.prototype": "检索或设置类的所有实例所基于的对象.",
"completionitem.super": "在继承类中, super 可以代替 this 来访问在派生类中被重写的方法或属性的超类版本.",
"completionitem.this": "在类中, 通过 this 访问该类的其他实例变量和方法.",
"completionitem.thishotkey": "热键函数的隐藏参数.",
"completionitem.value": "在动态属性 set 中, Value 包含被分配的值.",
"diagnostic.acceptparams": "'{0}' 接受{1}个参数",
"diagnostic.assignerr": "{0} '{1}'不能用作输出变量",
"diagnostic.classinfuncerr": "函数不能包含类",
"diagnostic.classuseerr": "类不能用作输出变量",
"diagnostic.conflictserr": "{0} '{2}'声明和已存在的{1}冲突",
"diagnostic.declarationerr": "意外的声明",
"diagnostic.defaultvalmissing": "'{0}' 需要参数默认值",
"diagnostic.deprecated": "使用'{0}'而不是'{1}'",
"diagnostic.didyoumean": "你是想用'{0}'吗?",
"diagnostic.dupdeclaration": "重复声明",
"diagnostic.duplabel": "重复的标签声明",
"diagnostic.filenotexist": "'{0}'文件不存在",
"diagnostic.funccallerr": "函数调用需要空格或'(', 仅在参数之间使用逗号",
"diagnostic.funccallerr2": "在表达式中, 函数调用需要括号",
"diagnostic.hotdeferr": "热键/热字串不能在函数/类中定义",
"diagnostic.hotmissbrace": "热键或热字符串缺少左括号",
"diagnostic.invaliddefinition": "无效的{0}定义",
"diagnostic.invalidencoding": "'{0}' 无效的文件编码",
"diagnostic.invalidhotdef": "无效的热键定义",
"diagnostic.invalidparam": "无效的参数定义",
"diagnostic.invalidprop": "不是有效的getter/setter属性",
"diagnostic.invalidpropname": "对象字面量中的属性名无效",
"diagnostic.invalidsymbolname": "无效的符号命名 '{0}'",
"diagnostic.invalidscope": "'{0}'不能在函数/类中使用",
"diagnostic.invalidsuper": "'super'仅在类内部有效",
"diagnostic.maybehavenotmember": "类'{0}'可能没有成员'{1}'",
"diagnostic.maybev1": "这可能是一个v1脚本, lexer停止解析.",
"diagnostic.missing": "丢失对应的 '{0}'",
"diagnostic.missingparam": "缺少必需的参数",
"diagnostic.missingoperand": "缺少操作数",
"diagnostic.missingretval": "函数缺少返回值",
"diagnostic.missingspace": "前面缺少空格或运算符",
"diagnostic.objectliteralerr": "对象字面量存在错误",
"diagnostic.outofloop": "Break/Continue必须被循环包围",
"diagnostic.paramcounterr": "应有 {0} 个参数, 但获得 {1} 个",
"diagnostic.pathinvalid": "无效的文件路径",
"diagnostic.propdeclaraerr": "不是有效的方法, 类或属性定义",
"diagnostic.propemptyparams": "动态属性不允许使用空[]",
"diagnostic.propnotinit": "属性声明未初始化",
"diagnostic.requirev1": "此脚本需要AutoHotkey v1, lexer停止解析.",
"diagnostic.requirevariable": "'&'需要一个变量",
"diagnostic.requireversion": "该特性需要AutoHotkey版本 >= v{0}",
"diagnostic.reservedworderr": "保留字'{0}'不得用作变量名",
"diagnostic.resourcenotfound": "未找到或无法解析资源",
"diagnostic.skipline": "该行被跳过且未解析",
"diagnostic.syntaxerror": "语法错误. 具体为: {0}",
"diagnostic.tryswitchtov1": "尝试切换到AutoHotkey v1.",
"diagnostic.typemaybenot": "类型可能不是 '{0}'",
"diagnostic.unexpected": "意外的'{0}'",
"diagnostic.unknown": "未知的{0}",
"diagnostic.unknownoperatoruse": "未知的操作符使用",
"diagnostic.unknowntoken": "未知的Token '{0}'",
"diagnostic.unsupportinclude": "函数、类中的#include无法正确地推导作用域和代码补全",
"diagnostic.unterminated": "未终止的字符串文本",
"warn.varisunset": "变量'{0}'似乎从未被赋值",
"warn.localsameasglobal": "局部变量'{0}'与全局变量具有相同的名称",
"warn.callwithoutparentheses": "函数或方法调用没有使用括号",
"response.cannotrename": "无法重命名此元素。",
"response.cannotrenamestdlib": "不能重命名标准AutoHotkey库中定义的元素。",
"setting.ahkpatherr": "AutoHotkey解释器不存在, 在'设置-AutoHotkey2.InterpreterPath'中重新指定",
"setting.getenverr": "获取环境变量失败",
"setting.uialimit": "由于安全限制, UIA可执行文件不允许重定向stdin/stdout, 因此依赖于此的一些功能将无法工作",
"setting.versionerr": "当前AutoHotkey.exe不是v2版本, 无法获得正确的语法解析、补全等功能"
}
14 changes: 0 additions & 14 deletions src/common/codeUtil.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
import * as vscode from 'vscode';
import { LanguageId } from './global';

/**
* Returns the editor's selected text.
* Empty string if nothing is selected.
* `undefined` if no editor is provided.
*/
export const getSelectedText = (
editor:
| {
document: { getText: (selection: vscode.Selection) => string };
selection: vscode.Selection;
}
| undefined,
): string | undefined => editor?.document.getText(editor.selection);

export class CodeUtil {
/**
* Trim non-formatted chars out of original line of code
Expand Down
4 changes: 0 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ export function activate(context: vscode.ExtensionContext) {
RunnerService.startDebugger(),
),
vscode.commands.registerCommand('ahk++.openHelp', openHelp),
vscode.commands.registerCommand('ahk++.run', () => RunnerService.run()),
vscode.commands.registerCommand('ahk++.runSelection', () =>
RunnerService.runSelection(),
),
);

if (Global.getConfig<boolean>(ConfigKey.enableIntellisense)) {
Expand Down
Loading

0 comments on commit d293156

Please sign in to comment.