Skip to content

Commit 37093c0

Browse files
Initial commit
0 parents  commit 37093c0

6 files changed

+52
-0
lines changed

Default (OSX).sublime-keymap

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
{
3+
"keys": ["ctrl+shift+g"],
4+
"command": "google_java_format"
5+
}
6+
]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Ankit Shubham
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Package Control.sublime-settings

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"bootstrapped": true,
3+
"downloader_precedence":
4+
{
5+
"osx":
6+
[
7+
"curl"
8+
]
9+
},
10+
"in_process_packages":
11+
[
12+
]
13+
}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# google-java-format-sublime
2+
A sublime plugin for formatting java code files with google-java-format
Binary file not shown.

google-java-format-sublime.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import sublime, sublime_plugin
2+
import subprocess
3+
import sys
4+
5+
class GoogleJavaFormatCommand(sublime_plugin.TextCommand):
6+
def run(self, edit):
7+
p = subprocess.Popen(['java', '-jar', './artifacts/google-java-format-1.8-SNAPSHOT-all-deps.jar', '-i', str(self.view.file_name())], stdout=subprocess.PIPE, stderr=None, stdin=None)
8+
stdout, stderr = p.communicate()
9+
if p.returncode != 0:
10+
sys.exit(p.returncode);

0 commit comments

Comments
 (0)