Skip to content

Commit 5cdbb07

Browse files
Added Tidy command
1 parent 2dfef48 commit 5cdbb07

6 files changed

+39
-10
lines changed

AutoIt.sublime-settings

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"AutoItEXEPath": "C:\\Program Files\\AutoIt3\\AutoIt3.exe",
3-
// "AutoItEXEPath": "D:\\PortableApps\\AutoIt\\AutoIt3.exe",
2+
"AutoItExePath": "C:\\Program Files\\AutoIt3\\AutoIt3.exe",
3+
"TidyExePath": "C:\\Program Files\\AutoIt3\\SciTE\\Tidy\\Tidy.exe",
44
}

Default.sublime-commands

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
{
3+
"caption": "AutoIt Tidy",
4+
"command": "autoittidy"
5+
}
6+
]

Main.sublime-menu

+10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
[
2+
{
3+
"caption": "Tools",
4+
"mnemonic": "T",
5+
"id": "tools",
6+
"children":
7+
[
8+
{ "caption": "-", "id": "build" },
9+
{ "command": "autoittidy", "caption": "AutoIt Tidy"}
10+
]
11+
},
212
{
313
"caption": "Preferences",
414
"mnemonic": "n",

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
AutoItScript - Syntax Package for Sublime Text 2/3
22
============
33

4-
AutoItScript AU3 language package for SublimeText including syntax highlighting, comments toggling, snippets, and build system.
4+
AutoItScript AU3 language package for SublimeText including syntax highlighting, comments toggling, snippets, build system, and Tidy command.
55

6-
For the build system, you will need to set your specific path to AutoIt3.exe in the file AutoIt.sublime-settings (you can open this file via the Menu Preferences>Package Settings>AutoIt Settings).
6+
For the build system and Tidy command, you will need to set your specific path to AutoIt3.exe and Tidy.exe in the file AutoIt.sublime-settings (you can open this file via the Menu Preferences>Package Settings>AutoIt Settings).
77

88
Credits
99
------------

autoitbuild.py

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
import sublime, sublime_plugin
2+
import subprocess
23

34
# The autoitbuild command is called as target by AutoIt.sublime-build
45
class autoitbuild(sublime_plugin.WindowCommand):
56

67
def run(self):
78
filepath = self.window.active_view().file_name()
8-
ahkpath = sublime.load_settings("AutoIt.sublime-settings").get("AutoItEXEPath")
9-
cmd = [ahkpath, "/ErrorStdOut", filepath]
9+
AutoItExePath = sublime.load_settings("AutoIt.sublime-settings").get("AutoItExePath")
10+
cmd = [AutoItExePath, "/ErrorStdOut", filepath]
1011
self.window.run_command("exec", {"cmd": cmd})
12+
13+
class autoittidy(sublime_plugin.WindowCommand):
14+
15+
def run(self):
16+
self.window.run_command("save")
17+
filepath = self.window.active_view().file_name()
18+
TidyExePath = sublime.load_settings("AutoIt.sublime-settings").get("TidyExePath")
19+
tidycmd = [TidyExePath, filepath]
20+
tidyprocess = subprocess.Popen(tidycmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
21+
tidyoutput = tidyprocess.communicate()[0].rstrip()
22+
self.window.run_command("revert")
23+
sublime.status_message(tidyoutput)

packages.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
"packages": [
44
{
55
"name": "AutoItScript",
6-
"description": "AutoItScript AU3 language package for SublimeText including syntax highlighting, comments toggling, and snippets.",
6+
"description": "AutoItScript AU3 language package for SublimeText including syntax highlighting, comments toggling, snippets, build system, and Tidy command.",
77
"author": "robertcollier4",
88
"homepage": "https://github.com/robertcollier4/AutoItScript",
9-
"last_modified": "2013-06-09 16:00:00",
9+
"last_modified": "2013-06-09 20:00:00",
1010
"platforms": {
1111
"windows": [
1212
{
13-
"version": "1.1.2",
14-
"url": "https://nodeload.github.com/robertcollier4/AutoItScript/zip/1.1.2"
13+
"version": "1.2.0",
14+
"url": "https://nodeload.github.com/robertcollier4/AutoItScript/zip/1.2.0"
1515
}
1616
]
1717
}

0 commit comments

Comments
 (0)