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
34 changes: 31 additions & 3 deletions lang/csharp/code_common_function.talon-list
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Comment on lines +7 to +8

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually use user.code_common_method for methods.

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"
90 changes: 90 additions & 0 deletions lang/csharp/code_keyword.talon-list
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
list: user.code_keyword
code.language: csharp
code.language: aspnetcorerazor

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can code.language get set to this if we do not have the language defined in Community? Can you check if this triggers with help scope? code.language is under Misc if a language is detected.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the community backlog session — we are aware that this is in another PR. Consider removing code.language: aspnetcorerazor until we have a decision on that PR.

-

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 "
Comment on lines +6 to +90

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the community backlog session — our general pattern is not to include leading spaces in user.code_keyword (operators like "and" and "or" are rare exceptions). Only include trailing spaces where there is always expected to be something after it (not including punctuation like commas or semicolons).

7 changes: 6 additions & 1 deletion lang/csharp/csharp.py
Original file line number Diff line number Diff line change
@@ -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")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not be redefining these lists on a module.

mod.list("code_keyword", desc="Common C# keywords")

operators = Operators(
# code_operators_array
SUBSCRIPT=create_described_insert_between("[", "]"),
Expand Down
1 change: 1 addition & 0 deletions lang/csharp/csharp.talon
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down