diff --git a/extension.toml b/extension.toml index c893035..ae95eeb 100644 --- a/extension.toml +++ b/extension.toml @@ -24,3 +24,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 120000 index 0000000..2554c9f --- /dev/null +++ b/languages/csproj/highlights.scm @@ -0,0 +1 @@ +../msbuild/highlights.scm \ No newline at end of file diff --git a/languages/csproj/indents.scm b/languages/csproj/indents.scm new file mode 120000 index 0000000..31137cb --- /dev/null +++ b/languages/csproj/indents.scm @@ -0,0 +1 @@ +../msbuild/indents.scm \ No newline at end of file diff --git a/languages/csproj/outline.scm b/languages/csproj/outline.scm new file mode 120000 index 0000000..4a435ef --- /dev/null +++ b/languages/csproj/outline.scm @@ -0,0 +1 @@ +../msbuild/outline.scm \ 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/msbuild/config.toml b/languages/msbuild/config.toml new file mode 100644 index 0000000..dd8d49b --- /dev/null +++ b/languages/msbuild/config.toml @@ -0,0 +1,9 @@ +name = "MSBuild File" +grammar = "xml" +path_suffixes = ["proj", "props", "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/msbuild/highlights.scm b/languages/msbuild/highlights.scm new file mode 100644 index 0000000..eb54327 --- /dev/null +++ b/languages/msbuild/highlights.scm @@ -0,0 +1,206 @@ +; 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 diff --git a/languages/msbuild/indents.scm b/languages/msbuild/indents.scm new file mode 100644 index 0000000..d249677 --- /dev/null +++ b/languages/msbuild/indents.scm @@ -0,0 +1,5 @@ +(STag + ">" @end) @indent + +(EmptyElemTag + "/>" @end) @indent diff --git a/languages/msbuild/outline.scm b/languages/msbuild/outline.scm new file mode 100644 index 0000000..f5ab0bd --- /dev/null +++ b/languages/msbuild/outline.scm @@ -0,0 +1,9 @@ +(element + (STag + (Name) @name)) @item + +(EmptyElemTag + (Name) @name) @item + +(doctypedecl + (Name) @name) @item 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 120000 index 0000000..2554c9f --- /dev/null +++ b/languages/slnx/highlights.scm @@ -0,0 +1 @@ +../msbuild/highlights.scm \ No newline at end of file diff --git a/languages/slnx/indents.scm b/languages/slnx/indents.scm new file mode 120000 index 0000000..31137cb --- /dev/null +++ b/languages/slnx/indents.scm @@ -0,0 +1 @@ +../msbuild/indents.scm \ No newline at end of file diff --git a/languages/slnx/outline.scm b/languages/slnx/outline.scm new file mode 120000 index 0000000..4a435ef --- /dev/null +++ b/languages/slnx/outline.scm @@ -0,0 +1 @@ +../msbuild/outline.scm \ 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" + } +]