Skip to content

Commit 0e532bb

Browse files
committed
Add Help command
This details how to setup the `TM_PYCHECKER` variable for syntax checking. Based on a pull request from @evildmp
1 parent b697d2c commit 0e532bb

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

Commands/Help.tmCommand

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>beforeRunningCommand</key>
6+
<string>nop</string>
7+
<key>command</key>
8+
<string>#!/bin/bash
9+
[[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] &amp;&amp; . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
10+
11+
. "$TM_SUPPORT_PATH/lib/webpreview.sh"
12+
html_header "Python Bundle Help" "Python"
13+
14+
Markdown.pl &lt;&lt;'EOF'
15+
16+
## Integrating a Python checker
17+
18+
Python includes a rudimentary syntax checker but this can be improved by installing a secondary checker. Start by installing your checker in the usual way; for Pylint, for example:
19+
20+
pip install pylint
21+
22+
In *Preferences*, select the *Variables* tab. If a `TM_PYCHECKER` variable is not already listed,
23+
add it, with the appropriate value (one of `pylint`, `pychecker`, `pyflakes`, `pep8`,
24+
`flake8`).
25+
26+
The default keyboard shortcut to run the syntax checker is *Control-Shift-V* - open a `.py` file
27+
in TextMate, and try it.
28+
29+
You should see the output in a new window (this example uses Pylint):
30+
31+
PyCheckMate 1.2 – Pylint 1.4.4
32+
33+
No config file found, using default configuration
34+
35+
Then all is well, and most likely the checker will have expressed some opinions about your Python
36+
code (or will exit with `0` if your code already conforms to its expectations).
37+
38+
If you receive a message:
39+
40+
Please install PyChecker, PyFlakes, Pylint, PEP 8 or flake8
41+
for more extensive code checking.
42+
43+
That means that no checker wasn't found, which is likely an issue with command paths. Check where your checker program has been installed, using `which`, for example:
44+
45+
$ which pylint
46+
/usr/local/bin/pylint
47+
48+
The output given is the location of your checker, change the value of `TM_PYCHECKER` in preferences to the complete path and run the command again.
49+
EOF
50+
51+
html_footer</string>
52+
<key>input</key>
53+
<string>none</string>
54+
<key>inputFormat</key>
55+
<string>text</string>
56+
<key>name</key>
57+
<string>Help</string>
58+
<key>outputCaret</key>
59+
<string>afterOutput</string>
60+
<key>outputFormat</key>
61+
<string>html</string>
62+
<key>outputLocation</key>
63+
<string>newWindow</string>
64+
<key>scope</key>
65+
<string>source.python</string>
66+
<key>uuid</key>
67+
<string>7D408009-B629-4DB7-84E4-EA8EAF24FDA9</string>
68+
<key>version</key>
69+
<integer>2</integer>
70+
</dict>
71+
</plist>

info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
<string>443BBF21-6124-4486-BFCA-D18606465885</string>
4646
<string>86BCD309-37C2-4978-B332-EC91AEF70340</string>
4747
<string>3AFD7429-7123-4ADD-B3CC-A9F112F8643B</string>
48+
<string>------------------------------------</string>
49+
<string>7D408009-B629-4DB7-84E4-EA8EAF24FDA9</string>
4850
</array>
4951
<key>submenus</key>
5052
<dict>

0 commit comments

Comments
 (0)