mirror of
https://github.com/RustyRaptor/brackets.git
synced 2026-12-04 00:15:22 -07:00
Stop appending parentheses when inserting a function. Instead, show param hints only after the open parenthesis is entered.
This commit is contained in:
1 parent
3ce6ae29fc
commit
fbf246a6a1
2 files changed
+26
-29
No files matched your search
@@ -467,8 +467,7 @@ define(function (require, exports, module) {
|
||||
query = session.getQuery(),
|
||||
start = {line: cursor.line, ch: cursor.ch - query.length},
|
||||
end = {line: cursor.line, ch: cursor.ch},
|
||||
invalidPropertyName = false,
|
||||
displayFunctionHint = false;
|
||||
invalidPropertyName = false;
|
||||
|
||||
if (session.getType().property) {
|
||||
// if we're inserting a property name, we need to make sure the
|
||||
@@ -503,13 +502,6 @@ define(function (require, exports, module) {
|
||||
}
|
||||
}
|
||||
|
||||
// If the completion is for a valid function, then append
|
||||
// "()" to the function name.
|
||||
if (!invalidPropertyName && /^fn\(/.test(hint.type)) {
|
||||
completion = completion.concat("()");
|
||||
displayFunctionHint = true;
|
||||
}
|
||||
|
||||
// Replace the current token with the completion
|
||||
// HACK (tracking adobe/brackets#1688): We talk to the private CodeMirror instance
|
||||
// directly to replace the range instead of using the Document, as we should. The
|
||||
@@ -517,26 +509,6 @@ define(function (require, exports, module) {
|
||||
// inline editors are open.
|
||||
session.editor._codeMirror.replaceRange(completion, start, end);
|
||||
|
||||
// If displaying a function hint, move the cursor inside the "()".
|
||||
// Then pop-up a function hint.
|
||||
if (displayFunctionHint) {
|
||||
var pos = {line: start.line, ch: start.ch + completion.length - 1};
|
||||
|
||||
// stop cursor tracking before setting the cursor to avoid bringing
|
||||
// down the current hint.
|
||||
if (ParameterHintManager.isHintDisplayed()) {
|
||||
ParameterHintManager.stopCursorTracking(session);
|
||||
}
|
||||
|
||||
session.editor._codeMirror.setCursor(pos);
|
||||
|
||||
if (ParameterHintManager.isHintDisplayed()) {
|
||||
ParameterHintManager.startCursorTracking(session);
|
||||
}
|
||||
|
||||
ParameterHintManager.popUpHint(ParameterHintManager.PUSH_EXISTING_HINT);
|
||||
}
|
||||
|
||||
// Return false to indicate that another hinting session is not needed
|
||||
return false;
|
||||
};
|
||||
@@ -576,6 +548,7 @@ define(function (require, exports, module) {
|
||||
.on(HintUtils.eventName("change"), function (event, editor, changeList) {
|
||||
if (!ignoreChange) {
|
||||
ScopeManager.handleFileChange(changeList);
|
||||
ParameterHintManager.popUpHintAtOpenParen();
|
||||
}
|
||||
ignoreChange = false;
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user