diff --git a/extension.toml b/extension.toml index cbed3a0..85fbb70 100644 --- a/extension.toml +++ b/extension.toml @@ -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" diff --git a/languages/csproj/config.toml b/languages/csproj/config.toml new file mode 100644 index 0000000..502a10c --- /dev/null +++ b/languages/csproj/config.toml @@ -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 \ No newline at end of file diff --git a/languages/csproj/highlights.scm b/languages/csproj/highlights.scm new file mode 100644 index 0000000..c14be81 --- /dev/null +++ b/languages/csproj/highlights.scm @@ -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 + "&" "<" ">" """ "'")) + +(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 \ No newline at end of file diff --git a/languages/csproj/indents.scm b/languages/csproj/indents.scm new file mode 100644 index 0000000..febed05 --- /dev/null +++ b/languages/csproj/indents.scm @@ -0,0 +1,2 @@ +(STag ">" @end) @indent +(EmptyElemTag "/>" @end) @indent \ No newline at end of file diff --git a/languages/csproj/outline.scm b/languages/csproj/outline.scm new file mode 100644 index 0000000..601af71 --- /dev/null +++ b/languages/csproj/outline.scm @@ -0,0 +1,9 @@ +(element + (STag + (Name) @name)) @item + +(EmptyElemTag + (Name) @name) @item + +(doctypedecl + (Name) @name) @item \ No newline at end of file diff --git a/languages/csproj/tasks.json b/languages/csproj/tasks.json new file mode 100644 index 0000000..d436a87 --- /dev/null +++ b/languages/csproj/tasks.json @@ -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" + } +] diff --git a/languages/props/config.toml b/languages/props/config.toml new file mode 100644 index 0000000..9463048 --- /dev/null +++ b/languages/props/config.toml @@ -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 \ No newline at end of file diff --git a/languages/props/highlights.scm b/languages/props/highlights.scm new file mode 100644 index 0000000..c14be81 --- /dev/null +++ b/languages/props/highlights.scm @@ -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 + "&" "<" ">" """ "'")) + +(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 \ No newline at end of file diff --git a/languages/props/indents.scm b/languages/props/indents.scm new file mode 100644 index 0000000..febed05 --- /dev/null +++ b/languages/props/indents.scm @@ -0,0 +1,2 @@ +(STag ">" @end) @indent +(EmptyElemTag "/>" @end) @indent \ No newline at end of file diff --git a/languages/props/outline.scm b/languages/props/outline.scm new file mode 100644 index 0000000..601af71 --- /dev/null +++ b/languages/props/outline.scm @@ -0,0 +1,9 @@ +(element + (STag + (Name) @name)) @item + +(EmptyElemTag + (Name) @name) @item + +(doctypedecl + (Name) @name) @item \ No newline at end of file diff --git a/languages/slnx/config.toml b/languages/slnx/config.toml new file mode 100644 index 0000000..fa3fffd --- /dev/null +++ b/languages/slnx/config.toml @@ -0,0 +1,9 @@ +name = "C# Solution File" +grammar = "xml" +path_suffixes = ["slnx"] +block_comment = [""] +autoclose_before = "<" +brackets = [{ start = "<", end = ">", close = true, newline = true }] +prettier_parser_name = "xml" +prettier_plugins = ["@prettier/plugin-xml"] +hard_tabs = true \ No newline at end of file diff --git a/languages/slnx/highlights.scm b/languages/slnx/highlights.scm new file mode 100644 index 0000000..c14be81 --- /dev/null +++ b/languages/slnx/highlights.scm @@ -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 + "&" "<" ">" """ "'")) + +(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 \ No newline at end of file diff --git a/languages/slnx/indents.scm b/languages/slnx/indents.scm new file mode 100644 index 0000000..febed05 --- /dev/null +++ b/languages/slnx/indents.scm @@ -0,0 +1,2 @@ +(STag ">" @end) @indent +(EmptyElemTag "/>" @end) @indent \ No newline at end of file diff --git a/languages/slnx/outline.scm b/languages/slnx/outline.scm new file mode 100644 index 0000000..601af71 --- /dev/null +++ b/languages/slnx/outline.scm @@ -0,0 +1,9 @@ +(element + (STag + (Name) @name)) @item + +(EmptyElemTag + (Name) @name) @item + +(doctypedecl + (Name) @name) @item \ No newline at end of file diff --git a/languages/slnx/tasks.json b/languages/slnx/tasks.json new file mode 100644 index 0000000..d39c312 --- /dev/null +++ b/languages/slnx/tasks.json @@ -0,0 +1,24 @@ +[ + { + "label": "Restore Current Solution", + "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 Solution", + "command": "dotnet build", + "args": ["$ZED_FILE"], + "use_new_terminal": false, + "allow_concurrent_runs": false, + "reveal": "always", + "reveal_target": "center", + "hide": "on_success", + "shell": "system" + } +] diff --git a/languages/targets/config.toml b/languages/targets/config.toml new file mode 100644 index 0000000..74d176b --- /dev/null +++ b/languages/targets/config.toml @@ -0,0 +1,9 @@ +name = "C# Targets File" +grammar = "xml" +path_suffixes = ["targets"] +block_comment = [""] +autoclose_before = "<" +brackets = [{ start = "<", end = ">", close = true, newline = true }] +prettier_parser_name = "xml" +prettier_plugins = ["@prettier/plugin-xml"] +hard_tabs = true \ No newline at end of file diff --git a/languages/targets/highlights.scm b/languages/targets/highlights.scm new file mode 100644 index 0000000..c14be81 --- /dev/null +++ b/languages/targets/highlights.scm @@ -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 + "&" "<" ">" """ "'")) + +(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 \ No newline at end of file diff --git a/languages/targets/indents.scm b/languages/targets/indents.scm new file mode 100644 index 0000000..febed05 --- /dev/null +++ b/languages/targets/indents.scm @@ -0,0 +1,2 @@ +(STag ">" @end) @indent +(EmptyElemTag "/>" @end) @indent \ No newline at end of file diff --git a/languages/targets/outline.scm b/languages/targets/outline.scm new file mode 100644 index 0000000..601af71 --- /dev/null +++ b/languages/targets/outline.scm @@ -0,0 +1,9 @@ +(element + (STag + (Name) @name)) @item + +(EmptyElemTag + (Name) @name) @item + +(doctypedecl + (Name) @name) @item \ No newline at end of file