mirror of
https://github.com/RustyRaptor/brackets.git
synced 2026-12-04 00:15:22 -07:00
Make Jump-To-Definition switch to new file when definition isn't local to current file.
This commit is contained in:
1 parent
cf26938891
commit
0bab9dc3fd
2 files changed
+23
-2
No files matched your search
@@ -29,6 +29,7 @@ define(function (require, exports, module) {
|
||||
|
||||
var CodeHintManager = brackets.getModule("editor/CodeHintManager"),
|
||||
EditorManager = brackets.getModule("editor/EditorManager"),
|
||||
DocumentManager = brackets.getModule("document/DocumentManager"),
|
||||
Commands = brackets.getModule("command/Commands"),
|
||||
CommandManager = brackets.getModule("command/CommandManager"),
|
||||
Menus = brackets.getModule("command/Menus"),
|
||||
@@ -394,8 +395,27 @@ define(function (require, exports, module) {
|
||||
if (response.hasOwnProperty("promise")) {
|
||||
response.promise.done(function (jumpResp) {
|
||||
|
||||
session.editor.setSelection(jumpResp.start, jumpResp.end);
|
||||
if (jumpResp.resultFile !== jumpResp.file) {
|
||||
|
||||
var doc = DocumentManager.getCurrentDocument();
|
||||
var x = doc.file.fullPath.lastIndexOf("/");
|
||||
var dir;
|
||||
if (x >= 0) {
|
||||
dir = doc.file.fullPath.slice(0, x + 1);
|
||||
} else {
|
||||
dir = "";
|
||||
}
|
||||
CommandManager.execute(Commands.FILE_OPEN, { fullPath: dir+jumpResp.resultFile })
|
||||
.done(function() {
|
||||
session.editor.setCursorPos(jumpResp.start);
|
||||
session.editor.setSelection(jumpResp.start, jumpResp.end);
|
||||
session.editor.centerOnCursor();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
session.editor.setCursorPos(jumpResp.start);
|
||||
session.editor.setSelection(jumpResp.start, jumpResp.end);
|
||||
session.editor.centerOnCursor();
|
||||
|
||||
}).fail(function () {
|
||||
|
||||
Reference in new issue
Block a user