Skip to content

Commit 8e4e6dc

Browse files
committed
ignore dot accessors in atom-julia-client
1 parent e9b7feb commit 8e4e6dc

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lib/misc/words.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { Point, Range } from 'atom'
44

5-
export const wordRegex = /[\u00A0-\uFFFF\w_!´\.]*@?[\u00A0-\uFFFF\w_!´]+/
5+
const wordRegex = /[\u00A0-\uFFFF\w_!´\.]*@?[\u00A0-\uFFFF\w_!´]+/
66

77
/**
88
* Takes an `editor` and gets the word at current cursor position. If that is nonempty, call

lib/runtime/refactor.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
import { client } from '../connection'
44
import modules from './modules'
5-
import { wordRegex, getWord, isValidWordToInspect } from '../misc/words'
5+
import { getWordRangeAtBufferPosition, isValidWordToInspect } from '../misc/words'
66
import { getLocalContext } from '../misc/blocks'
77

88
const { refactor: _refactor } = client.import(['refactor'])
9+
const wordRegexWithoutDotAccessor = /@?[\u00A0-\uFFFF\w_!´]+/
910

1011
class Refactor {
1112
activate (ink) {
@@ -18,7 +19,9 @@ class Refactor {
1819

1920
if (!client.isActive()) return
2021

21-
const { word: old } = getWord(editor, bufferPosition)
22+
const range = getWordRangeAtBufferPosition(editor, bufferPosition, wordRegexWithoutDotAccessor)
23+
if (range.isEmpty()) return
24+
const old = editor.getTextInBufferRange(range)
2225
if (!isValidWordToInspect(old)) return
2326

2427
this.ink.showBasicModal([{
@@ -28,7 +31,7 @@ class Refactor {
2831
}]).then(items => {
2932
// check the new name is a valid identifier
3033
const _new = items['Rename']
31-
if (!isValidWordToInspect(_new) || _new.match(wordRegex) != _new) {
34+
if (!isValidWordToInspect(_new) || _new.match(wordRegexWithoutDotAccessor) != _new) {
3235
atom.notifications.addWarning('Julia Client: Rename Refactor', {
3336
description: `\`${_new}\` is not a valid identifier`
3437
})

0 commit comments

Comments
 (0)