Skip to content

Commit c50566f

Browse files
committed
fix local renaming bug
1 parent 1779145 commit c50566f

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

client/modules/IDE/components/jump-to-definition.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ export function jumpToDefinition(pos) {
99
const token = cm.getTokenAt(pos);
1010
const tokenType = token.type;
1111

12-
if (!tokenType || !['variable', 'def'].some((t) => tokenType.includes(t)))
13-
return;
12+
if (!tokenType || tokenType === 'def') return;
1413

1514
const varName = token.string;
1615
const ast = getAST(cm);

client/modules/IDE/components/rename-variable.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,10 @@ function startRenaming(cm, ast, fromPos, newName, oldName) {
108108
(!isShadowedLocally &&
109109
thisScopeVars.hasOwnProperty(oldName) === {} &&
110110
baseContext === 'global') ||
111-
(baseContext === 'global' && !thisScopeVars.hasOwnProperty(oldName));
111+
(baseContext === 'global' && !thisScopeVars.hasOwnProperty(oldName)) ||
112+
(isDeclaredGlobally &&
113+
!thisScopeVars.hasOwnProperty(oldName) &&
114+
!isDeclaredInBaseScope);
112115

113116
const shouldRenameGlobalVar =
114117
thisContext === 'global' && !isDeclaredInBaseScope;

0 commit comments

Comments
 (0)