This repository has been archived by the owner on Sep 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
jsRefactor Rename Relative Path issue fixed #14520
Merged
boopeshmahendran
merged 2 commits into
adobe:master
from
niteskum:jsRefactorRenameIssue
Aug 27, 2018
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,8 @@ define(function (require, exports, module) { | |
Session = brackets.getModule("JSUtils/Session"), | ||
MessageIds = brackets.getModule("JSUtils/MessageIds"), | ||
TokenUtils = brackets.getModule("utils/TokenUtils"), | ||
Strings = brackets.getModule("strings"); | ||
Strings = brackets.getModule("strings"), | ||
ProjectManager = brackets.getModule("project/ProjectManager"); | ||
|
||
var session = null, // object that encapsulates the current session state | ||
keywords = ["define", "alert", "exports", "require", "module", "arguments"]; | ||
|
@@ -98,7 +99,17 @@ define(function (require, exports, module) { | |
|
||
function isInSameFile(obj, refsResp) { | ||
// In case of unsaved files, After renameing once Tern is returning filename without forward slash | ||
return (obj && (obj.file === refsResp.file || obj.file === refsResp.file.slice(1, refsResp.file.length))); | ||
var projectDir = ProjectManager.getProjectRoot().fullPath, | ||
fileName = ""; | ||
|
||
// get the relative path of File as Tern can also return | ||
// references with file name as a relative path wrt projectRoot | ||
// so refernce file will be compared with both relative and Absolute path ti check if it is same file | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: fix typos |
||
if (projectDir && refsResp && refsResp.file && refsResp.file.indexOf(projectDir) === 0) { | ||
fileName = refsResp.file.slice(projectDir.length); | ||
} | ||
return (obj && (obj.file === refsResp.file || obj.file === fileName | ||
|| obj.file === refsResp.file.slice(1, refsResp.file.length))); | ||
} | ||
|
||
/** | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check if
ProjectManager.getProjectRoot()
returns null