diff --git a/.github/workflows/textmate.yaml b/.github/workflows/textmate.yaml new file mode 100644 index 0000000..ceeef59 --- /dev/null +++ b/.github/workflows/textmate.yaml @@ -0,0 +1,36 @@ +name: textmate +on: push +jobs: + test: + runs-on: macos-latest + steps: + - name: Install dependencies + run: | + brew install --cask textmate + brew install coreutils zig + - name: Textmate load success + run: | + # "install" bundle + mkdir -p "$HOME/Library/Application Support/TextMate/Bundles/" + ln -s "$PWD" "$HOME/Library/Application Support/TextMate/Bundles/Zig.tmbundle" + + # run TextMate, capture output + /Applications/TextMate.app/Contents/MacOS/TextMate | tee textmate.out & + + # don't expect the bundle to be mentioned in output as that would indicate an error + ! grep Zig.tmbundle textmate.out + + # open a sample source + mate hello.zig + + # use Build command via keyboard shortcut + osascript -e 'activate application "TextMate"' -e 'tell application "System Events" to keystroke "b" using command down' + + # wait for binary to be built + gtimeout 30 /bin/sh -c 'while ! ls hello 2>/dev/null; do sleep 1; done' + ./hello + + # debugging + # screencapture test.png; cat test.png | base64 + + osascript -e 'tell application "TextMate" to quit' diff --git a/Commands/Build.YAML-tmCommand b/Commands/Build.YAML-tmCommand new file mode 100644 index 0000000..6f70160 --- /dev/null +++ b/Commands/Build.YAML-tmCommand @@ -0,0 +1,33 @@ +autoScrollOutput: true +beforeRunningCommand: saveModifiedFiles +command: '#!/usr/bin/env ruby18 + + require ENV["TM_SUPPORT_PATH"] + "/lib/tm/executor" + + require ENV["TM_SUPPORT_PATH"] + "/lib/tm/save_current_document" + + + TextMate.save_if_untitled(''zig'') + + TextMate::Executor.make_project_master_current_document + + + TextMate::Executor.run(ENV["TM_ZIG"] || "zig", "build-exe", ENV["TM_FILEPATH"], + :create_error_pipe => true) ' +input: document +inputFormat: text +keyEquivalent: '@b' +name: Build +outputCaret: afterOutput +outputFormat: html +outputLocation: newWindow +requiredCommands: +- command: zig + locations: + - /opt/local/bin/zig + - /usr/local/bin/zig + - /usr/local/zig/bin/zig + variable: TM_ZIG +scope: source.zig +uuid: C9E6A57F-7472-445A-BF41-292C8D5F183C +version: 2 diff --git a/Commands/Build.tmCommand b/Commands/Build.tmCommand new file mode 100644 index 0000000..f76958d --- /dev/null +++ b/Commands/Build.tmCommand @@ -0,0 +1,54 @@ + + + + + autoScrollOutput + + beforeRunningCommand + saveModifiedFiles + command + #!/usr/bin/env ruby18 +require ENV["TM_SUPPORT_PATH"] + "/lib/tm/executor" +require ENV["TM_SUPPORT_PATH"] + "/lib/tm/save_current_document" + +TextMate.save_if_untitled('zig') +TextMate::Executor.make_project_master_current_document + +TextMate::Executor.run(ENV["TM_ZIG"] || "zig", "build-exe", ENV["TM_FILEPATH"], :create_error_pipe => true) + input + document + inputFormat + text + keyEquivalent + @b + name + Build + outputCaret + afterOutput + outputFormat + html + outputLocation + newWindow + requiredCommands + + + command + zig + locations + + /opt/local/bin/zig + /usr/local/bin/zig + /usr/local/zig/bin/zig + + variable + TM_ZIG + + + scope + source.zig + uuid + C9E6A57F-7472-445A-BF41-292C8D5F183C + version + 2 + + diff --git a/Commands/Fmt.YAML-tmCommand b/Commands/Fmt.YAML-tmCommand new file mode 100644 index 0000000..3bdedba --- /dev/null +++ b/Commands/Fmt.YAML-tmCommand @@ -0,0 +1,25 @@ +beforeRunningCommand: nop +command: "#!/usr/bin/env bash\n\n# shellcheck source=/dev/null\n. \"${TM_SUPPORT_PATH}/lib/bash_init.sh\"\ + \n\nset -e \n\nPATH=/opt/local/bin:/usr/local/bin:/usr/local/zig/bin:$PATH\n \ + \ \nrequire_cmd zig\n\ntmpfile=$(mktemp \"${TMPDIR:-/tmp/}zig-fmt.XXXXXX\")\n\ + cat - > \"$tmpfile\"\n\nif ! error=$(\"${TM_ZIG:-zig}\" fmt \"$tmpfile\" 2>&1);then\n\ + \ exit_show_tool_tip \"${error//$tmpfile/$(basename \"$TM_FILEPATH\")}\"\nfi\n\ + \ncat \"$tmpfile\"\nrm \"$tmpfile\"\n" +input: document +inputFormat: text +keyEquivalent: '' +name: Fmt +outputCaret: interpolateByLine +outputFormat: text +outputLocation: replaceDocument +requiredCommands: +- command: zig + locations: + - /opt/local/bin/zig + - /usr/local/bin/zig + - /usr/local/zig/bin/zig + variable: TM_ZIG +scope: source.zig +semanticClass: callback.document.will-save +uuid: BC972D6E-23AC-4EAD-AF7D-A33564F09433 +version: 2 diff --git a/Commands/Fmt.tmCommand b/Commands/Fmt.tmCommand new file mode 100644 index 0000000..7379c6f --- /dev/null +++ b/Commands/Fmt.tmCommand @@ -0,0 +1,59 @@ + + + + + beforeRunningCommand + nop + command + #!/usr/bin/env bash + +# shellcheck source=/dev/null +. "${TM_SUPPORT_PATH}/lib/bash_init.sh" + +set -e + +PATH=/opt/local/bin:/usr/local/bin:/usr/local/zig/bin:$PATH + +require_cmd "${TM_ZIG:-zig}" + +(eval "${TM_ZIG:-zig} fmt --stdin") || exit_show_tool_tip + + input + document + inputFormat + text + keyEquivalent + + name + Fmt + outputCaret + interpolateByLine + outputFormat + text + outputLocation + replaceDocument + requiredCommands + + + command + zig + locations + + /opt/local/bin/zig + /usr/local/bin/zig + /usr/local/zig/bin/zig + + variable + TM_ZIG + + + scope + source.zig + semanticClass + callback.document.will-save + uuid + BC972D6E-23AC-4EAD-AF7D-A33564F09433 + version + 2 + + diff --git a/Commands/Run.YAML-tmCommand b/Commands/Run.YAML-tmCommand new file mode 100644 index 0000000..8c28092 --- /dev/null +++ b/Commands/Run.YAML-tmCommand @@ -0,0 +1,33 @@ +autoScrollOutput: true +beforeRunningCommand: saveModifiedFiles +command: '#!/usr/bin/env ruby18 + + require ENV["TM_SUPPORT_PATH"] + "/lib/tm/executor" + + require ENV["TM_SUPPORT_PATH"] + "/lib/tm/save_current_document" + + + TextMate.save_if_untitled(''zig'') + + TextMate::Executor.make_project_master_current_document + + + TextMate::Executor.run(ENV["TM_ZIG"] || "zig", "run", ENV["TM_FILEPATH"], :create_error_pipe + => true)' +input: document +inputFormat: text +keyEquivalent: '@r' +name: Run +outputCaret: afterOutput +outputFormat: html +outputLocation: newWindow +requiredCommands: +- command: zig + locations: + - /opt/local/bin/zig + - /usr/local/bin/zig + - /usr/local/zig/bin/zig + variable: TM_ZIG +scope: source.zig +uuid: 0B3C3EB0-9F51-4997-A87D-ECA507D8E31E +version: 2 diff --git a/Commands/Run.tmCommand b/Commands/Run.tmCommand new file mode 100644 index 0000000..5a60cbd --- /dev/null +++ b/Commands/Run.tmCommand @@ -0,0 +1,54 @@ + + + + + autoScrollOutput + + beforeRunningCommand + saveModifiedFiles + command + #!/usr/bin/env ruby18 +require ENV["TM_SUPPORT_PATH"] + "/lib/tm/executor" +require ENV["TM_SUPPORT_PATH"] + "/lib/tm/save_current_document" + +TextMate.save_if_untitled('zig') +TextMate::Executor.make_project_master_current_document + +TextMate::Executor.run(ENV["TM_ZIG"] || "zig", "run", ENV["TM_FILEPATH"], :create_error_pipe => true) + input + document + inputFormat + text + keyEquivalent + @r + name + Run + outputCaret + afterOutput + outputFormat + html + outputLocation + newWindow + requiredCommands + + + command + zig + locations + + /opt/local/bin/zig + /usr/local/bin/zig + /usr/local/zig/bin/zig + + variable + TM_ZIG + + + scope + source.zig + uuid + 0B3C3EB0-9F51-4997-A87D-ECA507D8E31E + version + 2 + + diff --git a/Commands/Test.YAML-tmCommand b/Commands/Test.YAML-tmCommand new file mode 100644 index 0000000..03bfc23 --- /dev/null +++ b/Commands/Test.YAML-tmCommand @@ -0,0 +1,33 @@ +autoScrollOutput: true +beforeRunningCommand: saveModifiedFiles +command: '#!/usr/bin/env ruby18 + + require ENV["TM_SUPPORT_PATH"] + "/lib/tm/executor" + + require ENV["TM_SUPPORT_PATH"] + "/lib/tm/save_current_document" + + + TextMate.save_if_untitled(''zig'') + + TextMate::Executor.make_project_master_current_document + + + TextMate::Executor.run(ENV["TM_ZIG"] || "zig", "test", ENV["TM_FILEPATH"], :create_error_pipe + => true)' +input: document +inputFormat: text +keyEquivalent: '@R' +name: Test +outputCaret: afterOutput +outputFormat: html +outputLocation: newWindow +requiredCommands: +- command: zig + locations: + - /opt/local/bin/zig + - /usr/local/bin/zig + - /usr/local/zig/bin/zig + variable: TM_ZIG +scope: source.zig +uuid: C679259A-BAFB-4895-917B-7663645C9B5F +version: 2 diff --git a/Commands/Test.tmCommand b/Commands/Test.tmCommand new file mode 100644 index 0000000..9e645e6 --- /dev/null +++ b/Commands/Test.tmCommand @@ -0,0 +1,54 @@ + + + + + autoScrollOutput + + beforeRunningCommand + saveModifiedFiles + command + #!/usr/bin/env ruby18 +require ENV["TM_SUPPORT_PATH"] + "/lib/tm/executor" +require ENV["TM_SUPPORT_PATH"] + "/lib/tm/save_current_document" + +TextMate.save_if_untitled('zig') +TextMate::Executor.make_project_master_current_document + +TextMate::Executor.run(ENV["TM_ZIG"] || "zig", "test", ENV["TM_FILEPATH"], :create_error_pipe => true) + input + document + inputFormat + text + keyEquivalent + @R + name + Test + outputCaret + afterOutput + outputFormat + html + outputLocation + newWindow + requiredCommands + + + command + zig + locations + + /opt/local/bin/zig + /usr/local/bin/zig + /usr/local/zig/bin/zig + + variable + TM_ZIG + + + scope + source.zig + uuid + C679259A-BAFB-4895-917B-7663645C9B5F + version + 2 + + diff --git a/Preferences/Comments.tmPreferences b/Preferences/Comments.tmPreferences new file mode 100644 index 0000000..0235b8f --- /dev/null +++ b/Preferences/Comments.tmPreferences @@ -0,0 +1,24 @@ + + + + + name + Zig + scope + source.zig + settings + + shellVariables + + + name + TM_COMMENT_START + value + // + + + + uuid + BAB3200A-F546-4902-AC4B-A6D545F6AA07 + + diff --git a/Support/Comments.YAML-tmPreferences b/Support/Comments.YAML-tmPreferences new file mode 100644 index 0000000..7c0cca4 --- /dev/null +++ b/Support/Comments.YAML-tmPreferences @@ -0,0 +1,8 @@ +# [PackageDev] target_format: plist, ext: tmPreferences +name: Zig +uuid: 06C2FF99-3080-441A-9019-460C51E93116 +scope: source.zig +settings: + shellVariables: + - name: TM_COMMENT_START + value: '// ' diff --git a/Support/Comments.tmPreferences b/Support/Comments.tmPreferences new file mode 100644 index 0000000..0235b8f --- /dev/null +++ b/Support/Comments.tmPreferences @@ -0,0 +1,24 @@ + + + + + name + Zig + scope + source.zig + settings + + shellVariables + + + name + TM_COMMENT_START + value + // + + + + uuid + BAB3200A-F546-4902-AC4B-A6D545F6AA07 + + diff --git a/info.plist b/info.plist new file mode 100644 index 0000000..89aee49 --- /dev/null +++ b/info.plist @@ -0,0 +1,16 @@ + + + + + contactEmailRot13 + tvguho@vwbuna.ay + contactName + Johan Bloemberg + description + TextMate Bundle for Zig language. + name + Zig + uuid + 404AD533-0AD5-438C-96C3-D0B66AF853F6 + + diff --git a/info.yaml b/info.yaml new file mode 100644 index 0000000..c120e18 --- /dev/null +++ b/info.yaml @@ -0,0 +1,5 @@ +contactEmailRot13: tvguho@vwbuna.ay +contactName: Johan Bloemberg +description: TextMate Bundle for Zig language. +name: Zig +uuid: 404AD533-0AD5-438C-96C3-D0B66AF853F6