mirror of
https://github.com/RustyRaptor/brackets.git
synced 2026-12-04 00:15:22 -07:00
Remember the resolved path we used with tern so that jump to definition across files work. Also clean-up some error conditions when the definition location is not known.
This commit is contained in:
1 parent
aeee6aaa06
commit
ec9a5afa83
2 files changed
+27
-19
No files matched your search
@@ -396,29 +396,24 @@ define(function (require, exports, module) {
|
||||
if (response.hasOwnProperty("promise")) {
|
||||
response.promise.done(function (jumpResp) {
|
||||
|
||||
if (jumpResp.resultFile && (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);
|
||||
if (jumpResp.resultFile) {
|
||||
if (jumpResp.resultFile !== jumpResp.file) {
|
||||
var resolvedPath = ScopeManager.getResolvedPath(jumpResp.resultFile);
|
||||
if (resolvedPath) {
|
||||
CommandManager.execute(Commands.FILE_OPEN, {fullPath: resolvedPath})
|
||||
.done(function() {
|
||||
session.editor.setCursorPos(jumpResp.start);
|
||||
session.editor.setSelection(jumpResp.start, jumpResp.end);
|
||||
session.editor.centerOnCursor();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
dir = "";
|
||||
session.editor.setCursorPos(jumpResp.start);
|
||||
session.editor.setSelection(jumpResp.start, jumpResp.end);
|
||||
session.editor.centerOnCursor();
|
||||
}
|
||||
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 () {
|
||||
response.reject();
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user