Make getNonWordCharacters take a position

This commit is contained in:
Max Brunsfeld
2017-11-06 16:29:02 -08:00
parent 96e4018ef7
commit 3d36455885
4 changed files with 12 additions and 12 deletions

View File

@@ -702,7 +702,7 @@ class Cursor extends Model {
*/
getNonWordCharacters () {
return this.editor.getNonWordCharacters(this.getScopeDescriptor().getScopesArray())
return this.editor.getNonWordCharacters(this.getBufferPosition())
}
changePosition (options, fn) {

View File

@@ -4106,9 +4106,9 @@ class TextEditor {
// for the purpose of word-based cursor movements.
//
// Returns a {String} containing the non-word characters.
getNonWordCharacters (scopes) {
getNonWordCharacters (position) {
const languageMode = this.buffer.getLanguageMode()
return (languageMode.getNonWordCharacters && languageMode.getNonWordCharacters(scopes)) ||
return (languageMode.getNonWordCharacters && languageMode.getNonWordCharacters(position)) ||
this.nonWordCharacters
}

View File

@@ -59,7 +59,8 @@ class TokenizedBuffer {
return this.grammar.name
}
getNonWordCharacters (scope) {
getNonWordCharacters (position) {
const scope = this.scopeDescriptorForPosition(position)
return this.config.get('editor.nonWordCharacters', {scope})
}