Skip to content

Commit

Permalink
Revert "Remove textmate support"
Browse files Browse the repository at this point in the history
This reverts commit ab998a2.
  • Loading branch information
aidenfoxivey committed Aug 10, 2024
1 parent 2030c8f commit 2158b7e
Show file tree
Hide file tree
Showing 14 changed files with 458 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/textmate.yaml
Original file line number Diff line number Diff line change
@@ -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'
33 changes: 33 additions & 0 deletions Commands/Build.YAML-tmCommand
Original file line number Diff line number Diff line change
@@ -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
54 changes: 54 additions & 0 deletions Commands/Build.tmCommand
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>autoScrollOutput</key>
<true/>
<key>beforeRunningCommand</key>
<string>saveModifiedFiles</string>
<key>command</key>
<string>#!/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 =&gt; true) </string>
<key>input</key>
<string>document</string>
<key>inputFormat</key>
<string>text</string>
<key>keyEquivalent</key>
<string>@b</string>
<key>name</key>
<string>Build</string>
<key>outputCaret</key>
<string>afterOutput</string>
<key>outputFormat</key>
<string>html</string>
<key>outputLocation</key>
<string>newWindow</string>
<key>requiredCommands</key>
<array>
<dict>
<key>command</key>
<string>zig</string>
<key>locations</key>
<array>
<string>/opt/local/bin/zig</string>
<string>/usr/local/bin/zig</string>
<string>/usr/local/zig/bin/zig</string>
</array>
<key>variable</key>
<string>TM_ZIG</string>
</dict>
</array>
<key>scope</key>
<string>source.zig</string>
<key>uuid</key>
<string>C9E6A57F-7472-445A-BF41-292C8D5F183C</string>
<key>version</key>
<integer>2</integer>
</dict>
</plist>
25 changes: 25 additions & 0 deletions Commands/Fmt.YAML-tmCommand
Original file line number Diff line number Diff line change
@@ -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
59 changes: 59 additions & 0 deletions Commands/Fmt.tmCommand
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
<string>#!/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
</string>
<key>input</key>
<string>document</string>
<key>inputFormat</key>
<string>text</string>
<key>keyEquivalent</key>
<string></string>
<key>name</key>
<string>Fmt</string>
<key>outputCaret</key>
<string>interpolateByLine</string>
<key>outputFormat</key>
<string>text</string>
<key>outputLocation</key>
<string>replaceDocument</string>
<key>requiredCommands</key>
<array>
<dict>
<key>command</key>
<string>zig</string>
<key>locations</key>
<array>
<string>/opt/local/bin/zig</string>
<string>/usr/local/bin/zig</string>
<string>/usr/local/zig/bin/zig</string>
</array>
<key>variable</key>
<string>TM_ZIG</string>
</dict>
</array>
<key>scope</key>
<string>source.zig</string>
<key>semanticClass</key>
<string>callback.document.will-save</string>
<key>uuid</key>
<string>BC972D6E-23AC-4EAD-AF7D-A33564F09433</string>
<key>version</key>
<integer>2</integer>
</dict>
</plist>
33 changes: 33 additions & 0 deletions Commands/Run.YAML-tmCommand
Original file line number Diff line number Diff line change
@@ -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
54 changes: 54 additions & 0 deletions Commands/Run.tmCommand
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>autoScrollOutput</key>
<true/>
<key>beforeRunningCommand</key>
<string>saveModifiedFiles</string>
<key>command</key>
<string>#!/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 =&gt; true)</string>
<key>input</key>
<string>document</string>
<key>inputFormat</key>
<string>text</string>
<key>keyEquivalent</key>
<string>@r</string>
<key>name</key>
<string>Run</string>
<key>outputCaret</key>
<string>afterOutput</string>
<key>outputFormat</key>
<string>html</string>
<key>outputLocation</key>
<string>newWindow</string>
<key>requiredCommands</key>
<array>
<dict>
<key>command</key>
<string>zig</string>
<key>locations</key>
<array>
<string>/opt/local/bin/zig</string>
<string>/usr/local/bin/zig</string>
<string>/usr/local/zig/bin/zig</string>
</array>
<key>variable</key>
<string>TM_ZIG</string>
</dict>
</array>
<key>scope</key>
<string>source.zig</string>
<key>uuid</key>
<string>0B3C3EB0-9F51-4997-A87D-ECA507D8E31E</string>
<key>version</key>
<integer>2</integer>
</dict>
</plist>
33 changes: 33 additions & 0 deletions Commands/Test.YAML-tmCommand
Original file line number Diff line number Diff line change
@@ -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
54 changes: 54 additions & 0 deletions Commands/Test.tmCommand
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>autoScrollOutput</key>
<true/>
<key>beforeRunningCommand</key>
<string>saveModifiedFiles</string>
<key>command</key>
<string>#!/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 =&gt; true)</string>
<key>input</key>
<string>document</string>
<key>inputFormat</key>
<string>text</string>
<key>keyEquivalent</key>
<string>@R</string>
<key>name</key>
<string>Test</string>
<key>outputCaret</key>
<string>afterOutput</string>
<key>outputFormat</key>
<string>html</string>
<key>outputLocation</key>
<string>newWindow</string>
<key>requiredCommands</key>
<array>
<dict>
<key>command</key>
<string>zig</string>
<key>locations</key>
<array>
<string>/opt/local/bin/zig</string>
<string>/usr/local/bin/zig</string>
<string>/usr/local/zig/bin/zig</string>
</array>
<key>variable</key>
<string>TM_ZIG</string>
</dict>
</array>
<key>scope</key>
<string>source.zig</string>
<key>uuid</key>
<string>C679259A-BAFB-4895-917B-7663645C9B5F</string>
<key>version</key>
<integer>2</integer>
</dict>
</plist>
Loading

0 comments on commit 2158b7e

Please sign in to comment.