From 34683118a04f12e651a8ec32b7c98e66183673fa Mon Sep 17 00:00:00 2001 From: Mark Phillipson Date: Mon, 15 Jun 2026 14:30:34 +0100 Subject: [PATCH 1/3] Add common C# keywords and functions to Talon lists --- lang/csharp/code_common_function.talon-list | 34 +++++++- lang/csharp/code_keyword.talon-list | 90 +++++++++++++++++++++ lang/csharp/csharp.py | 7 +- lang/csharp/csharp.talon | 1 + 4 files changed, 128 insertions(+), 4 deletions(-) create mode 100644 lang/csharp/code_keyword.talon-list diff --git a/lang/csharp/code_common_function.talon-list b/lang/csharp/code_common_function.talon-list index 2b63140977..92470ac111 100644 --- a/lang/csharp/code_common_function.talon-list +++ b/lang/csharp/code_common_function.talon-list @@ -2,6 +2,34 @@ list: user.code_common_function code.language: csharp - -integer: int.TryParse -print: Console.WriteLine -string: .ToString +integer: "int.TryParse", +print: "Console.WriteLine", +string: ".ToString", +length: ".Length", +order by: "OrderBy", +order by descending: "OrderByDescending", +then by: "ThenBy", +then by descending: "ThenByDescending", +include: "Include", +group by: "GroupBy", +select: "Select", +where: "Where", +first or default: "FirstOrDefault", +first: "First", +first or default async: "FirstOrDefaultAsync", +first async: "FirstAsync", +single or default: "SingleOrDefault", +contains: "Contains", +count: "Count", +to list: "ToList", +to list async: "ToListAsync", +to array: "ToArray", +to dictionary: "ToDictionary", +to lower: "ToLower", +to upper: "ToUpper", +trim: "Trim", +trim start: "TrimStart", +trim end: "TrimEnd", +substring: "Substring", +replace: "Replace", +split: "Split", diff --git a/lang/csharp/code_keyword.talon-list b/lang/csharp/code_keyword.talon-list new file mode 100644 index 0000000000..1a7d7b6940 --- /dev/null +++ b/lang/csharp/code_keyword.talon-list @@ -0,0 +1,90 @@ +list: user.code_keyword +code.language: csharp +code.language: aspnetcorerazor +- + +abstract: " abstract ", +add: " add ", +alias: " alias ", +ascending: " ascending ", +async: " async ", +await: " await ", +base: " base ", +boolean: " bool ", +break: " break ", +case: " case ", +catch: " catch ", +class: " class ", +const: " const ", +continue: " continue ", +default: " default ", +delegate: " delegate ", +descending: " descending ", +double: " double ", +dynamic: " dynamic ", +else: " else ", +enum: " enum ", +equals: " equals ", +event: " event ", +explicit: " explicit ", +extern: " extern ", +false: " false ", +finally: " finally ", +for: " for ", +foreach: " foreach ", +from: " from ", +get: " get ", +global: " global ", +group: " group ", +if: " if ", +implicit: " implicit ", +in: " in ", +integer: " int ", +interface: " interface ", +internal: " internal ", +into: " into ", +is: " is ", +join: " join ", +let: " let ", +lock: " lock ", +name of: " nameof ", +namespace: " namespace ", +new: " new ", +null: " null ", +operator: " operator ", +order by: " orderby ", +out: " out ", +override: " override ", +params: " params ", +partial: " partial ", +private: " private ", +protected: " protected ", +public: " public ", +read only: " readonly ", +ref: " ref ", +remove: " remove ", +required: " required ", +return: " return ", +sealed: " sealed ", +select: " select ", +set: " set ", +size of: " sizeof ", +static: " static ", +string: " string ", +struct: " struct ", +switch: " switch ", +this: " this ", +throw: " throw ", +true: " true ", +try: " try ", +type of: " typeof ", +unsafe: " unsafe ", +using: " using ", +value: " value ", +var: " var ", +virtual: " virtual ", +volatile: " volatile ", +void: " void ", +where: " where ", +while: " while ", +yield: " yield " diff --git a/lang/csharp/csharp.py b/lang/csharp/csharp.py index 84dd0ab660..f390b2055f 100644 --- a/lang/csharp/csharp.py +++ b/lang/csharp/csharp.py @@ -1,13 +1,18 @@ -from talon import Context, actions, settings +from talon import Context,Module, actions, settings from ...core.described_functions import create_described_insert_between from ..tags.operators import Operators +mod = Module() + ctx = Context() ctx.matches = r""" code.language: csharp """ +mod.list("code_common_function", desc="Common C# functions") +mod.list("code_keyword", desc="Common C# keywords") + operators = Operators( # code_operators_array SUBSCRIPT=create_described_insert_between("[", "]"), diff --git a/lang/csharp/csharp.talon b/lang/csharp/csharp.talon index 95972f6501..cf2c47b63c 100644 --- a/lang/csharp/csharp.talon +++ b/lang/csharp/csharp.talon @@ -17,6 +17,7 @@ tag(): user.code_operators_bitwise tag(): user.code_operators_lambda tag(): user.code_operators_math tag(): user.code_operators_pointer +tag(): user.code_keywords settings(): user.code_private_function_formatter = "PRIVATE_CAMEL_CASE" From abe99cb5974bb91802ef5899d2f804b83882bd7c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 15 Jun 2026 13:34:15 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- lang/csharp/csharp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/csharp/csharp.py b/lang/csharp/csharp.py index f390b2055f..0ee38fe26b 100644 --- a/lang/csharp/csharp.py +++ b/lang/csharp/csharp.py @@ -1,4 +1,4 @@ -from talon import Context,Module, actions, settings +from talon import Context, Module, actions, settings from ...core.described_functions import create_described_insert_between from ..tags.operators import Operators From a6d790f1da6d4e5082b3aaa827261ba0ae6a54f5 Mon Sep 17 00:00:00 2001 From: Mark Phillipson Date: Mon, 15 Jun 2026 14:53:31 +0100 Subject: [PATCH 3/3] Refactor C# keyword and function lists to remove trailing commas --- lang/csharp/code_common_function.talon-list | 62 ++++---- lang/csharp/code_keyword.talon-list | 168 ++++++++++---------- 2 files changed, 115 insertions(+), 115 deletions(-) diff --git a/lang/csharp/code_common_function.talon-list b/lang/csharp/code_common_function.talon-list index 92470ac111..257d7063bd 100644 --- a/lang/csharp/code_common_function.talon-list +++ b/lang/csharp/code_common_function.talon-list @@ -2,34 +2,34 @@ list: user.code_common_function code.language: csharp - -integer: "int.TryParse", -print: "Console.WriteLine", -string: ".ToString", -length: ".Length", -order by: "OrderBy", -order by descending: "OrderByDescending", -then by: "ThenBy", -then by descending: "ThenByDescending", -include: "Include", -group by: "GroupBy", -select: "Select", -where: "Where", -first or default: "FirstOrDefault", -first: "First", -first or default async: "FirstOrDefaultAsync", -first async: "FirstAsync", -single or default: "SingleOrDefault", -contains: "Contains", -count: "Count", -to list: "ToList", -to list async: "ToListAsync", -to array: "ToArray", -to dictionary: "ToDictionary", -to lower: "ToLower", -to upper: "ToUpper", -trim: "Trim", -trim start: "TrimStart", -trim end: "TrimEnd", -substring: "Substring", -replace: "Replace", -split: "Split", +integer: "int.TryParse" +print: "Console.WriteLine" +string: ".ToString" +length: ".Length" +order by: "OrderBy" +order by descending: "OrderByDescending" +then by: "ThenBy" +then by descending: "ThenByDescending" +include: "Include" +group by: "GroupBy" +select: "Select" +where: "Where" +first or default: "FirstOrDefault" +first: "First" +first or default async: "FirstOrDefaultAsync" +first async: "FirstAsync" +single or default: "SingleOrDefault" +contains: "Contains" +count: "Count" +to list: "ToList" +to list async: "ToListAsync" +to array: "ToArray" +to dictionary: "ToDictionary" +to lower: "ToLower" +to upper: "ToUpper" +trim: "Trim" +trim start: "TrimStart" +trim end: "TrimEnd" +substring: "Substring" +replace: "Replace" +split: "Split" diff --git a/lang/csharp/code_keyword.talon-list b/lang/csharp/code_keyword.talon-list index 1a7d7b6940..1201e0578f 100644 --- a/lang/csharp/code_keyword.talon-list +++ b/lang/csharp/code_keyword.talon-list @@ -3,88 +3,88 @@ code.language: csharp code.language: aspnetcorerazor - -abstract: " abstract ", -add: " add ", -alias: " alias ", -ascending: " ascending ", -async: " async ", -await: " await ", -base: " base ", -boolean: " bool ", -break: " break ", -case: " case ", -catch: " catch ", -class: " class ", -const: " const ", -continue: " continue ", -default: " default ", -delegate: " delegate ", -descending: " descending ", -double: " double ", -dynamic: " dynamic ", -else: " else ", -enum: " enum ", -equals: " equals ", -event: " event ", -explicit: " explicit ", -extern: " extern ", -false: " false ", -finally: " finally ", -for: " for ", -foreach: " foreach ", -from: " from ", -get: " get ", -global: " global ", -group: " group ", -if: " if ", -implicit: " implicit ", -in: " in ", -integer: " int ", -interface: " interface ", -internal: " internal ", -into: " into ", -is: " is ", -join: " join ", -let: " let ", -lock: " lock ", -name of: " nameof ", -namespace: " namespace ", -new: " new ", -null: " null ", -operator: " operator ", -order by: " orderby ", -out: " out ", -override: " override ", -params: " params ", -partial: " partial ", -private: " private ", -protected: " protected ", -public: " public ", -read only: " readonly ", -ref: " ref ", -remove: " remove ", -required: " required ", -return: " return ", -sealed: " sealed ", -select: " select ", -set: " set ", -size of: " sizeof ", -static: " static ", -string: " string ", -struct: " struct ", -switch: " switch ", -this: " this ", -throw: " throw ", -true: " true ", -try: " try ", -type of: " typeof ", -unsafe: " unsafe ", -using: " using ", -value: " value ", -var: " var ", -virtual: " virtual ", -volatile: " volatile ", -void: " void ", -where: " where ", -while: " while ", +abstract: " abstract " +add: " add " +alias: " alias " +ascending: " ascending " +async: " async " +await: " await " +base: " base " +boolean: " bool " +break: " break " +case: " case " +catch: " catch " +class: " class " +const: " const " +continue: " continue " +default: " default " +delegate: " delegate " +descending: " descending " +double: " double " +dynamic: " dynamic " +else: " else " +enum: " enum " +equals: " equals " +event: " event " +explicit: " explicit " +extern: " extern " +false: " false " +finally: " finally " +for: " for " +foreach: " foreach " +from: " from " +get: " get " +global: " global " +group: " group " +if: " if " +implicit: " implicit " +in: " in " +integer: " int " +interface: " interface " +internal: " internal " +into: " into " +is: " is " +join: " join " +let: " let " +lock: " lock " +name of: " nameof " +namespace: " namespace " +new: " new " +null: " null " +operator: " operator " +order by: " orderby " +out: " out " +override: " override " +params: " params " +partial: " partial " +private: " private " +protected: " protected " +public: " public " +read only: " readonly " +ref: " ref " +remove: " remove " +required: " required " +return: " return " +sealed: " sealed " +select: " select " +set: " set " +size of: " sizeof " +static: " static " +string: " string " +struct: " struct " +switch: " switch " +this: " this " +throw: " throw " +true: " true " +try: " try " +type of: " typeof " +unsafe: " unsafe " +using: " using " +value: " value " +var: " var " +virtual: " virtual " +volatile: " volatile " +void: " void " +where: " where " +while: " while " yield: " yield "