From 55a88ee55ae2831defee303bb36b550b49aa7a89 Mon Sep 17 00:00:00 2001 From: donnyh13 Date: Fri, 31 Oct 2025 06:48:37 -0600 Subject: [PATCH 1/4] Fix Function recognition finding COM Objects --- syntaxes/autoit.tmLanguage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntaxes/autoit.tmLanguage b/syntaxes/autoit.tmLanguage index 87d7f445..0df8f904 100644 --- a/syntaxes/autoit.tmLanguage +++ b/syntaxes/autoit.tmLanguage @@ -49,7 +49,7 @@ match - [a-zA-Z_]+[\w_]*(?=\() + (? name entity.name.function.autoit From b7faaacf7ce738d0c06a4c15c31def7ebf0fa8d6 Mon Sep 17 00:00:00 2001 From: donnyh13 Date: Fri, 31 Oct 2025 07:23:17 -0600 Subject: [PATCH 2/4] Add COM recognition with Token name. --- syntaxes/autoit.tmLanguage | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/syntaxes/autoit.tmLanguage b/syntaxes/autoit.tmLanguage index 0df8f904..badda3bd 100644 --- a/syntaxes/autoit.tmLanguage +++ b/syntaxes/autoit.tmLanguage @@ -53,6 +53,12 @@ name entity.name.function.autoit + + name + support.class.com.autoit + match + (?<=\.)\b[_a-zA-Z]+[a-zA-Z0-9]*\b(?=\.|\(|) + match @\b(?i:trayiconflashing|a(?:utoit(?:version|x64|pid|exe)|ppdata(?:common)?dir)|desktopheight|(?:gui_drop|tray_)id|(?:osbuil|gui_(?:drag|ctrl)i|exitmetho|(?:sw_showm(?:in|ax)imiz|hotkeypress|extend)e|compile)d|(?:(?:scriptfull|home)pat|desktop(?:refres|widt|dept))h|(?:logond(?:nsd)?omai|m[io])n|(?:sw_(?:shownoactivat|m(?:in|ax)imiz)|sw_showminnoactiv|(?:script|user)nam|gui_(?:ctrlhand|winhand|dragfi)l|home(?:shar|driv)|computernam|sw_restor|exitcod|sw_hid|ostyp|(?:trayiconvisi|sw_(?:dis|en)a)bl)e|(?:scriptlinenumbe|logonserve|desktopdi|erro|yea|hou)r|(?:sw_showdefaul|kblayou)t|sw_shown(?:ormal|a)|c(?:puarch|rlf|om(?:_eventobj|spec))|m(?:uilang|day)|ipaddress[1-4]|(?:localappdata|userprofile|working|system|temp|(?:mydocument|window)s|programfiles|commonfiles)dir|(?:start(?:menu|up)|favorites|programs)(?:common)?dir|numparams|osversion|sw_show|osarch|oslang|msec|[wy]day|sec|tab|lf|cr|scriptdir|osservicepack|sw_(?:un)?lock|d(?:ocuments|esktop)commondir)\b From b1c0d255c6509ee4a7c5d9595e9bb8d27995c2b0 Mon Sep 17 00:00:00 2001 From: Logan Hampton Date: Fri, 7 Nov 2025 15:25:18 -0700 Subject: [PATCH 3/4] refactor(syntax): simplify autoit regex patterns Simplify regex patterns in autoit.tmLanguage by: - Consolidating character classes using \w shorthand - Removing redundant character class combinations - Streamlining pattern matching for function names and COM object members These changes improve pattern readability and maintainability while preserving the same matching behavior. --- syntaxes/autoit.tmLanguage | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntaxes/autoit.tmLanguage b/syntaxes/autoit.tmLanguage index badda3bd..e53c4346 100644 --- a/syntaxes/autoit.tmLanguage +++ b/syntaxes/autoit.tmLanguage @@ -49,7 +49,7 @@ match - (? + (? name entity.name.function.autoit @@ -57,7 +57,7 @@ name support.class.com.autoit match - (?<=\.)\b[_a-zA-Z]+[a-zA-Z0-9]*\b(?=\.|\(|) + (?<=\.)\b[a-zA-Z_]\w*\b match From 89e7bfe9d1dfe814ea91b9193b3831f9bd5d7006 Mon Sep 17 00:00:00 2001 From: Logan Hampton Date: Fri, 7 Nov 2025 15:25:36 -0700 Subject: [PATCH 4/4] feat(syntax): add COM object syntax highlighting and distinct token scopes --- README.md | 11 +++++++++++ changelog.md | 3 +++ 2 files changed, 14 insertions(+) diff --git a/README.md b/README.md index 8bc1a08e..a5d12d26 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,17 @@ Open include files at cursor position with Alt+I, with support for custom includ Run multiple scripts simultaneously with separate output panels for each. +### Syntax Highlighting + +Comprehensive syntax highlighting for AutoIt code, including: + +- Keywords, functions, and macros +- Variables, constants, and strings +- Comments and documentation blocks +- **COM object properties and methods** with distinct highlighting for dot notation (e.g., `$oExcel.Workbooks.Add()`) + +COM objects are highlighted with a special token scope (`support.class.com.autoit`), allowing themes to style them distinctly from regular functions. + --- ## Platform Support diff --git a/changelog.md b/changelog.md index f1a34794..da365df0 100644 --- a/changelog.md +++ b/changelog.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- COM object syntax highlighting for properties and methods using dot notation +- Distinct token scopes for COM identifiers (`support.class.com.autoit`) to enable theme-specific styling - File path validation to prevent path traversal attacks - Parameter safety warnings for `autoit.consoleParams` to detect potentially dangerous shell metacharacters - Workspace symbol performance optimizations with batch processing to prevent UI freezing on large projects @@ -23,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Function pattern incorrectly matching COM object methods (e.g., `$obj.Method()` now correctly identified as COM, not function) - Command injection risk in registry update functionality by replacing `exec` with `execFile` for safer argument handling - Multiple global output panels opening for AutoIt on startup - Memory leak in completion provider where include cache grew indefinitely across document switches