Skip to content

Commit b38cf18

Browse files
committed
Merge branch 'master' into tooltips
2 parents 8396101 + 2c19761 commit b38cf18

38 files changed

+144
-66
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# [PackageDev] target_format: plist, ext: tmPreferences
2+
---
3+
name: TypeScript Indent
4+
uuid: 77966fa8-af34-4f1e-8535-e556d5063853
5+
scope: source.ts
6+
settings:
7+
bracketIndentNextLinePattern:
8+
>
9+
(?x)
10+
^ \s* \b(if|while|else)\b [^;]* $
11+
| ^ \s* \b(for)\b .* $
12+
decreaseIndentPattern: ^(.*\*/)?\s*\}.*$
13+
increaseIndentPattern: ^.*\{[^}"']*$

TypeScript Indent.tmPreferences

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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>name</key>
6+
<string>TypeScript Indent</string>
7+
<key>scope</key>
8+
<string>source.ts</string>
9+
<key>settings</key>
10+
<dict>
11+
<key>bracketIndentNextLinePattern</key>
12+
<string>(?x)
13+
^ \s* \b(if|while|else)\b [^;]* $
14+
| ^ \s* \b(for)\b .* $
15+
</string>
16+
<key>decreaseIndentPattern</key>
17+
<string>^(.*\*/)?\s*\}.*$</string>
18+
<key>increaseIndentPattern</key>
19+
<string>^.*\{[^}"']*$</string>
20+
</dict>
21+
<key>uuid</key>
22+
<string>77966fa8-af34-4f1e-8535-e556d5063853</string>
23+
</dict>
24+
</plist>

TypeScript.py renamed to main.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
import sys
2+
import os
23

3-
# Sublime/Python 2 & 3 differ in the name of this module, thus package import
4-
# needs to be handled slightly differently
54
if sys.version_info < (3, 0):
6-
from libs import *
7-
from libs.reference import *
8-
from libs.view_helpers import *
9-
from listeners import *
10-
from commands import *
5+
from typescript.libs import *
6+
from typescript.libs.reference import *
7+
from typescript.libs.view_helpers import *
8+
from typescript.listeners import *
9+
from typescript.commands import *
1110
else:
12-
from .libs import *
13-
from .libs.reference import *
14-
from .libs.view_helpers import *
15-
from .listeners import *
16-
from .commands import *
11+
from .typescript.libs import *
12+
from .typescript.libs.reference import *
13+
from .typescript.libs.view_helpers import *
14+
from .typescript.listeners import *
15+
from .typescript.commands import *
1716

1817
# Enable Python Tools for visual studio remote debugging
1918
try:

typescript/__init__.py

Whitespace-only changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from ..libs.view_helpers import *
2+
from ..libs import log
23
from .base_command import TypeScriptBaseTextCommand
34

45

@@ -8,6 +9,8 @@ class TypescriptFormatOnKey(TypeScriptBaseTextCommand):
89
in the case of "\n", this is only called when no completion dialogue is visible
910
"""
1011
def run(self, text, key="", insert_key=True):
12+
log.debug("running TypescriptFormatOnKey")
13+
1114
if 0 == len(key):
1215
return
1316
check_update_view(self.view)
@@ -27,19 +30,22 @@ def run(self, text, key="", insert_key=True):
2730
class TypescriptFormatSelection(TypeScriptBaseTextCommand):
2831
"""Command to format the current selection"""
2932
def run(self, text):
33+
log.debug("running TypescriptFormatSelection")
3034
r = self.view.sel()[0]
3135
format_range(text, self.view, r.begin(), r.end())
3236

3337

3438
class TypescriptFormatDocument(TypeScriptBaseTextCommand):
3539
"""Command to format the entire buffer"""
3640
def run(self, text):
41+
log.debug("running TypescriptFormatDocument")
3742
format_range(text, self.view, 0, self.view.size())
3843

3944

4045
class TypescriptFormatLine(TypeScriptBaseTextCommand):
4146
"""Command to format the current line"""
4247
def run(self, text):
48+
log.debug("running TypescriptFormatLine")
4349
line_region = self.view.line(self.view.sel()[0])
4450
line_text = self.view.substr(line_region)
4551
if NON_BLANK_LINE_PATTERN.search(line_text):
@@ -53,6 +59,7 @@ def run(self, text):
5359

5460
class TypescriptFormatBrackets(TypeScriptBaseTextCommand):
5561
def run(self, text):
62+
log.debug("running TypescriptFormatBrackets")
5663
check_update_view(self.view)
5764
sel = self.view.sel()
5865
if len(sel) == 1:
@@ -70,6 +77,7 @@ def run(self, text):
7077

7178
class TypescriptPasteAndFormat(TypeScriptBaseTextCommand):
7279
def run(self, text):
80+
log.debug("running TypescriptPasteAndFormat")
7381
view = self.view
7482
check_update_view(view)
7583
regions_before_paste = regions_to_static_regions(view.sel())
@@ -93,6 +101,7 @@ class TypescriptAutoIndentOnEnterBetweenCurlyBrackets(TypeScriptBaseTextCommand)
93101
"""
94102

95103
def run(self, text):
104+
log.debug("running TypescriptAutoIndentOnEnterBetweenCurlyBrackets")
96105
view = self.view
97106
view.run_command('typescript_format_on_key', {"key": "\n"})
98107
loc = view.sel()[0].begin()

0 commit comments

Comments
 (0)