Skip to content

Commit

Permalink
release 2.8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
xjsender committed Apr 9, 2015
1 parent f9ddd5f commit cfe0bd1
Show file tree
Hide file tree
Showing 12 changed files with 216 additions and 140 deletions.
6 changes: 0 additions & 6 deletions .travis.yml

This file was deleted.

15 changes: 15 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ Release History
---------------


Release 2.8.4 (2015-04-09)
++++++++++++++++++
* Add error popup display for latest version of sublime
* Add a new settings ``disable_html_completion`` to disable html completion
* Set default value of ``disable_html_completion`` as true because of conflict with sublime
* Optimize component attribute completion to support current line and next line
* Fix Bug: Wrong completion for Picklist2 when ``if (acc.Picklist1 == 'abc' && acc.Picklist2 == 'bcd')``
* Fix Bug: Plugin found the wrong variable type in the commented code for variable completion
* Ignore exception when keep package.xml for every deploy action
* Rename Heroku to Haoku in the ``Main Menu > Utilities``
* Remove useless ``.travis.yml``
* Remove ugly code for check whether statement is comment for code
* Update ``execute_soql`` command to execute query in heroku


Release 2.8.3 (2015-04-02)
++++++++++++++++++
* If no CRUD privilege on profile object, just leave blank in the output csv
Expand Down
104 changes: 77 additions & 27 deletions completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,21 @@ def on_query_completions(self, view, prefix, locations):
elif ch == "=":
if not settings["disable_picklist_value_completion"]:
# Get the begin point of current line
begin = view.full_line(pt).begin()
cursor_row, cursor_col = view.rowcol(pt)

# Get all matched regions
matched_regions = view.find_all("([a-zA-Z_1-9]+\\.[a-zA-Z_1-9]+)")

# Get the nearest matched region from start to end
# for example, matched regions by above pattern are :
# [(4, 24), (28, 57), (76, 96), (100, 129)]
# the second one has the same row with cursor point
matched_region = None
for mr in matched_regions:
row, col = view.rowcol(mr.begin())
if cursor_row == row:
matched_region = mr

# Get Sobject Variable Name and Field Name
matched_region = view.find("[a-zA-Z_1-9]+\\.[a-zA-Z_1-9]+", begin)
if not matched_region: return []
variable_name, field_name = view.substr(matched_region).split(".")

Expand Down Expand Up @@ -415,14 +426,26 @@ def on_query_completions(self, view, prefix, locations):

elif ch == " ":
# Get the begin point of current line
full_line_region = view.full_line(pt)
full_line_begin = full_line_region.begin()
cursor_row, cursor_col = view.rowcol(pt)

# Get all matched regions
matched_regions = view.find_all("<\\w+:\\w+")

# Get the nearest matched region from start to end
# for example, matched regions by above pattern are :
# [(4, 24), (28, 57), (76, 96), (100, 129)]
# the cursor point is int the next or same row
# with the second one, so that one is the exact one
matched_region = None
for mr in matched_regions:
row, col = view.rowcol(mr.begin())
if cursor_row == row or cursor_row == row + 1:
matched_region = mr

##########################################
# Visualforce Attribute Completions
##########################################
matched_region = view.find("<\\w+:\\w+", full_line_begin)
if matched_region and full_line_region.contains(matched_region):
if matched_region:
matched_tag = view.substr(matched_region)[1:]

# Combine the attr of matched visualforce tag
Expand All @@ -440,28 +463,53 @@ def on_query_completions(self, view, prefix, locations):
##########################################
# Custom Component Attribute Completions
##########################################
matched_region = view.find("<c:\\w+", full_line_begin)
if matched_region and full_line_region.contains(matched_region):
# Get all matched regions
matched_regions = view.find_all("<c:\\w+")

# Get the nearest matched region from start to end
# for example, matched regions by above pattern are :
# [(4, 24), (28, 57), (76, 96), (100, 129)]
# the cursor point is int the next or same row
# with the second one, so that one is the exact one
matched_region = None
for mr in matched_regions:
row, col = view.rowcol(mr.begin())
if cursor_row == row or cursor_row == row + 1:
matched_region = mr

if matched_region:
matched_tag = view.substr(matched_region)[1:]
component_name = matched_tag.split(":")[1].strip()


##########################################
# HTML Element Attribute Completions
##########################################
matched_region = view.find("<\\w+\\s+", full_line_begin)

# If matched region is found and matched block contains cursor point
if matched_region and full_line_region.contains(matched_region):
completion_list = []
matched_tag = view.substr(matched_region)[1:].strip()
if matched_tag in html.HTML_ELEMENTS_ATTRIBUTES:
def_entry = html.HTML_ELEMENTS_ATTRIBUTES[matched_tag]
for attr_name in sorted(def_entry):
if attr_name in html.HTML_ATTRIBUTES_VALUES and html.HTML_ATTRIBUTES_VALUES[attr_name]:
completion_list.append((attr_name + "\tattr", attr_name))
else:
completion_list.append((attr_name + "\tattr", attr_name+'="$1"$0'))
if not settings["disable_html_completion"]:
# Get all matched regions
matched_regions = view.find_all("<\\w+\\s+")

# Get the nearest matched region from start to end
# for example, matched regions by above pattern are :
# [(4, 24), (28, 57), (76, 96), (100, 129)]
# the cursor point is int the next or same row
# with the second one, so that one is the exact one
matched_region = None
for mr in matched_regions:
row, col = view.rowcol(mr.begin())
if cursor_row == row or cursor_row == row + 1:
matched_region = mr

# If matched region is found and matched block contains cursor point
if matched_region:
completion_list = []
matched_tag = view.substr(matched_region)[1:].strip()
if matched_tag in html.HTML_ELEMENTS_ATTRIBUTES:
def_entry = html.HTML_ELEMENTS_ATTRIBUTES[matched_tag]
for attr_name in sorted(def_entry):
if attr_name in html.HTML_ATTRIBUTES_VALUES and html.HTML_ATTRIBUTES_VALUES[attr_name]:
completion_list.append((attr_name + "\tattr", attr_name))
else:
completion_list.append((attr_name + "\tattr", attr_name+'="$1"$0'))

# Sort the completion_list by first element
completion_list.sort(key=lambda tup:tup[1])
Expand Down Expand Up @@ -489,10 +537,12 @@ def on_query_completions(self, view, prefix, locations):
##########################################
# HTML Element Attribute Values Completions
##########################################
matched_attr_name = view.substr(view.word(pt-1))
if matched_attr_name in html.HTML_ATTRIBUTES_VALUES:
for attr_value in html.HTML_ATTRIBUTES_VALUES[matched_attr_name]:
completion_list.append((attr_value + "\t" + matched_attr_name, '"%s"' % attr_value))
if not settings["disable_html_completion"]:
matched_attr_name = view.substr(view.word(pt-1))
if matched_attr_name in html.HTML_ATTRIBUTES_VALUES:
for attr_value in html.HTML_ATTRIBUTES_VALUES[matched_attr_name]:
completion_list.append((attr_value + "\t" +
matched_attr_name, '"%s"' % attr_value))

# Sort the completion_list by first element
completion_list.sort(key=lambda tup:tup[1])
Expand Down
15 changes: 12 additions & 3 deletions config/menus/Main.sublime-menu
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,18 @@
"caption": "Utilities",
"children": [
{
"id": "heorku",
"caption": "Heroku",
"command": "heroku"
"caption": "Haoku Query",
"command": "haoku",
"args": {
"router": "query"
}
},
{
"caption": "Haoku Rest",
"command": "haoku",
"args": {
"router": "rest"
}
},
{
"id": "convert15idto18id",
Expand Down
20 changes: 20 additions & 0 deletions config/messages/2.8.4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Build 2.8.4
-----------
Release Date: 9 Apr 2015

* Add error popup display for latest version of sublime
* Add a new settings ``disable_html_completion`` to disable html completion
* Set default value of ``disable_html_completion`` as true because of conflict with sublime
* Optimize component attribute completion to support current line and next line
* Fix Bug: Wrong completion for Picklist2 when ``if (acc.Picklist1 == 'abc' && acc.Picklist2 == 'bcd')``
* Fix Bug: Plugin found the wrong variable type in the commented code for variable completion
* Ignore exception when keep package.xml for every deploy action
* Rename Heroku to Haoku in the ``Main Menu > Utilities``
* Remove useless ``.travis.yml``
* Remove ugly code for check whether statement is comment for code
* Update ``execute_soql`` command to execute query in heroku

Notes:

* You should restart your sublime after ``HaoIDE`` is upgraded
-----------
2 changes: 1 addition & 1 deletion config/settings/package.sublime-settings
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "haoide",
"version": "2.8.3",
"version": "2.8.4",
"description": "haoide is a Sublime Text 3 plugin for Salesforce and used for swift development on Force.com",
"author": "Hao Liu",
"email": "[email protected]",
Expand Down
7 changes: 6 additions & 1 deletion config/settings/toolingapi.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@
// If you change this setting, you need to reload active cache to ensure it work
"display_field_name_and_label" : true,

// Indicate whether disable html completion,
// Because sublime text has the default html completion code,
// so this feature is set to true by default
"disable_html_completion": true,

// Indicate whether keep execute_anonymous, query and run test history to local
"keep_operation_history" : true,

Expand Down Expand Up @@ -422,7 +427,7 @@
"inFolder": "false",
"metaFile": "false",
"xmlName": "AuraDefinitionBundle",
"subscribe": true
"subscribe": false
}, {
"directoryName": "components",
"inFolder": "false",
Expand Down
1 change: 1 addition & 0 deletions context.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def get_settings():
settings["disable_relationship_completion"] = s.get("disable_relationship_completion", False)
settings["disable_soql_field_completion"] = s.get("disable_soql_field_completion", False)
settings["display_field_name_and_label"] = s.get("display_field_name_and_label", True)
settings["disable_html_completion"] = s.get("disable_html_completion", True)
settings["allowed_sobjects"] = s.get("allowed_sobjects", [])

# Bulk Api batch size and batch bytes
Expand Down
30 changes: 20 additions & 10 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,29 @@
from .salesforce import message


class Heroku(sublime_plugin.WindowCommand):
class Haoku(sublime_plugin.WindowCommand):
def __init__(self, *args, **kwargs):
super(Heroku, self).__init__(*args, **kwargs)
super(Haoku, self).__init__(*args, **kwargs)

def run(self):
def run(self, router=""):
settings = context.get_settings()
session = util.get_session_info(settings)
if not session:
Printer.get("error").write("Please Login Firstly")
return

heroku_host = "https://haoku.herokuapp.com"
util.open_with_browser("%s?accessToken=%s&instanceUrl=%s&userName=%s" % (
heroku_host, session["session_id"],
session["instance_url"], settings["username"]
))
# heroku_host = "http://localhost:3000"
show_params = {
"accessToken": session["session_id"],
"instanceUrl": session["instance_url"],
"username": settings["username"],
"router": router
}

show_params = urllib.parse.urlencode(show_params)
open_url = heroku_host + '?%s' % show_params
util.open_with_browser(open_url)

class JsonPretty(sublime_plugin.WindowCommand):
def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -1279,13 +1287,15 @@ def is_enabled(self):

class ExecuteSoqlCommand(sublime_plugin.TextCommand):
def run(self, view):
processor.handle_execute_query(self.view.substr(self.view.sel()[0]))
sublime.active_window().run_command("haoku", {
"router": "query?param=" + self.selection
})

def is_enabled(self):
# Selection must start SELECT,
# otherwise you can't see this command
self.selection = self.view.substr(self.view.sel()[0]).encode('utf-8')
if not self.selection or not self.selection.upper().startswith(b"SELECT"):
self.selection = self.view.substr(self.view.sel()[0])
if not self.selection or not self.selection.upper().startswith("SELECT"):
return False

return True
Expand Down
1 change: 1 addition & 0 deletions messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"2.8.1": "config/messages/2.8.1.md",
"2.8.2": "config/messages/2.8.2.md",
"2.8.3": "config/messages/2.8.3.md",
"2.8.4": "config/messages/2.8.4.md",
"install": "config/messages/install.txt"
}
26 changes: 26 additions & 0 deletions processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1353,6 +1353,32 @@ def handle_thread(thread, timeout):
view.run_command("goto_line", {"line": line})
view.run_command("expand_selection", {"to":"line"})

if hasattr(view, 'show_popup'):
error = """
<div id="content">
<div class="container">
<h1 class="panel-title">Compile Error</h1>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">%s</h3>
</div>
<div class="panel-body">
<p style="color: red">
<b>%s</b> at line <b>%s</b> column <b>%s</b>
</p>
</div>
</div>
</div>
</div>
""" % (
file_base_name,
result["problem"],
result["lineNumber"],
result["columnNumber"]
)
view.show_popup(error)

# Add highlight for error line and remove the highlight after several seconds
component_id = component_attribute["id"]
view.run_command("set_check_point", {"mark":component_id+"build_error"})
Expand Down
Loading

0 comments on commit cfe0bd1

Please sign in to comment.