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
5 changes: 5 additions & 0 deletions extension.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ language = "CSharp"
[grammars.c_sharp]
repository = "https://github.com/tree-sitter/tree-sitter-c-sharp"
commit = "485f0bae0274ac9114797fc10db6f7034e4086e3"

[grammars.xml]
repository = "https://github.com/tree-sitter-grammars/tree-sitter-xml"
commit = "863dbc381f44f6c136a399e684383b977bb2beaa"
path = "xml"
9 changes: 9 additions & 0 deletions languages/csproj/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name = "C# Project File"
grammar = "xml"
path_suffixes = ["csproj"]
block_comment = ["<!-- ", " -->"]
autoclose_before = "<"
brackets = [{ start = "<", end = ">", close = true, newline = true }]
prettier_parser_name = "xml"
prettier_plugins = ["@prettier/plugin-xml"]
hard_tabs = true
168 changes: 168 additions & 0 deletions languages/csproj/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
;; XML declaration

"xml" @keyword

[ "version" "encoding" "standalone" ] @property

(EncName) @string.special

(VersionNum) @number

[ "yes" "no" ] @boolean

;; Processing instructions

(PI) @embedded

(PI (PITarget) @keyword)

;; Element declaration

(elementdecl
"ELEMENT" @keyword
(Name) @tag)

(contentspec
(_ (Name) @property))

"#PCDATA" @type.builtin

[ "EMPTY" "ANY" ] @string.special.symbol

[ "*" "?" "+" ] @operator

;; Entity declaration

(GEDecl
"ENTITY" @keyword
(Name) @constant)

(GEDecl (EntityValue) @string)

(NDataDecl
"NDATA" @keyword
(Name) @label)

;; Parsed entity declaration

(PEDecl
"ENTITY" @keyword
"%" @operator
(Name) @constant)

(PEDecl (EntityValue) @string)

;; Notation declaration

(NotationDecl
"NOTATION" @keyword
(Name) @constant)

(NotationDecl
(ExternalID
(SystemLiteral (URI) @string.special)))

;; Attlist declaration

(AttlistDecl
"ATTLIST" @keyword
(Name) @tag)

(AttDef (Name) @property)

(AttDef (Enumeration (Nmtoken) @string))

(DefaultDecl (AttValue) @string)

[
(StringType)
(TokenizedType)
] @type.builtin

(NotationType "NOTATION" @type.builtin)

[
"#REQUIRED"
"#IMPLIED"
"#FIXED"
] @attribute

;; Entities

(EntityRef) @constant

((EntityRef) @constant.builtin
(#any-of? @constant.builtin
"&amp;" "&lt;" "&gt;" "&quot;" "&apos;"))

(CharRef) @constant

(PEReference) @constant

;; External references

[ "PUBLIC" "SYSTEM" ] @keyword

(PubidLiteral) @string.special

(SystemLiteral (URI) @markup.link)

;; Processing instructions

(XmlModelPI "xml-model" @keyword)

(StyleSheetPI "xml-stylesheet" @keyword)

(PseudoAtt (Name) @property)

(PseudoAtt (PseudoAttValue) @string)

;; Doctype declaration

(doctypedecl "DOCTYPE" @keyword)

(doctypedecl (Name) @type)

;; Tags

(STag (Name) @tag)

(ETag (Name) @tag)

(EmptyElemTag (Name) @tag)

;; Attributes

(Attribute (Name) @property)

(Attribute (AttValue) @string)

;; Delimiters & punctuation

[
"<?" "?>"
"<!" "]]>"
"<" ">"
"</" "/>"
] @punctuation.delimiter

[ "(" ")" "[" "]" ] @punctuation.bracket

[ "\"" "'" ] @punctuation.delimiter

[ "," "|" "=" ] @operator

;; Text

(CharData) @markup

(CDSect
(CDStart) @markup.heading
(CData) @markup.raw
"]]>" @markup.heading)

;; Misc

(Comment) @comment

(ERROR) @error
2 changes: 2 additions & 0 deletions languages/csproj/indents.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(STag ">" @end) @indent
(EmptyElemTag "/>" @end) @indent
9 changes: 9 additions & 0 deletions languages/csproj/outline.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(element
(STag
(Name) @name)) @item

(EmptyElemTag
(Name) @name) @item

(doctypedecl
(Name) @name) @item
24 changes: 24 additions & 0 deletions languages/csproj/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[
{
"label": "Restore Current Project",
"command": "dotnet restore",
"args": ["$ZED_FILE"],
"use_new_terminal": false,
"allow_concurrent_runs": false,
"reveal": "always",
"reveal_target": "center",
"hide": "on_success",
"shell": "system"
},
{
"label": "Build Current Project",
"command": "dotnet build",
"args": ["$ZED_FILE"],
"use_new_terminal": false,
"allow_concurrent_runs": false,
"reveal": "always",
"reveal_target": "center",
"hide": "on_success",
"shell": "system"
}
]
9 changes: 9 additions & 0 deletions languages/props/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name = "C# Props File"
grammar = "xml"
path_suffixes = ["props"]
block_comment = ["<!-- ", " -->"]
autoclose_before = "<"
brackets = [{ start = "<", end = ">", close = true, newline = true }]
prettier_parser_name = "xml"
prettier_plugins = ["@prettier/plugin-xml"]
hard_tabs = true
Loading