diff --git a/lib/runtime/refactor.js b/lib/runtime/refactor.js index 800ed488..03998139 100644 --- a/lib/runtime/refactor.js +++ b/lib/runtime/refactor.js @@ -19,24 +19,26 @@ class Refactor { if (!client.isActive()) return - const range = getWordRangeAtBufferPosition(editor, bufferPosition, wordRegexWithoutDotAccessor) + const range = getWordRangeAtBufferPosition(editor, bufferPosition, { + wordRegex: wordRegexWithoutDotAccessor + }) if (range.isEmpty()) return - const old = editor.getTextInBufferRange(range) - if (!isValidWordToInspect(old)) return + const oldWord = editor.getTextInBufferRange(range) + if (!isValidWordToInspect(oldWord)) return const rangeFull = getWordRangeAtBufferPosition(editor, bufferPosition) - const full = editor.getTextInBufferRange(rangeFull) + const fullWord = editor.getTextInBufferRange(rangeFull) this.ink.showBasicModal([{ name: 'Rename', - defaultText: old, - message: `Enter an new name to which \`${old}\` will be renamed.` + defaultText: oldWord, + message: `Enter an new name to which \`${oldWord}\` will be renamed.` }]).then(items => { // check the new name is a valid identifier - const _new = items['Rename'] - if (!isValidWordToInspect(_new) || _new.match(wordRegexWithoutDotAccessor) != _new) { + const newWord = items['Rename'] + if (!isValidWordToInspect(newWord) || newWord.match(wordRegexWithoutDotAccessor) != newWord) { atom.notifications.addWarning('Julia Client: Rename Refactor', { - description: `\`${_new}\` isn't a valid identifier` + description: `\`${newWord}\` isn't a valid identifier` }) return } @@ -50,9 +52,9 @@ class Refactor { const mod = currentModule ? currentModule : 'Main' renamerefactor({ - old, - full, - new: _new, + oldWord, + fullWord, + newWord, // local context column: column + 1, row: row + 1,