Skip to content

Commit

Permalink
release 3.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
xjsender committed Jul 16, 2015
1 parent bb1b0dc commit 56837d2
Show file tree
Hide file tree
Showing 17 changed files with 322 additions and 168 deletions.
19 changes: 19 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ Release History
---------------


Release 3.1.1 (2015-07-16)
++++++++++++++++++
* Bug fix:
- Fix a issue for ``save_to_server`` command when ``api_version`` is less than 29
- Fix problem in ``Class Body - test data util body-sublime-snippet.sublime-snippet``

* Enhancement:
- Enhancement for issue #53
- Enhancement for issue #54
- Support deploy and retrieve for metadataObject which is in folder
- Add support for visualforce email template development
- Add select all feature for ``toggle_metadata_objects`` command
- Add ``Territory2`` to ``allowed_sobjects`` list

* Update:
- Remove ``disable_visualforce_completion`` setting
- Add four settings to disable part of completion in visualforce page, see more in ``docs/completion.md``


Release 3.1.0 (2015-07-09)
++++++++++++++++++
* Enhancement:
Expand Down
138 changes: 71 additions & 67 deletions completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,8 @@ def on_query_completions(self, view, prefix, locations):

# Call Inner Class in the same class
elif view.file_name():
namespace, extension = util.get_file_attr(view.file_name())
attributes = util.get_file_attributes(view.file_name())
namespace = attributes["name"]
if namespace and namespace.lower() in symbol_tables:
inners = symbol_tables[namespace.lower()]["inners"]

Expand Down Expand Up @@ -436,10 +437,6 @@ def on_query_completions(self, view, prefix, locations):
settings = context.get_settings()
username = settings["username"]

# If visualforce completion is disabled, just return
if settings["disable_visualforce_completion"]:
return []

pt = locations[0] - len(prefix) - 1
ch = view.substr(sublime.Region(pt, pt + 1))
next_char = view.substr(sublime.Region(pt + 2, pt + 3))
Expand Down Expand Up @@ -510,33 +507,37 @@ def on_query_completions(self, view, prefix, locations):
# Get the begin point of current line
cursor_row, cursor_col = view.rowcol(pt)

# Get the two chars after course point
# If these two chars is '="', it means attribute value is already exist
# we will not add ="{!}" or ="" for this attribute
forward_two_chars = view.substr(sublime.Region(pt + 2, pt + 4))

# Get all matched regions
matched_regions = view.find_all("<\w+:\w+[\s\S]*?>")

# Choose the matched one that contains cursor point
matched_region = None
for mr in matched_regions:
if mr.contains(pt):
matched_region = mr

##########################################
# Visualforce Attribute Completions
##########################################
if matched_region:
matched_tag = view.substr(matched_region).split(" ")[0][1:].strip()

# Combine the attr of matched visualforce tag
if matched_tag in vf.tag_defs:
def_entry = vf.tag_defs[matched_tag]
for key, value in def_entry['attribs'].items():
if "values" in value or forward_two_chars == '="':
completion_list.append((key + '\t' + value['type'], key))
else:
if not settings["disable_component_attribute_completion"]:
# Get the two chars after course point
# If these two chars is '="', it means attribute value is already exist
# we will not add ="{!}" or ="" for this attribute
forward_two_chars = view.substr(sublime.Region(pt + 2, pt + 4))

# Get all matched regions
matched_regions = view.find_all("<\w+:\w+[\s\S]*?>")

# Choose the matched one that contains cursor point
matched_region = None
for mr in matched_regions:
if mr.contains(pt):
matched_region = mr
break

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

# Combine the attr of matched visualforce tag
if matched_tag in vf.tag_defs:
def_entry = vf.tag_defs[matched_tag]
for key, value in def_entry['attribs'].items():
# Has value completion
if "values" in value or forward_two_chars == '="':
completion_list.append((key + '\t' + value['type'], key))
continue

if value["type"] in ["Object", "ApexPages.Action"]:
completion_list.append((key + '\t' + value['type'], key+'="{!$1}"$0'))
else:
Expand All @@ -546,23 +547,24 @@ def on_query_completions(self, view, prefix, locations):
# Custom Component Attribute Completions
##########################################
# 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:]
tag_name = matched_tag.split(":")[1].strip()
return util.get_component_attributes(settings, tag_name)
if not settings["disable_custom_component_completion"]:
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:]
tag_name = matched_tag.split(":")[1].strip()
return util.get_component_attributes(settings, tag_name)

##########################################
# HTML Element Attribute Completions
Expand Down Expand Up @@ -599,32 +601,33 @@ def on_query_completions(self, view, prefix, locations):
##########################################
# Visualforce Attribute Values Completions
##########################################
matched_regions = view.find_all("<\w+:\w+[\s\S]*?>")
if not settings["disable_component_attribute_value_completion"]:
matched_regions = view.find_all("<\w+:\w+[\s\S]*?>")

matched_region = None
for mr in matched_regions:
if mr.contains(pt):
matched_region = mr
matched_region = None
for mr in matched_regions:
if mr.contains(pt):
matched_region = mr

if matched_region:
# Get the Tag Name and Tag Attribute Name
matched_tag = view.substr(matched_region)[1:]
matched_tag = matched_tag.split(" ")[0].strip()
matched_attr_name = view.substr(view.word(pt-1))
if matched_region:
# Get the Tag Name and Tag Attribute Name
matched_tag = view.substr(matched_region)[1:]
matched_tag = matched_tag.split(" ")[0].strip()
matched_attr_name = view.substr(view.word(pt-1))

# Get the Attribute Values
if matched_tag in vf.tag_defs and matched_attr_name in vf.tag_defs[matched_tag]["attribs"]:
tag_attribute = vf.tag_defs[matched_tag]["attribs"][matched_attr_name]
# Get the Attribute Values
if matched_tag in vf.tag_defs and matched_attr_name in vf.tag_defs[matched_tag]["attribs"]:
tag_attribute = vf.tag_defs[matched_tag]["attribs"][matched_attr_name]

# If attr type boolean, add {!} to it
if tag_attribute["type"] == "Boolean":
completion_list.append(("{!}" + "\t" + matched_attr_name, '"{!$1}"$0'))
# If attr type boolean, add {!} to it
if tag_attribute["type"] == "Boolean":
completion_list.append(("{!}" + "\t" + matched_attr_name, '"{!$1}"$0'))

if "values" in tag_attribute:
for value in tag_attribute["values"]:
completion_list.append((value + "\t" + matched_attr_name, '"%s"' % value))
if "values" in tag_attribute:
for value in tag_attribute["values"]:
completion_list.append((value + "\t" + matched_attr_name, '"%s"' % value))

return completion_list
return completion_list

##########################################
# HTML Element Attribute Values Completions
Expand Down Expand Up @@ -661,7 +664,8 @@ def on_query_completions(self, view, prefix, locations):
completion_list.extend(apex_class_completion)

elif ch == ".":
if not view.file_name(): return completion_list
if not view.file_name():
return completion_list

# Get the name of controller or extension
pattern = '\\s+(controller="\\w+"|extensions="\\w+")'
Expand Down
7 changes: 7 additions & 0 deletions config/keymap/Default (Linux).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
}
},

// Deploy to this server
{"keys": ["alt+shift+s"], "command": "deploy_file_to_server",
"args": {
"switch": false
}
},

// Update the default project
{"keys": ["alt+f7"], "command": "update_project"},

Expand Down
7 changes: 7 additions & 0 deletions config/keymap/Default (OSX).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
}
},

// Deploy to this server
{"keys": ["shift+command+s"], "command": "deploy_file_to_server",
"args": {
"switch": false
}
},

// Update the default project
{"keys": ["alt+r"], "command": "update_project"},

Expand Down
7 changes: 7 additions & 0 deletions config/keymap/Default (Windows).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
}
},

// Deploy to this server
{"keys": ["alt+shift+s"], "command": "deploy_file_to_server",
"args": {
"switch": false
}
},

// Update the default project
{"keys": ["alt+r"], "command": "update_project"},

Expand Down
5 changes: 5 additions & 0 deletions config/menus/Context.sublime-menu
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
// {"caption": "Rename from Server", "command": "rename_metadata"},

{"caption": "Deploy to Server", "command": "deploy_file_to_server"},
{"caption": "Deploy to This Server", "command": "deploy_file_to_server",
"args": {
"switch": false
}
},

{"caption": "Deploy Lighting Element to Server", "command": "deploy_lighting_element_to_server"},

Expand Down
19 changes: 19 additions & 0 deletions config/messages/3.1.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Build 3.1.1
-----------
Release Date: 16 July 2015

* Bug fix:
- Fix a issue for ``save_to_server`` command when ``api_version`` is less than 29
- Fix problem in ``Class Body - test data util body-sublime-snippet.sublime-snippet``

* Enhancement:
- Enhancement for issue #53
- Enhancement for issue #54
- Support deploy and retrieve for metadataObject which is in folder
- Add support for visualforce email template development
- Add select all feature for ``toggle_metadata_objects`` command
- Add ``Territory2`` to ``allowed_sobjects`` list

* Update:
- Remove ``disable_visualforce_completion`` setting
- Add four settings to disable part of completion in visualforce page, see more in ``docs/completion.md``
1 change: 1 addition & 0 deletions config/settings/HTML.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extensions": [
"page",
"component",
"email",
"auradoc",
"cmp",
"app",
Expand Down
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": "3.1.0",
"version": "3.1.1",
"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
15 changes: 12 additions & 3 deletions config/settings/toolingapi.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,17 @@
// If you change this setting, you need to reload sobject cache to ensure it work
"display_field_name_and_label" : true,

// Disable completion in visualforce page
"disable_visualforce_completion": false,
// Indicate whether disable attribute completion
"disable_component_attribute_completion": false,

// Flag to disable attribute value completion
"disable_component_attribute_value_completion": false,

// Flag to disable custom component attributes completion in visualforce page
"disable_custom_component_completion": false,

// Flag to disable apex variable completion in visualforce page
"disable_apex_completion_in_visualforce": false,

// Indicate whether disable html completion,
// Because sublime text has the default html completion code,
Expand Down Expand Up @@ -329,7 +338,7 @@

// Team Member
"AccountTeamMember", "OpportunityTeamMember", "CaseTeamMember", "UserTeamMember",
"GroupMember", "Group",
"GroupMember", "Group", "Territory2",

// Apex Code
"ApexClass", "ApexComponent", "ApexTrigger", "ApexPage",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Public class UtilTestData {
public static Sobject initiateSobject(Sobject so, String recordTypeName) {
if (so instanceof Account) {
so = initiateAccount((Account) acc);
so = initiateAccount((Account) so);
}
else if (so instanceof Contact) {
so = initiateContact((Contact) so);
Expand Down
5 changes: 4 additions & 1 deletion context.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,11 @@ 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_visualforce_completion"] = s.get("disable_visualforce_completion", False)
settings["disable_html_completion"] = s.get("disable_html_completion", True)
settings["disable_custom_component_completion"] = s.get("disable_custom_component_completion", False)
settings["disable_component_attribute_completion"] = s.get("disable_component_attribute_completion", False)
settings["disable_component_attribute_value_completion"] = s.get("disable_component_attribute_value_completion", False)
settings["disable_apex_completion_in_visualforce"] = s.get("disable_apex_completion_in_visualforce", False)
settings["allowed_sobjects"] = s.get("allowed_sobjects", [])

# Bulk Api batch size and batch bytes
Expand Down
20 changes: 20 additions & 0 deletions docs/completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,26 @@
- Input ``space`` after HTML tag name, for example, ``<a``, you will see all the attributes of this tags
- Input ``=`` after the HTML tag attribute, if this attributes has fixed values, plugin will list all available values for this tag attribute

### Settings for Visualforce and HTML completion
```json
// Indicate whether disable attribute completion
"disable_component_attribute_completion": false,

// Flag to disable attribute value completion
"disable_component_attribute_value_completion": false,

// Flag to disable custom component attributes completion in visualforce page
"disable_custom_component_completion": false,

// Flag to disable apex variable completion in visualforce page
"disable_apex_completion_in_visualforce": false,

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

### Apex Code Completion
* Keyword completion
* Stand Class Completion
Expand Down
Loading

0 comments on commit 56837d2

Please sign in to comment.