Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 66ac471

Browse files
add OtherAlpabetic chars to Unicode completion
1 parent c86c3fb commit 66ac471

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

lib/autocomplete-manager.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const fuzzaldrinPlus = require('fuzzaldrin-plus')
55

66
const ProviderManager = require('./provider-manager')
77
const SuggestionList = require('./suggestion-list')
8-
const {UnicodeLetters} = require('./unicode-helpers')
8+
const {UnicodeAlpha} = require('./unicode-helpers')
99
const getAdditionalWordCharacters = require('./get-additional-word-characters')
1010

1111
const wordCharacterRegexCache = new Map()
@@ -57,8 +57,8 @@ class AutocompleteManager {
5757

5858
this.subscriptions.add(atom.config.observe('autocomplete-plus.enableExtendedUnicodeSupport', enableExtendedUnicodeSupport => {
5959
if (enableExtendedUnicodeSupport) {
60-
this.prefixRegex = new RegExp(`(['"~\`!@#\\$%^&*\\(\\)\\{\\}\\[\\]=+,/\\?>])?(([${UnicodeLetters}\\d_]+[${UnicodeLetters}\\d_-]*)|([.:;[{(< ]+))$`)
61-
this.wordPrefixRegex = new RegExp(`^[${UnicodeLetters}\\d_]+[${UnicodeLetters}\\d_-]*$`)
60+
this.prefixRegex = new RegExp(`(['"~\`!@#\\$%^&*\\(\\)\\{\\}\\[\\]=+,/\\?>])?(([${UnicodeAlpha}\\d_]+[${UnicodeAlpha}\\d_-]*)|([.:;[{(< ]+))$`)
61+
this.wordPrefixRegex = new RegExp(`^[${UnicodeAlpha}\\d_]+[${UnicodeAlpha}\\d_-]*$`)
6262
} else {
6363
this.prefixRegex = /(\b|['"~`!@#$%^&*(){}[\]=+,/?>])((\w+[\w-]*)|([.:;[{(< ]+))$/
6464
this.wordPrefixRegex = /^\w+[\w-]*$/
@@ -510,7 +510,7 @@ See https://github.com/atom/autocomplete-plus/wiki/Provider-API`
510510
let regex = wordCharacterRegexCache.get(additionalWordChars)
511511

512512
if (!regex) {
513-
regex = new RegExp(`[${UnicodeLetters}${additionalWordChars.replace(']', '\\]')}]`)
513+
regex = new RegExp(`[${UnicodeAlpha}${additionalWordChars.replace(']', '\\]')}]`)
514514
wordCharacterRegexCache.set(additionalWordChars, regex)
515515
}
516516
return regex

lib/suggestion-list.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const {Emitter, CompositeDisposable} = require('atom')
2-
const { UnicodeLetters } = require('./unicode-helpers')
2+
const { UnicodeAlpha } = require('./unicode-helpers')
33
const SuggestionListElement = require('./suggestion-list-element')
44

55
module.exports =
@@ -29,7 +29,7 @@ class SuggestionList {
2929
}))
3030
this.subscriptions.add(atom.config.observe('autocomplete-plus.enableExtendedUnicodeSupport', (enableExtendedUnicodeSupport) => {
3131
if (enableExtendedUnicodeSupport) {
32-
this.wordPrefixRegex = new RegExp(`^[${UnicodeLetters}\\d_-]`)
32+
this.wordPrefixRegex = new RegExp(`^[${UnicodeAlpha}\\d_-]`)
3333
} else {
3434
this.wordPrefixRegex = /^[\w-]/
3535
}

lib/symbol-provider.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import _ from 'underscore-plus'
44
import { CompositeDisposable } from 'atom'
55
import { Selector } from 'selector-kit'
6-
import { UnicodeLetters } from './unicode-helpers'
6+
import { UnicodeAlpha } from './unicode-helpers'
77
import SymbolStore from './symbol-store'
88

99
export default class SymbolProvider {
@@ -13,9 +13,9 @@ export default class SymbolProvider {
1313
this.subscriptions = new CompositeDisposable()
1414
this.subscriptions.add(atom.config.observe('autocomplete-plus.enableExtendedUnicodeSupport', enableExtendedUnicodeSupport => {
1515
if (enableExtendedUnicodeSupport) {
16-
this.wordRegex = new RegExp(`[${UnicodeLetters}\\d_]*[${UnicodeLetters}}_-]+[${UnicodeLetters}}\\d_]*(?=[^${UnicodeLetters}\\d_]|$)`, 'g')
17-
this.beginningOfLineWordRegex = new RegExp(`^[${UnicodeLetters}\\d_]*[${UnicodeLetters}_-]+[${UnicodeLetters}\\d_]*(?=[^${UnicodeLetters}\\d_]|$)`, 'g')
18-
this.endOfLineWordRegex = new RegExp(`[${UnicodeLetters}\\d_]*[${UnicodeLetters}_-]+[${UnicodeLetters}\\d_]*$`, 'g')
16+
this.wordRegex = new RegExp(`[${UnicodeAlpha}\\d_]*[${UnicodeAlpha}}_-]+[${UnicodeAlpha}}\\d_]*(?=[^${UnicodeAlpha}\\d_]|$)`, 'g')
17+
this.beginningOfLineWordRegex = new RegExp(`^[${UnicodeAlpha}\\d_]*[${UnicodeAlpha}_-]+[${UnicodeAlpha}\\d_]*(?=[^${UnicodeAlpha}\\d_]|$)`, 'g')
18+
this.endOfLineWordRegex = new RegExp(`[${UnicodeAlpha}\\d_]*[${UnicodeAlpha}_-]+[${UnicodeAlpha}\\d_]*$`, 'g')
1919
} else {
2020
this.wordRegex = /\b\w*[a-zA-Z_-]+\w*\b/g
2121
this.beginningOfLineWordRegex = /^\w*[a-zA-Z_-]+\w*\b/g

lib/unicode-helpers.js

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)