From b0167850e50c6454b969b9c7addc418018b9f3b2 Mon Sep 17 00:00:00 2001 From: aviatesk Date: Sat, 9 Nov 2019 18:25:19 +0900 Subject: [PATCH] update to #651 --- lib/runtime/refactor.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) 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,