Skip to content

Commit

Permalink
fixed #32
Browse files Browse the repository at this point in the history
  • Loading branch information
mackenza committed May 21, 2015
1 parent e6a5192 commit 4d34319
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Change Log
All notable changes to this project will be documented in this file.

## 1.2.0 - 2015-05-21

### Added
- When inserting predefined functions, now add parens () and place cursor between them. Mostly addresses [feature request #32](https://github.com/mackenza/Brackets-PHP-SmartHints/issues/32)

### Removed
- changed minimum supported Brackets version to 1.0.0 because who would ever use sprint 37? Don't be that guy.

## 1.1.8 - 2015-05-21

### Added
Expand Down
7 changes: 5 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ define(function (require, exports, module) {
$fHint = $("<span>")
.addClass("PHPSmartHints-completion")
.addClass("PHPSmartHints-completion-phpfunction")
.text(this.cachedPhpFunctions[i]);
.text(this.cachedPhpFunctions[i] + "()");
phpFuncList.push($fHint);
}
}
Expand All @@ -211,8 +211,11 @@ define(function (require, exports, module) {
replaceStart = {line: cursor.line, ch: currentToken.start},
replaceEnd = {line: cursor.line, ch: cursor.ch};


this.editor.document.replaceRange($hint.text(), replaceStart, replaceEnd);
if ($hint.text().slice(-1) === ")") {
cursor = this.editor.getCursorPos();
this.editor.setCursorPos({line: cursor.line, ch: cursor.ch - 1});
}
return false;
};

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"title": "PHP SmartHints",
"description": "Provides code hints for PHP files including PHP keywords, built-in functions, constants and variables. Also provides hinting for variables in the current open PHP document. Note that this is a continuation of the former [PHP-SIG] Brackets-PHP-SmartHints and not a new extension or fork. The Brackets Registry flags it as a new extension if you change the name (makes sense).",
"homepage": "https://github.com/mackenza/Brackets-PHP-SmartHints",
"version": "1.1.8",
"version": "1.2.0",
"author": "Andrew MacKenzie <a.mackenzie@gmail.com> (https://github.com/mackenza)",
"license": "MIT",
"engines": {
"brackets": ">=0.37.0"
"brackets": ">=1.0.0"
},
"i18n": [
"en", "de", "it", "fr"
Expand Down

0 comments on commit 4d34319

Please sign in to comment.