Skip to content

Commit 90d3d2d

Browse files
committed
v.1.0.3 syntax recursion error fix, users autocompletions
1 parent e106422 commit 90d3d2d

File tree

5 files changed

+50
-25
lines changed

5 files changed

+50
-25
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ Example:
6767
}
6868
```
6969

70+
## Hints
71+
For auto-completions show, add option to syntax specific settings (markdown):
72+
73+
```
74+
"auto_complete_triggers": [ {"selector": "text.html.markdown", "characters": "#!@"} ]
75+
```
7076

7177
## External dependencies
7278
* [Python Gitlab](http://python-gitlab.readthedocs.io/en/stable/index.html)

StGitlab.sublime-syntax

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,37 @@ contexts:
1010
- include: block_meta
1111
- include: inline
1212

13-
# block_markdown2:
14-
# - match: ^(─{3,})$
15-
# captures:
16-
# 1: comment.1.tag.stgitlab
17-
# push:
18-
# - meta_include_prototype: false
19-
# - meta_content_scope: meta.environment.embedded.text.html.markdown.gfm.stgitlab text.html.markdown.gfm.embedded
20-
# - match: (\1)
21-
# pop: true
22-
# - include: scope:text.html.markdown.gfm
23-
13+
# After Build 3153
14+
# https://forum.sublimetext.com/t/dev-build-3153/33014/8
15+
# https://github.com/sublimehq/Packages/commit/72bd6bdae9e185d9ebedab9679a55cd8ae8c3e60
2416
block_markdown:
2517
- match: (^┌─{3,}$)
2618
captures:
2719
1: markup.other.special.gitlab
28-
push: Packages/MarkdownEditing/Markdown.sublime-syntax
29-
with_prototype:
30-
- match: (?=^└─{3,}\n)
31-
captures:
32-
1: markup.other.special.gitlab
33-
pop: true
20+
# embed: Packages/MarkdownEditing/Markdown.sublime-syntax
21+
embed: scope:text.html.markdown.gfm
22+
embed_scope: text.html.markdown.gfm.embedded.gitlab
23+
escape: (?=^└─{3,}$)
3424
- match: (^└─{3,}$)
3525
captures:
3626
1: markup.other.special.gitlab
3727

28+
# Before build 3153
29+
# Apparent recursion within a with_prototype action: 25000 context sanity limit hit
30+
# block_markdown:
31+
# - match: (^┌─{3,}$)
32+
# captures:
33+
# 1: markup.other.special.gitlab
34+
# push: Packages/MarkdownEditing/Markdown.sublime-syntax
35+
# with_prototype:
36+
# - match: (?=^└─{3,}\n)
37+
# captures:
38+
# 1: markup.other.special.gitlab
39+
# pop: true
40+
# - match: (^└─{3,}$)
41+
# captures:
42+
# 1: markup.other.special.gitlab
43+
3844
block_meta:
3945
- match: (^═+$)
4046
captures:

messages.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"install": "messages/install.txt",
33
"1.0.1": "messages/1.0.1.txt",
4-
"1.0.2": "messages/1.0.2.txt"
4+
"1.0.2": "messages/1.0.2.txt",
5+
"1.0.3": "messages/1.0.3.txt"
56
}

messages/1.0.3.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
StGitlab 1.0.3 changelog:
2+
3+
* Fixed: StGitlab syntax compatibility with ST builds after 3153
4+
* Fixed: Users list in completions
5+
* Fixed: Users completions fires

stgitlab.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,11 @@ def on_activated_async(self):
191191
def on_query_completions(self, prefix, locations):
192192
if self.view.settings().get('screen') == 'st_gitlab_editbox':
193193
gitlab = utils.gl.get()
194-
pattern_issue = re.compile(r'(^|.*\s)(\#)(\d+)?')
195194
completions = []
196195
cursor_position = locations[0]
197-
chars_before = self.view.substr(sublime.Region(cursor_position - 10, cursor_position))
196+
chars_before = self.view.substr(sublime.Region(cursor_position - 2, cursor_position))
197+
198+
pattern_issue = re.compile(r'(^|\s)(\#)(\d+)?')
198199
m = pattern_issue.match(chars_before)
199200
if m and m.group(2):
200201
issues = gitlab.issues()
@@ -205,7 +206,7 @@ def on_query_completions(self, prefix, locations):
205206
if completions:
206207
return completions
207208

208-
pattern_merge = re.compile(r'(^|.*\s)(\!)(\d+)?')
209+
pattern_merge = re.compile(r'(^|\s)(\!)(\d+)?')
209210
m = pattern_merge.match(chars_before)
210211
if m and m.group(2):
211212
merges = gitlab.merges()
@@ -216,14 +217,20 @@ def on_query_completions(self, prefix, locations):
216217
if completions:
217218
return completions
218219

219-
pattern_user = re.compile(r'(^|.*\s)(\@)(\d+)?')
220+
pattern_user = re.compile(r'(^|\s)(\@)(\w+)?')
220221
m = pattern_user.match(chars_before)
221222
if m and m.group(2):
222-
users = gitlab.users()
223+
users_group_filter = utils.stg_get_setting('users_group_filter', [])
224+
if users_group_filter:
225+
users = utils.users_filtered(users_group_filter)
226+
else:
227+
users = utils.users_all()
228+
# users = gitlab.users()
223229
for user in users:
224-
if m.group(3) and not user.name.startswith(m.group(3)):
230+
print(user.username)
231+
if m.group(3) and not user.username.lower().startswith(m.group(3).lower()):
225232
continue
226-
completions.append(('%s\tGitlab user' % user.name, user.name))
233+
completions.append(('%s - %s\tGitlab user' % (user.username, user.name), user.username))
227234
if completions:
228235
return completions
229236

0 commit comments

Comments
 (0)